Closed rolinger closed 6 years ago
I will add that for the last 2 days I have been doing a fresh install with all the latest and greatest of each of the following: AndroidStudio 3.1 Java JDK 1.8.2_162 (I tried to use JDK 9 but too many failures) npm: 5.6.0 node: 6.9.1 cordova: 8.0.0 ionic: 3.19.1 cordova-android: 7.0.0
After building the initial project I then added each plugin one at a time, compiling the app and then launching the app to an Android phone. I use a total of 37 plugins. I installed 31 plugins, two minor plugins would not install so I skipped those, but when I got to the 32 second plugin cordova.plugins.diagnostic
it installed but failed to compile. Soooo close. :\
I then uninstalled 3.9.2 and installed a v3.8.1 that is currently working on an older installation but it too failed to compile. This is a CRITICAL plugin for my app, so I can't proceed without it.
Granted....all of the above is just to my current older environment (like: ionic v1) completely upgraded. And then I will throw all of my code (js, templates, controllers, services, etc) into the mix and see how much of it breaks and I have to recode. But I can't do any of that until the environment, with all the plugins my app needs, is stable.
I feel your pain, but I have to say I have a strong suspicion this is a case of inter-plugin conflict rather than this plugin causing an explicit build problem.
This issue is almost identical to #258 and as you'll see from this comment I was able to build a fresh Cordova project with cordova@8.0.0
and cordova-android@7.0.0
on both OSX and Windows 10 with no build problems.
The principle cause of the error in your build log seems to be this:
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Thanks Gradle - that's not a great deal of help! But my money is that there's some collision with another plugin in your project, since with a fresh project I'm not able to reproduce the error. Howerver, to eliminate any possible issue with build environment, you could try building a clean test project containing only this plugin.
My first suggestion would be to run the build with a more verbose Gradle log setting to try to get something useful out of Gradle. You can use the --stacktrace --debug
options to get that.
Not sure how to pass these directly from the Cordova/Ionic CLI, but you can do so by building from Android Studio - see here for details how.
If that gives some indication of why Gradle failed, then post the log output here.
Otherwise, plan B: create a test project, add this plugin, then incrementally, one-by-one, add each plugin in your actual project then build, until the build fails. At least this may indicate which other plugin is causing the collision.
In terms of Android dependencies, this plugin is pretty light on them, so my money is on the Android Support library which it does include.
Cool. Thanks for the feed back. I will go rebuild a new one and start with this plugin and add one by one after that. I tell ya though...37 plugins and I made it #32 before the fail...I saw the light at the end of the tunnel and thought I was in the clear. The real issues I am going to have, though, is when I get all 37 plugins installed and stable - then when I port all my www/js files over and try to launch thats when all hell is going to break loose. My app is still Ionic v1 and Angluar v1. Can't wait!!!
I will post the results of my tests back here.
hello, i am facing the same issue, its not the conflict because i resolve the google-play-service conflicts using another plugin ionic cordova plugin add cordova-android-play-services-gradle-release
. but the issue remains.
mergeReleaseAssets UP-TO-DATE
:transformClassesWithDexForRelease FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzcdr;
* 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: 28.296 secs
Error: /Users/project/platforms/android/gradlew: 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: /Users/project/platforms/android/src/cordova/plugins/Diagnostic.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':transformClassesWithDexForRelease'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzcdr;
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
i fixed the issue in onesignal-cordova-plugin
plugin, file /platforms/android/onesignal-cordova-plugin/app-build-extras-onesignal.gradle
had the versions mismatched, i changed it to 11.0.+
and it works.
def versionGroupAligns = [
// ### Google Play Services library
'com.google.android.gms': [
'version': '11.2.+'
],
// ### Google Firebase library
// Although not used by OneSignal Firebase has some dependencies on gms
// If present, ensuring they are aligned
'com.google.firebase': [
'version': '11.2.+'
],
@kodeine The Gradle build error you have posted:
- What went wrong: Execution failed for task ':transformClassesWithDexForRelease'. com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/internal/zzcdr;
is completely different from that of @rolinger:
- What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'. java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
The root cause of your issue is easily diagnosed by the Gradle error message: one or more plugins (including this one) in your project specifying different versions of the Android Support library, and can be resolved (as you've mentioned above) by aligning those versions.
However, the issue encountered by @rollinger is not the same and there is no clear Gradle error message that helps to diagnose/resolve the issue.
I installed this plugin first on a new build and like you said, it worked clean. Going through them all one at a time again to see which one was not compatible. Of note though, the above issue I had not yet installed cordova-android-support-gradle-release
- I made certain to install it first before anything else, then diagnostics, firebase, admobpro - alot of the big ones. Only real big one left is the facebook4 plugin - that one has routinely given me problems in the past. After that its going one by one to find what was conflicting with diagnostics.
@rolinger so the fix here is create a new project and install first cordova-android-support-gradle-release
and first everything else?
Can't we remove node_modules
and install again?
Clean and build fixed it for me
I'm submitting a ... (check one with "x"):
Bug report
**ionic cordova plugin add cordova.plugins.diagnostic
Saved plugin info for "cordova.plugins.diagnostic" to config.xml
Running app-scripts build: --platform android --target cordova [11:23:17] build dev started ... [11:23:17] clean started ... [11:23:17] clean finished in 6 ms [11:23:17] copy started ... [11:23:17] deeplinks started ... [11:23:17] deeplinks finished in 28 ms [11:23:17] transpile started ... [11:23:21] transpile finished in 3.38 s [11:23:21] preprocess started ... [11:23:21] preprocess finished in 2 ms [11:23:21] webpack started ... [11:23:21] copy finished in 3.60 s [11:23:27] webpack finished in 6.64 s [11:23:27] sass started ... Without
from
option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or toundefined
to prevent this warning. [11:23:28] sass finished in 865 ms [11:23:28] postprocess started ... [11:23:28] postprocess finished in 8 ms [11:23:28] lint started ... [11:23:28] build dev finished in 11.06 sANDROID_HOME=C:\Users\rolin\AppData\Local\Android\sdk JAVA_HOME=C:\Program Files\Java\jdk1.8.0_162 studio Subproject Path: CordovaLib Subproject Path: app [11:23:31] lint finished in 2.93 s publishNonDefault is deprecated and has no effect anymore. All variants are now published.
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_18po92nv5d2iid6iex8tezze4.run(C:\Users\rolin\dev\whipster_0.3.0\platforms\android\app\build.gradle:144) :CordovaLib:preBuild UP-TO-DATE :CordovaLib:preDebugBuild
UP-TO-DATE :CordovaLib:compileDebugAidl UP-TO-DATE :CordovaLib:compileDebugRenderscript
UP-TO-DATE :CordovaLib:checkDebugManifest UP-TO-DATE :CordovaLib:generateDebugBuildConfig UP-TO-DATE :CordovaLib:prepareLintJar UP-TO-DATE :CordovaLib:generateDebugResValues UP-TO-DATE :CordovaLib:generateDebugResources UP-TO-DATE :CordovaLib:packageDebugResources UP-TO-DATE :CordovaLib:platformAttrExtractor UP-TO-DATE :CordovaLib:processDebugManifest UP-TO-DATE :CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE :CordovaLib:javaPreCompileDebug UP-TO-DATE :CordovaLib:compileDebugJavaWithJavac
UP-TO-DATE :CordovaLib:processDebugJavaRes NO-SOURCE :CordovaLib:transformClassesAndResourcesWithPrepareIntermediateJarsForDebug UP-TO-DATE :app:preBuild UP-TO-DATE :app:preDebugBuild
Download https://maven.google.com/com/android/support/support-v4/maven-metadata.xml
Download https://maven.google.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.pom
Download https://maven.google.com/com/android/support/appcompat-v7/maven-metadata.xml Download https://maven.google.com/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom
Download https://maven.google.com/com/android/support/support-core-ui/26.1.0/support-core-ui-26.1.0.pom
Download https://maven.google.com/com/android/support/support-core-utils/26.1.0/support-core-utils-26.1.0.pom
Download https://maven.google.com/com/android/support/support-media-compat/26.1.0/support-media-compat-26.1.0.pom
Download https://maven.google.com/com/android/support/support-fragment/26.1.0/support-fragment-26.1.0.pom
Download https://maven.google.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.pom
Download https://maven.google.com/com/android/support/support-vector-drawable/26.1.0/support-vector-drawable-26.1.0.pom
Download https://maven.google.com/com/android/support/animated-vector-drawable/26.1.0/animated-vector-drawable-26.1.0.pom Download https://maven.google.com/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.pom
Download https://maven.google.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.pom
Download https://maven.google.com/android/arch/core/common/1.0.0/common-1.0.0.pom
Download https://maven.google.com/android/arch/lifecycle/common/1.0.0/common-1.0.0.pom Download https://maven.google.com/com/android/support/animated-vector-drawable/26.1.0/animated-vector-drawable-26.1.0.aar
Download https://maven.google.com/com/android/support/support-v4/26.1.0/support-v4-26.1.0.aar Download https://maven.google.com/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.aar
Download https://maven.google.com/com/android/support/support-vector-drawable/26.1.0/support-vector-drawable-26.1.0.aar
Download https://maven.google.com/com/android/support/support-fragment/26.1.0/support-fragment-26.1.0.aar Download https://maven.google.com/com/android/support/support-core-ui/26.1.0/support-core-ui-26.1.0.aar
Download https://maven.google.com/com/android/support/support-media-compat/26.1.0/support-media-compat-26.1.0.aar
Download https://maven.google.com/com/android/support/support-core-utils/26.1.0/support-core-utils-26.1.0.aar
Download https://maven.google.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar
Download https://maven.google.com/android/arch/lifecycle/runtime/1.0.0/runtime-1.0.0.aar :app:compileDebugAidl
:CordovaLib:packageDebugRenderscript
NO-SOURCE :app:compileDebugRenderscript UP-TO-DATE
:app:checkDebugManifest UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:prepareLintJar UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:generateDebugResources UP-TO-DATE :app:mergeDebugResources
:app:createDebugCompatibleScreenManifests UP-TO-DATE :app:processDebugManifest
:app:splitsDiscoveryTaskDebug UP-TO-DATE :app:processDebugResources
:app:generateDebugSources :app:javaPreCompileDebug
Download https://maven.google.com/com/android/support/support-annotations/26.1.0/support-annotations-26.1.0.jar Download https://maven.google.com/android/arch/core/common/1.0.0/common-1.0.0.jar
Download https://maven.google.com/android/arch/lifecycle/common/1.0.0/common-1.0.0.jar
:app:compileDebugJavaWithJavac 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.
:app:compileDebugNdk NO-SOURCE :app:compileDebugSources :CordovaLib:mergeDebugShaders UP-TO-DATE :CordovaLib:compileDebugShaders UP-TO-DATE :CordovaLib:generateDebugAssets UP-TO-DATE :CordovaLib:mergeDebugAssets UP-TO-DATE :app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE :app:generateDebugAssets UP-TO-DATE :app:mergeDebugAssets
:app:extractTryWithResourcesSupportJarDebug UP-TO-DATE :app:transformClassesWithStackFramesFixerForDebug
:app:transformClassesWithDesugarForDebug
:app:transformClassesWithDexBuilderForDebug
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
38 actionable tasks: 12 executed, 26 up-to-date FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
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 32s (node:5168) 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.
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
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 32s
**
After fresh plugin install,
ionic cordova build android
failsIt should have compiled without issue
Clean compile
Environment information
8.0.0
Android 7.0.0
com.lampa.startapp 0.1.4 "startApp" com.vliesaputra.deviceinformation 1.0.1 "DeviceInformation" cordova-instagram-plugin 0.5.5 "Instagram" cordova-plugin-admobpro 2.31.1 "AdMob Plugin Pro" cordova-plugin-appavailability 0.4.2 "AppAvailability" cordova-plugin-appinfo 2.1.2 "AppInfo Plugin" cordova-plugin-apprate 1.3.0 "AppRate" cordova-plugin-clipboard 1.0.0 "Clipboard" cordova-plugin-console 1.1.0 "Console" cordova-plugin-customurlscheme 4.3.0 "Custom URL scheme" cordova-plugin-device 2.0.1 "Device" cordova-plugin-device-motion 1.2.5 "Device Motion" cordova-plugin-device-orientation 1.0.7 "Device Orientation" cordova-plugin-dialogs 2.0.1 "Notification" cordova-plugin-email 1.2.6 "EmailComposer" cordova-plugin-extension 1.5.4 "Cordova Plugin Extension" cordova-plugin-fastrde-checkgps 1.0.0 "checkGPS" cordova-plugin-file 6.0.1 "File" cordova-plugin-geolocation 4.0.1 "Geolocation" cordova-plugin-globalization 1.0.9 "Globalization" cordova-plugin-inappbrowser 2.0.2 "InAppBrowser" cordova-plugin-ionic-keyboard 2.0.5 "cordova-plugin-ionic-keyboard" cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview" cordova-plugin-request-location-accuracy 2.2.2 "Request Location Accuracy" cordova-plugin-screensize 1.3.1 "screensize" cordova-plugin-sim 1.3.3 "SIM" cordova-plugin-splashscreen 5.0.2 "Splashscreen" cordova-plugin-statusbar 2.4.1 "StatusBar" cordova-plugin-vibration 3.0.1 "Vibration" cordova-plugin-whitelist 1.3.3 "Whitelist" cordova-sms-plugin 0.1.11 "Cordova SMS Plugin" cordova.plugins.diagnostic 3.9.2 "Diagnostic"
sw_vers
Windows 10 Pro
Runtime issue
Android build issue:
6/9/1
4.1
26
sdkmanager --list | sed -e '/Available Packages/q'
iOS build issue:
node -v
If using an [Ionic Native Typescript wrapper]() for this plugin:
3.19.1
npm list | FINDSTR "@ionic-native" +-- @ionic-native/core@4.4.0 +-- @ionic-native/splash-screen@4.4.0 +-- @ionic-native/status-bar@4.4.0
Related code:
Console output
console output
``` // Paste any relevant JS/native console output here ```**Other information:** # Feature request # Documentation issue