Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Build failed with cordova android 7.0.0 and phonegap-plugin-barcodescanner 7.0.2 #614

Closed
water1st opened this issue Feb 27, 2018 · 2 comments

Comments

@water1st
Copy link

water1st commented Feb 27, 2018

Expected Behaviour

Build should succeed.

Actual Behaviour

Build fails with error

BUILD FAILED in 4s
 UP-TO-DATE
:app:transformClassesWithDesugarForDebug UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
38 actionable tasks: 1 executed, 37 up-to-date
(node:15032) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
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 4s

Reproduce Scenario (including but not limited to)

ionic start BarCodeTest tutorial
cd BarCodeTest
ionic cordova platform add android
ionic cordova platform add browser
ionic cordova plugin add cordova-plugin-advanced-http
ionic cordova plugin add cordova-plugin-camera
ionic cordova plugin add cordova-plugin-file
ionic cordova plugin add cordova-sqlite-storage
ionic cordova plugin add cordova-plugin-globalization
ionic cordova plugin add phonegap-plugin-barcodescanner
ionic cordova build android (this fails)

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Android 7.0

(Android) What device vendor (e.g. Samsung, HTC, Sony...)

MI4C

Cordova CLI version and cordova platform version

ionic version: 3.19.1

cordova version : 8.0.0

Installed platforms:
android 7.0.0
browser 5.0.3
Available platforms:
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0

cordova plugins:
cordova-plugin-advanced-http 1.9.1 "Advanced HTTP plugin"
cordova-plugin-camera 4.0.2 "Camera"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 6.0.1 "File"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-sqlite-storage 2.2.0 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"

Plugin version

phonegap-plugin-barcodescanner 7.0.2

Sample Code that illustrates the problem

Logs taken while reproducing problem

PS D:\Source\vTruckMobile> ionic cordova run android
Running app-scripts build: --platform android --target cordova
[17:04:24]  build dev started ...
[17:04:25]  clean started ...
[17:04:25]  clean finished in 9 ms
[17:04:25]  copy started ...
[17:04:25]  deeplinks started ...
[17:04:25]  deeplinks finished in 463 ms
[17:04:25]  transpile started ...
[17:04:34]  transpile finished in 8.13 s
[17:04:34]  preprocess started ...
[17:04:34]  preprocess finished in 1 ms
[17:04:34]  webpack started ...
[17:04:34]  copy finished in 9.31 s
[17:04:50]  webpack finished in 16.43 s
[17:04:50]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[17:04:53]  sass finished in 2.65 s
[17:04:53]  postprocess started ...
[17:04:53]  postprocess finished in 16 ms
[17:04:53]  lint started ...
[17:04:53]  build dev finished in 28.20 s
> cordova run android
Android Studio project detected

ANDROID_HOME=C:\Users\Administrator\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_152
studio
Subproject Path: CordovaLib
Subproject Path: app
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_5rtws4i9ch9vvb63xzhb5ccp8.run(D:\Source\vTruckMobile\platforms\android\app\build.gradle:144)
[17:05:02]  lint finished in 8.96 s
: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 UP-TO-DATE
:app:compileDebugAidl UP-TO-DATE
: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 UP-TO-DATE
:app:createDebugCompatibleScreenManifests UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:splitsDiscoveryTaskDebug UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:javaPreCompileDebug UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk NO-SOURCE
:app:compileDebugSources UP-TO-DATE
: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 UP-TO-DATE
:app:extractTryWithResourcesSupportJarDebug UP-TO-DATE
:app:transformClassesWithStackFramesFixerForDebug

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 4s
 UP-TO-DATE
:app:transformClassesWithDesugarForDebug UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
38 actionable tasks: 1 executed, 37 up-to-date
(node:15032) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
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 4s
@water1st
Copy link
Author

water1st commented Feb 28, 2018

ionic cordova platform rm android
ionic cordova platform add android

build sussessful by just reinstall the android platform

@lock
Copy link

lock bot commented Jun 7, 2018

This thread has been automatically locked.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant