Search code examples
androidcordovaapkphonegapandroid-studio-3.0

Cordova build (Android SDK Platform 26, Android SDK Build-Tools 26.0.2)


I'm trying to build an APK using cordova. I started off by doing:

1) sudo npm install -g cordova

2) cordova create app com.example.hello app

3) cordova platform add android

Then I used:

cordova requirements

which gives this output: Android Studio project detected

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed 
android: Command failed with exit code ENOENT
Gradle: installed /usr/share/gradle/bin/gradle
(node:27773) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Some of requirements check failed

and finally I use:

cordova build

which results in this:

* What went wrong:
A problem occurred configuring project ':CordovaLib'.
> You have not accepted the license agreements of the following SDK components:
  [Android SDK Platform 26, Android SDK Build-Tools 26.0.2].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

I am completely lost. Any help would be greatly appreciated!


Solution

  • Open your Android Studio. Go to Preferences -> Appearance and Behaviour -> System Settings -> Android SDK.

    In SDK platforms tab, download the SDK platform for Android 8.0(API level 26) and in the SDK Tools tab, download the Android SDK Platform - Tools version 26.0.2 .

    Then try a cordova build.