4
votes

am a beginner at ionic .. and am trying to generate the apk from an ionic project .. but unfortunately it failed to be generated.giving this error

 Android Studio project detected

ANDROID_HOME=C:\Users\abdel ysf\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\java\jdk1.8.0_151 studio Subproject Path: CordovaLib Subproject Path: app publishNonDefault is deprecated and has no effect anymore. All variants are now published. [18:51:59] lint finished in 15.14 s Checking the license for package Android SDK Platform 26 in C:\Users\abdel ysf\AppData\Local\Android\sdk\licenses Warning: License for package Android SDK Platform 26 not accepted.

FAILURE: Build failed with an exception.

  • 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]. 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

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 7s (node:23120) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output: FAILURE: Build failed with an exception.

  • 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]. 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

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

  • Get more help at https://help.gradle.org

BUILD FAILED in 7s at ChildProcess.whenDone (C:\Users\abdel ysf\Desktop\ionic\HelloWorld\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23) at emitTwo (events.js:126:13) at ChildProcess.emit (events.js:214:7) at maybeClose (internal/child_process.js:925:16) at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5) (node:23120) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:23120) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

the command which i hade used is : ionic cordova build android

3

3 Answers

3
votes

Open Android Studio SDK Manager and under 'SDK platforms' tab, select the required Android versions(Ex:Android 8.1(Oreo)) and click OK. If the error keeps repeating, try installing some of the previous Android versions too.

2
votes

Open Android studio, open Android SDK manager. Accept License of SDK.

-1
votes

Find your own local android-sdk, if you download the relevant sdk of ndk, there will be a folder called "ndk-bundle"

enter image description here

There is a folder called "toolchains" inside.

enter image description here

We noticed that there are no mips64el related files inside.

enter image description here

The solution is as follows:

Click here to download the NDK package separately through the browser. After unzipping, open the "toolchains" folder, compare it with the android-sdk->ndk-bundle->toolchains folder, find the missing folder, copy the past 3. Recompile, the problem is solved. Hope it helps you mate