Android Proguard build failed: Duplicated zip entry - android

I'm getting this error while assemble release:
Warning: Exception while processing task java.io.IOException: Can't write [/Users/tuanchauict/pw/Android/xrmovies/app/build/intermediates/transforms/proguard/prod/release/jars/3/1f/main.jar] (Can't read [/Users/tuanchauict/pw/Android/xrmovies/app/build/intermediates/classes/prod/release(;;;;;;**.class)] (Duplicate zip entry [android/support/v7/a/a$a.class == android/support/v7/appcompat/R$attr.class]))
:app:transformClassesAndResourcesWithProguardForProdRelease FAILED
This is the stacktrace:
Caused by: java.io.IOException: Can't write [/Users/tuanchauict/pw/Android/xrmovies/app/build/intermediates/transforms/proguard/prod/release/jars/3/1f/main.jar] (Can't read [/Users/tuanchauict/pw/Android/xrmovies/app/build/intermediates/classes/prod/release(;;;;;;**.class)] (Duplicate zip entry [android/support/v7/a/a$a.class == android/support/v7/appcompat/R$attr.class]))
at proguard.OutputWriter.writeOutput(OutputWriter.java:187)
at proguard.OutputWriter.execute(OutputWriter.java:79)
at proguard.ProGuard.writeOutput(ProGuard.java:427)
at proguard.ProGuard.execute(ProGuard.java:175)
at com.android.build.gradle.internal.transforms.BaseProguardAction.runProguard(BaseProguardAction.java:54)
at com.android.build.gradle.internal.transforms.ProGuardTransform.doMinification(ProGuardTransform.java:254)
at com.android.build.gradle.internal.transforms.ProGuardTransform.access$000(ProGuardTransform.java:63)
at com.android.build.gradle.internal.transforms.ProGuardTransform$1.run(ProGuardTransform.java:173)
at com.android.builder.tasks.Job.runTask(Job.java:49)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:223)
Caused by: java.io.IOException: Can't read [/Users/tuanchauict/pw/Android/xrmovies/app/build/intermediates/classes/prod/release(;;;;;;**.class)] (Duplicate zip entry [android/support/v7/a/a$a.class == android/support/v7/appcompat/R$attr.class])
at proguard.InputReader.readInput(InputReader.java:188)
at proguard.InputReader.readInput(InputReader.java:158)
at proguard.OutputWriter.writeOutput(OutputWriter.java:176)
... 10 more
Caused by: java.io.IOException: Duplicate zip entry [android/support/v7/a/a$a.class == android/support/v7/appcompat/R$attr.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:74)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:74)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:74)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:74)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:74)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:184)
... 12 more
BUILD FAILED
I have searched around but no solution this case.
My dependencies:
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.android.support:support-v4:25.1.0'
compile 'com.android.support:recyclerview-v7:25.1.0'
compile 'com.android.support:cardview-v7:25.1.0'
compile 'com.android.support:design:25.1.0'
compile 'com.google.android.gms:play-services-ads:10.0.1'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-crash:10.0.1'

(Posted on behalf of the OP).
I have figured out where the problem came from. I use a 3rd party library that somehow it included the R class from support library. Remove it out and the build works.

Related

Firebase compatibility errors

I have a problem that I always had, and tried to understand it, but never succesfully. The compatibility between firebase implementations. I take the repositories from https://mvnrepository.com/artifact/com.google.firebase , but it doesn't help me. I event put apply plugin: 'com.google.gms.google-services' at the end of build.gradle, such in dependecies.
My implementations are:
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
It works very well without last one (storage) but I needed that, and when I put it there, i get some errors. If someone can explain why it works well with some versions, and with some not, I would apreciate that.
The error i get is:
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/firebase/FirebaseApp$IdTokenListenersCountChangedListener;
at com.google.firebase.auth.zzp.create(Unknown Source:3)
at com.google.firebase.components.ComponentRuntime.lambda$new$0(com.google.firebase:firebase-common##17.0.0:66)
at com.google.firebase.components.ComponentRuntime$$Lambda$1.get(Unknown Source:4)
at com.google.firebase.components.Lazy.get(com.google.firebase:firebase-common##17.0.0:53)
at com.google.firebase.components.ComponentRuntime.initializeEagerComponents(com.google.firebase:firebase-common##17.0.0:155)
at com.google.firebase.FirebaseApp.initializeAllApis(com.google.firebase:firebase-common##17.0.0:642)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##17.0.0:358)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##17.0.0:321)
at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common##17.0.0:305)
at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common##17.0.0:53)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1917)
at android.content.ContentProvider.attachInfo(ContentProvider.java:1892)
at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common##17.0.0:47)
at android.app.ActivityThread.installProvider(ActivityThread.java:6391)
at android.app.ActivityThread.installContentProviders(ActivityThread.java:5938)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5853)
at android.app.ActivityThread.access$1100(ActivityThread.java:199)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1650)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6669)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.FirebaseApp$IdTokenListenersCountChangedListener" on path: DexPathList[[zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/base.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_dependencies_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_resources_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_0_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_1_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_2_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_3_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_4_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_5_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_6_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_7_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_8_apk.apk", zip file "/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.ainkiwi.taskme-gQJ3Y9hPNu2sUu1YIJxWBA==/lib/x86, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134).... and so on.
Upgrade the following dependencies into this:
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-firestore:19.0.0'
implementation 'com.google.firebase:firebase-storage:17.0.0'
Check the list of dependencies here:
https://firebase.google.com/support/release-notes/android#latest_sdk_versions

KaptContext cannot access Context

I want to integrate fastlane into my project. I have set up all the basic stuff and now I want to deploy my project to beta release. I run fastlane android beta and get below error.
If I compile with Android Studio 3.1 everything works fine.
:app:kaptGenerateStubsReleaseKotline: java.lang.IllegalAccessError: class org.jetbrains.kotlin.kapt3.KaptContext (in unnamed module #0x253fbddb) cannot access class com.sun.tools.javac.util.Context (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.util to unnamed module #0x253fbddb
at org.jetbrains.kotlin.kapt3.KaptContext.<init>(KaptContext.kt:47)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.compileStubs(Kapt3Extension.kt:265)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.generateStubs(Kapt3Extension.kt:215)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:178)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:93)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:97)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:107)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:84)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:374)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:64)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:101)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:365)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:130)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:161)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:63)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:108)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:52)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:451)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:97)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:218)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.access$compileIncrementally(IncrementalCompilerRunner.kt:37)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner$compile$2.invoke(IncrementalCompilerRunner.kt:80)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.execIncrementalCompiler(CompileServiceImpl.kt:527)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.access$execIncrementalCompiler(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:408)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:909)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:97)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:939)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:908)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:407)
at sun.reflect.NativeMethodAccessorImpl.invoke0(java.base#9-internal/Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(java.base#9-internal/NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base#9-internal/DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(java.base#9-internal/Method.java:531)
at sun.rmi.server.UnicastServerRef.dispatch(java.rmi#9-internal/UnicastServerRef.java:321)
at sun.rmi.transport.Transport$1.run(java.rmi#9-internal/Transport.java:200)
at sun.rmi.transport.Transport$1.run(java.rmi#9-internal/Transport.java:197)
at java.security.AccessController.doPrivileged(java.base#9-internal/Native Method)
at sun.rmi.transport.Transport.serviceCall(java.rmi#9-internal/Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(java.rmi#9-internal/TCPTransport.java:563)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(java.rmi#9-internal/TCPTransport.java:821)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(java.rmi#9-internal/TCPTransport.java:678)
at java.security.AccessController.doPrivileged(java.base#9-internal/Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(java.rmi#9-internal/TCPTransport.java:677)
at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base#9-internal/ThreadPoolExecutor.java:1158)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base#9-internal/ThreadPoolExecutor.java:632)
at java.lang.Thread.run(java.base#9-internal/Thread.java:804)
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:kaptGenerateStubsReleaseKotlin'.
> Internal compiler error. See log for more details
Gradle Dependencies
ext.kotlin_version = '1.2.31'
ext.daggerVersion = '2.7'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.google.dagger:dagger:$daggerVersion"
Any idea what might be wrong here?
when I have updated Gradle this nothing-saying error changed to proper one - the issue was that Google database Room dependency hadn't had proper cerificate and I needed to change openjdk9 to openjdk8 (I am using Ubuntu), then error disappeared

Duplicate class MultiDex$V14.class

My Android gradle build is failing during the ProGuard phase with a duplicate class error for MultiDex$V14.class (see below). I understand what a duplicate class is and I know what MultiDex is but I still don't understand how it's a duplicate.
Questions:
I see one definition is in multidex.jar, of course. How can I tell where the other is defined?
Isn't ProGuard supposed to remove duplicate entries instead of complaining about them?
The "What went wrong" description at the bottom seems unrelated to the duplicate class. Is it?
-
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: can't write resource [.gitkeep] (Duplicate zip entry [DMMPlaybackBitrateSwitching-1.0.jar:.gitkeep])
...
Warning: can't write resource [.gitkeep] (Duplicate zip entry [DMMDigitalMusicLocatorServiceClient-1.0.jar:.gitkeep])
Exception while processing task
java.io.IOException: Can't write [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/android-gradle/intermediates/classes-proguard/fourfireOS/debug/classes.jar] (Can't read [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/tmp/artifacts/multidex.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [multidex.jar:android/support/multidex/MultiDex$V14.class]))
at proguard.OutputWriter.writeOutput(OutputWriter.java:187)
at proguard.OutputWriter.execute(OutputWriter.java:79)
at proguard.ProGuard.writeOutput(ProGuard.java:427)
at proguard.ProGuard.execute(ProGuard.java:175)
at proguard.gradle.ProGuardTask.proguard(ProGuardTask.java:1074)
at com.android.build.gradle.tasks.AndroidProGuardTask.doMinification(AndroidProGuardTask.java:139)
at com.android.build.gradle.tasks.AndroidProGuardTask$1.run(AndroidProGuardTask.java:115)
at com.android.builder.tasks.Job.runTask(Job.java:48)
at com.android.build.gradle.tasks.SimpleWorkQueue$EmptyThreadContext.runTask(SimpleWorkQueue.java:41)
at com.android.builder.tasks.WorkQueue.run(WorkQueue.java:227)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.io.IOException: Cannot read [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/tmp/artifacts/multidex.jar(;;;;;;!META-INF/MANIFEST.MF)] (Duplicate zip entry [multidex.jar:android/support/multidex/MultiDex$V14.class])
at proguard.InputReader.readInput(InputReader.java:188)
at proguard.InputReader.readInput(InputReader.java:158)
at proguard.OutputWriter.writeOutput(OutputWriter.java:176)
... 10 more
Caused by: java.io.IOException: Duplicate zip entry [multidex.jar:android/support/multidex/MultiDex$V14.class]
at proguard.io.JarWriter.getOutputStream(JarWriter.java:138)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:105)
at proguard.io.FilteredDataEntryWriter.getOutputStream(FilteredDataEntryWriter.java:92)
at proguard.io.ClassRewriter.read(ClassRewriter.java:68)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.FilteredDataEntryReader.read(FilteredDataEntryReader.java:87)
at proguard.io.JarReader.read(JarReader.java:65)
at proguard.io.DirectoryPump.readFiles(DirectoryPump.java:65)
at proguard.io.DirectoryPump.pumpDataEntries(DirectoryPump.java:53)
at proguard.InputReader.readInput(InputReader.java:184)
... 12 more
:DigitalMusicAndroidAppOne:shrinkFourFireOSDebugMultiDexComponents FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':DigitalMusicAndroidAppOne:shrinkFourFireOSDebugMultiDexComponents'.
> java.io.IOException: Can't read [/Users/fruitman/dev/MusicAndroid-one/build/DigitalMusicAndroidAppOne/DigitalMusicAndroidAppOne-11.0/RHEL5_64/DEV.STD.PTHREAD/build/private/android-gradle/intermediates/classes-proguard/fourfireOS/debug/classes.jar] (Can't process class [com/company/communication/ir/ParcelableIRServiceEndpoint.class] (Unexpected end of ZLIB input stream))
* 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: 47.07 secs
BUILD FAILED
after two days ,i find the question ,in the lib..multidex 1.0.1,,but dependencies is 1.0.0,so just kill the lib,it's work now

Error Building Android App

I am getting a weird error when I am trying to build a app. I don't think it's related to my code and need some help in resolving it. When I press run, the logcat giving me this error:
Could not upload stats checkin to cyanogen server
javax.net.ssl.SSLHandshakeException: Connection closed by peer
at com.android.org.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:318)
at com.android.okhttp.Connection.upgradeToTls(Connection.java:201)
at com.android.okhttp.Connection.connect(Connection.java:155)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:276)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:211)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:382)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:106)
at com.android.okhttp.internal.http.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:217)
at com.android.okhttp.internal.http.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
at com.android.okhttp.internal.http.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:25)
at com.android.settings.cmstats.StatsUploadJobService.uploadToCyanogen(StatsUploadJobService.java:223)
at com.android.settings.cmstats.StatsUploadJobService.access$000(StatsUploadJobService.java:43)
at com.android.settings.cmstats.StatsUploadJobService$StatsUploadTask.doInBackground(StatsUploadJobService.java:121)
at com.android.settings.cmstats.StatsUploadJobService$StatsUploadTask.doInBackground(StatsUploadJobService.java:93)
at android.os.AsyncTask$2.call(AsyncTask.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
The gradle console then says:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
I am wondering if it to do with my phone's hardware or the cyanogenmod software running on it which causes the error.
Thank you for the help.
You hit the DEX 64k method limit.
There are few solutions which will help you to resolve this problem:
remove unused gradle dependencies
replace libaries with huge amount of methods with smaller ones, e.g.:
compile 'com.google.android.gms:play-services-analytics:8.4.0'
->
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-maps:8.4.0'
...
remove unused code by configuring the ProGuard
enable Multidex:
build.gradle
android {
...
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
...
android:name="android.support.multidex.MultiDexApplication">
...
</application>
</manifest>
Reference:
Building Apps with Over 65K Methods.
This line com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536 states that you are over the 64k method limit the Compiler has for every .dex file. Read up on it. Solutions include using Multidex or more solutions here https://www.contentful.com/blog/2014/10/30/android-and-the-dex-64k-methods-limit/. This maybe a duplicate of other issues. Look at
How to solve the issue with Dalvik compiler limitation on 64K methods?

Duplicate Zip entry Android after adding Sinch to the libs folder

/libs/sinch-android-verification-1.1.2.jar(;;;;;;!META-INF/**,!rootdoc.txt)] (Duplicate zip entry [sinch-android-verification-1.1.2.jar:com/sinch/verification/Config.class])
build.sbt
unmanagedJars in Compile += file("libs/sinch-android-verification-1.1.2.jar")
Caused by: java.io.IOException: Duplicate zip entry [sinch-android-verification-1.1.2.jar:com/sinch/verification/Config.class]
[error] (android:proguard) java.io.IOException: Can't write [/Users/******/target/android/intermediates/proguard/classes.proguard.jar] (Can't read [/Users/******/libs/sinch-android-verification-1.1.2.jar(;;;;;;!META-INF/**,!rootdoc.txt)] (Duplicate zip entry [sinch-android-verification-1.1.2.jar:com/sinch/verification/Config.class]))
The line specifying:
unmanagedJars in Compile
is superfluous and the cause of this error.

Categories

Resources