Dex: Error converting bytecode to dex: Cause: com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files UNEXPECTED TOP-LEVEL EXCEPTION:


#1

I have created blank template and try to build, i got an error.

D:\TestApk>ionic cordova build android
Running app-scripts build: --platform android --target cordova
[15:02:12] build dev started …
[15:02:12] clean started …
[15:02:12] clean finished in 10 ms
[15:02:12] copy started …
[15:02:13] deeplinks started …
[15:02:13] deeplinks finished in 29 ms
[15:02:13] transpile started …
[15:02:20] transpile finished in 7.37 s
[15:02:20] preprocess started …
[15:02:20] preprocess finished in 1 ms
[15:02:20] webpack started …
[15:02:20] copy finished in 7.64 s
[15:02:29] webpack finished in 8.70 s
[15:02:29] 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.
[15:02:31] sass finished in 1.99 s
[15:02:31] postprocess started …
[15:02:31] postprocess finished in 12 ms
[15:02:31] lint started …
[15:02:31] build dev finished in 18.40 s

cordova build android
Android Studio project detected

ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_172
studio
Subproject Path: CordovaLib
Subproject Path: app
[15:02:36] lint finished in 5.65 s
publishNonDefault is deprecated and has no effect anymore. All variants are now published.

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_3v47ecs8ujgsj5mxg1myhuh4k.run(D:\TestApk\platforms\android\app\build.gradle:143)
: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:transformClassesWithStackFramesFixerForDebug UP-TO-DATE
:app:transformClassesWithDesugarForDebug

UP-TO-DATE
:app:transformClassesWithDexBuilderForDebug UP-TO-DATE
:app:transformDexArchiveWithExternalLibsDexMergerForDebug

UP-TO-DATE
:app:transformDexArchiveWithDexMergerForDebug
Dex: Error converting bytecode to dex:
Cause: com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files
UNEXPECTED TOP-LEVEL EXCEPTION:
com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files

com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files
at com.google.common.base.Verify.verify(Verify.java:122)
at com.google.common.base.Verify.verifyNotNull(Verify.java:157)
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:62)
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:36)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)
FAILED
38 actionable tasks: 1 executed, 37 up-to-date
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.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files

  • 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:10412) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
Dex: Error converting bytecode to dex:
Cause: com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files
UNEXPECTED TOP-LEVEL EXCEPTION:
com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files

com.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files
at com.google.common.base.Verify.verify(Verify.java:122)
at com.google.common.base.Verify.verifyNotNull(Verify.java:157)
at com.android.builder.dexing.DexArchiveMergerCallable.call(DexArchiveMergerCallable.java:62)
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.google.common.base.VerifyException: Merged dex is null. We tried to merge 0 DEX files

  • 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
Picked up _JAVA_OPTIONS: -Xmx2g
at ChildProcess.whenDone (D:\TestApk\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:961:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
(node:10412) 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:10412) [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.

D:\TestApk>


#2

Any luck?
in finding this solution?