I trying to build android version 6.4.0 after install crosswalk plugin version 2.4.0.
First I removed the android platform and I reinstalled it using the following commands:
ionic cordova platform rm android
ionic cordova platform add android#6.4.0
The installation is succeeded.
Moreover, I installed the crosswalk plugin using the following command line:
ionic cordova plugin add cordova-plugin-crosswalk-webview
Also the installation is succeeded
Now I need to build the ionic2 application!
ionic cordova build android
But the building is failed I got the following errors:
> cordova build android
ANDROID_HOME=/Users/Khaled/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
Subproject Path: CordovaLib
Configuration 'compile' in project ':' is deprecated. Use 'implementation' instead.
null
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_cobuqw2y8dlztu9fe2xpnvg13.run(/Users/Khaled/iCloud Drive (Archive)/Documents/Projects/ionic/rnb/rnb-receiver/platforms/android/build.gradle:143)
org.xwalk:xwalk_core_library:23+
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
>
All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.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 1s
(node:21899) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: /Users/Khaled/iCloud Drive (Archive)/Documents/Projects/ionic/rnb/rnb-receiver/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> All flavors must now belong to a named flavor dimension. Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.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 1s
(node:21899) [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.
cordova version 8.0.0
What is the reason for this error occurrence. and what is the solution?
Thanks.
Related
I have an Ionic Cordova app that I have not touched in a few months. I wanted to make a small tweak to the app today and release it but when I did, I started having a dependency issue.
When I try to run 'ionic cordova run android' the build fails. Even without making any changes to the app (revert all changes and try to build what worked for the last APK) it still is failing. I have tried uninstalling the cordova intercom plugin and that changed nothing. I have also tried updating all of my npm packages and that did not help either.
This is the error log I get:
cordova run android
Android Studio project detected
cordova-android-firebase-gradle-release: Android platform: cordova-android#7
cordova-android-firebase-gradle-release: No custom version found in config.xml - using plugin default
cordova-android-play-services-gradle-release: Android platform: cordova-android#7
cordova-android-play-services-gradle-release: No custom version found in config.xml - using plugin default
cordova-android-support-gradle-release: Android platform: cordova-android#7
cordova-android-support-gradle-release: No custom version found in config.xml - using plugin default
Preparing Firebase on Android
ANDROID_HOME=C:\Users\Boogaloo\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
cordova-android-firebase-gradle-release: 15.0.0
cordova-android-play-services-gradle-release: 15.0.0
cordova-android-support-gradle-release: 27.+
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_8vin5yy2zwz3fxyzepqpp0rqu.run(C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\app\build.gradle:151)
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\cordova-plugin-intercom\savings-build-extras-intercom.gradle' line: 71
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:compile'.
Could not find com.google.android.gms:strict-version-matcher-plugin:15.0.0.
Searched in the following locations:
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
Required by:
project :app > com.google.gms:google-services:4.2.0
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 3s
(node:3432) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\cordova-plugin-intercom\savings-build-extras-intercom.gradle' line: 71
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:compile'.
Could not find com.google.android.gms:strict-version-matcher-plugin:15.0.0.
Searched in the following locations:
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
Required by:
project :app > com.google.gms:google-services:4.2.0
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 3s
at ChildProcess.whenDone (C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\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:3432) 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:3432) [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.
Update
I tried updating the cordova android platform to 7.1.0 but it hasn't helped.
I can't seem to delete the cordova firebase plugin using the command
ionic cordova plugin remove cordova-plugin-firebase
Do you use cordova-plugin-firebase?
If so,
run ionic cordova plugin remove cordova-plugin-firebase and try building again.
If it works, ionic cordova plugin add cordova-plugin-firebase#2.0.5
I am having trouble in building my ionic 3 app. Every time I try to build the android app it gives the following error.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
37 actionable tasks: 10 executed, 27 up-to-date
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 35s
(node:5924) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
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 35s
Picked up _JAVA_OPTIONS: -Xmx512M
(node:5924) [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.
Can anyone help me with the issue?
cordova clean android should fix your problem.
I solved it by removing platform and adding it again:
ionic cordova platform rm android
ionic cordova platform rm ios
ionic cordova platform add android
ionic cordova platform add ios
If the cordova clean command does not solve this problem for you, it might be related to the new implementation of AndroidX in some of your libraries.
In my case it was cordova-plugin-firebase-analytics
Follow these steps:
0 / Remove your android platform
cordova platform rm android
1 / Remove all plugins related to support / gradle / firebase versions control (Optional -- I didn't need to remove any plugins. So if you are not sure about how to do this, just skip this step)
2 / Add the AndroidX plugins from #dpa99c :
# add plugin to enable AndroidX in the project
cordova plugin add cordova-plugin-androidx
# add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX
cordova plugin add cordova-plugin-androidx-adapter
3 / Add your android platform
cordova platform add android
Thanks to #MathieuNa : https://forum.ionicframework.com/t/d8-program-type-already-present/166812/4?u=carlosglegaspi
Delete this folder: "../app/build"
error in my terminal
Android Studio project detected
ANDROID_HOME=C:\Users\FUJIN\AppData\Local\Android\Sdk\tools
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161\
studio
Subproject Path: CordovaLib
Subproject Path: app
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\FUJIN\hilih\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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 0s
(node:15572) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\FUJIN\hilih\platforms\android\CordovaLib\cordova.gradle' line: 68
What went wrong:
A problem occurred evaluating project ':CordovaLib'.
No installed build tools found. Install the Android build tools version 19.1.0 or higher.
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 0s
at ChildProcess.whenDone (C:\Users\FUJIN\hilih\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:180:13)
at maybeClose (internal/child_process.js:936:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5) (node:15572)
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:15572) [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. [02:00:48] lint finished
in 4.01 s
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
C:\Users\Tuladhar\WebstormProjects\myproject>ionic cordova build android
[WARN] Not performing Ionic build for project type: ionic1.
cordova build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\Tuladhar\WebstormProjects\myproject\hooks\after_prepare\010_add_platform_class.js C:\Users\Tuladhar\WebstormProjects\myproject
add to body class: platform-android
ANDROID_HOME=C:\Users\Tuladhar\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_859uxik73yildsrgrru9xamjo.run(C:\Users\Tuladhar\WebstormProjects\myproject\platforms\android\build.gradle:141)
BUILD FAILED
Total time: 22.164 secs
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApk'.
A problem occurred configuring project ':CordovaLib'.
Could not open cp_proj remapped class cache for cxcpcn2de84br0eekalu3p9nv (C:\Users\Tuladhar.gradle\caches\3.3\scripts-remapped\build_c7ur6ql0tv1x27ryhuthd38ad\cxcpcn2de84br0eekalu3p9nv\cp_proj1efd45104ffa2d33563b85b9edda76e3).
Unexpected lock protocol found in lock file. Expected 3, found 0.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApk'.
A problem occurred configuring project ':CordovaLib'.
Could not open cp_proj remapped class cache for cxcpcn2de84br0eekalu3p9nv (C:\Users\Tuladhar.gradle\caches\3.3\scripts-remapped\build_c7ur6ql0tv1x27ryhuthd38ad\cxcpcn2de84br0eekalu3p9nv\cp_proj1efd45104ffa2d33563b85b9edda76e3).
Unexpected lock protocol found in lock file. Expected 3, found 0.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] An error occurred while running cordova build android (exit code 1).
1.Remove platforms (you can delete it from folder)
2.Remove node_modules (you can delete it from folder)
3.Upgrade your ionic-cli version to the latest (npm update -g ionic )
4.run npm install
5.run ionic cordova platform add android
6.run ionic cordova run android
Try these steps accordingly and it will work. If not try updating android api and sdk tools and re-do the steps.
I use Ionic 3.4.0 to build android app, when I follow FCM firebase plugin docs
I get error during building android app. I did following:
1 Install plugin:
ionic cordova plugin add cordova-plugin-fcm
npm install --save #ionic-native/fcm
2 Run build android app:
ionic cordova build android
3 I got following error:
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=/home/tong/eproject/android
JAVA_HOME=/usr/lib/jvm/java-8-oracle/
Subproject Path: CordovaLib
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default
version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use
Task.doLast(Action) instead.
at
build_6dhr8ioykw4yco44wd3y0fmi8.run(/home/tong/eproject/ionic/MyInoicProject/platforms/android/build.gradle:138)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please
use TaskInputs.file(Object).skipWhenEmpty() instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.google.firebase:firebase-core:9.0.0.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-core:+ as no versions of
com.google.firebase:firebase-core are available.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of
com.google.firebase:firebase-messaging are available.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 24.847 secs
Error: /home/tong/eproject/ionic/MyInoicProject/platforms/android/gradlew: Command failed with exit code 1 Error
output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.google.firebase:firebase-core:9.0.0.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-core:+ as no versions of
com.google.firebase:firebase-core are available.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of
com.google.firebase:firebase-messaging are available.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It seems like I am missing com.google.firebase:firebase-core:9.0.0 I read from this post but it does not work when I try to update google services. Please help me thanks.