Multiple dex files define Lcom/google/android/gms/internal/measurement/zzabn - android

Since this morning I cannot build my Android app because I get this error
What went wrong: Execution failed for task ':app:transformDexArchiveWithDexMergerForDebug'.
com.android.build.api.transform.TransformException: com.android.dex.DexException: Multiple dex files define
Lcom/google/android/gms/internal/measurement/zzabn;
I have tried bumping the Firebase versions accordingly to 15.0.2 but then I get an other error...
Task :app:processDebugGoogleServices Found com.google.android.gms:play-services-maps:15.0.0, but version 15.0.2
is needed for the google-services plugin.
com.google.android.gms:play-services-maps:15.0.2 is not even released yet?
I have a build to push to production, what is the best way to build the app?

Please update the google-service plugin to:
classpath 'com.google.gms:google-services:3.3.0'
to be able to use the latest version of Firebase and to avoid the errors.
Read the following for more information:
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Compilation failed to complete:Program type already present: com.google.android.gms.internal.measurement.zzabn

(Posted solution on behalf of the question author).
Removing com.google.gms.google-services at the bottom of my build.build makes it work.

Related

AppDistribution Gradle plugin with Gradle 7

I am using Android Gradle Plugin version 7.0.0-alpha14 and Gradle version 7.0 and when I try to upload the app to app distribution through the Gradle plugin version 2.1.0 it fails on a task app:appDistributionUploadDebug with an error
> Task :app:appDistributionUploadDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Some problems were found with the configuration of task ':app:appDistributionUploadDebug' (type 'UploadDistributionTask').
- Type 'UploadDistributionTask' property 'COMMAND_LINE_PREFIX' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as #Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
- Type 'UploadDistributionTask' property 'appDistributionProperties' is missing an input or output annotation.
Reason: A property without annotation isn't considered during up-to-date checking.
Possible solutions:
1. Add an input or output annotation.
2. Mark it as #Internal.
Please refer to https://docs.gradle.org/7.0/userguide/validation_problems.html#missing_annotation for more details about this problem.
I suppose the plugin is not compatible with Gradle 7 but is it a known issue and is there some workaround? Thanks
New version of plugin 2.1.1 was released that fixes this issue.
classpath 'com.google.firebase:firebase-appdistribution-gradle:2.1.1'
Goto project's build.gradle file
Add below line into dependencies block :-
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18'

How to resolve this error

The error :
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
You are implementing the whole play-services package. Try to filter out the dependencies you want to use. For example if you need location api then only compile 'com.google.android.gms:play-services-location:11.8.0'. Try commenting out this line 'com.google.android.gms:play-services:11.6.2'.
As your .gradle file suggests, you are explicitly adding the play services in your project and you are also adding firebase DB and appcompat library which is using a different version of the play services. Try to get the version which uses the same play services version.
If you do not know how to do it you can refer to the following command
./gradlew app:dependencies
If you want an in-depth answer please refer to this awesome thread full of the information.
Following is the good article on the conflict of Gradle dependencies.

Multiple Dex File build error following NS 2.5 Upgrade

Following the upgrade to Nativescript 2.5 I'm receiving a build error that I'm not quite sure how to fix. The error is:
Execution failed for task ':transformClassesWithDexForF0F1F2F3F4F5F6Debug'.
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/iid/MessengerCompat$1;
I've spent some time looking into the issue and a Multiple Dex file exception seems to normally mean that two different versions of a dependency are being referenced. Yet I can't seem to find anything which relates to > MessengerCompat in the gradle files of any of my dependencies.
Thanks for any help!
For your case you could try to remove node_modules, platforms and hooks folders from your project and to clear npm cache with npm cache clear.
Then try to rebuild the app with tns run android.
It would also help if you could share the package.json file of the project.

IO Exception When Generating Signed APK

I am trying to create signed APK an android,however I am getting IOException..
Exception is shown below..
Warning:io.realm.processor.RealmProcessor: can't find referenced class javax.lang.model.element.Element
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
:app:transformClassesAndResourcesWithProguardForRelease FAILED
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> java.io.IOException: Please correct the above warnings first.
I am also facing this warnings.but finally adding (-ignorewarnings) using progaurd-rules.pro file from my applications.
this problem is resolved.
This bug happens when the versions of SDK, Build Tools and Gradle Plugins doesn't match (in terms of compatibility). The solutions is to verify if you are using the latest versions of them. The gradle plugins are placed in the build.gradle file of the project. Other versions are in the build.gradle file of the module. For example, for SDK 23, you must use the Build Tools 23.0.1 and gradle plugins version 1.3.1.
OR
include this in your Proguard config:
-dontwarn javax.lang.model.**

TransformException after updating gradle version

Am using the following library Autobahn for web sockets usage in my Android project.
When am using the old gradle version 1.3.0, am not encountering any issues in building & running the app, whereas
when i update the gradle version to 1.5.0, am encountering the following issue.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: de/tavendo/autobahn/ByteBufferInputStream.class
I have tried the below options already
1. multiDexEnabled is set to true in gradle file.
2. gradlew clean is also done, along with clean build.
Any other suggestions to resolve this issue would be great.
Regards,
Dinesh Kumar G
Here is a interesting way to add Autoban build to gradle. Try to remove your jar and add this in your build file.

Categories

Resources