Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70434

Build Android - Multiple dex files define Lorg/apache/cordova/PermissionHelper;

$
0
0

@boang2000 wrote:

I tried to build my application to Android platform with QR scanner plugin to test it on a device but encountered this error, I already installed Android SDK, JDK.

BUILD FAILED in 1s
39 actionable tasks: 1 executed, 38 up-to-date
(node:18340) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
Dex: Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/PermissionHelper;
    UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/PermissionHelper;

com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/PermissionHelper;
        at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:661)
        at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:616)
        at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:598)
        at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
        at com.android.dx.merge.DexMerger.merge(DexMerger.java:198)
        at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:61)
        at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
        at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
        at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
        at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
        at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
        at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
> com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define Lorg/apache/cordova/PermissionHelper;

So I have tried removing and adding again the platforms including the NPM packages and dependencies, I might miss something here.

These are my plugin list:

cordova-plugin-compat 1.0.0 "Compat"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-inappbrowser 2.0.1 "InAppBrowser"
cordova-plugin-ionic-webview 1.1.11 "Ionic's WKWebView Engine"
cordova-plugin-qrscanner 2.5.0 "QRScanner"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"
ionic-plugin-keyboard 2.2.1 "Keyboard"

And I am using the Cordova 8.0.0 and Ionic 3.19.1.

Tried following these link but still not working, anyone encountered this issue?

Tried adding this in platforms/android/build.gradle:

android {
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 26
        multiDexEnabled true
    }
}

and encountered this error:

FAILURE: Build failed with an exception.

* Where:
Build file 'G:\projects\htdocs\staircraft-dev\staircraft\platforms\android\build.gradle' line: 56

* What went wrong:
A problem occurred evaluating root project 'android'.
>
Could not find method android() for arguments [build_1wqgehkb4d0me3f5qwdaxlppc$_run_closure3@628d8ac0, build_1wqgehkb4d0me3f5qwdaxlppc$_run_closure4@36355950] on root project 'android' of type org.gradle.api.Project.

Any help is appreciated.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70434

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>