How to resolve this error - android

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.

Related

Failed to resolve: com.google.firebase:firebase-core:17.0.0

In my android app's build file, I have given a wrong version of the library "com.google.firebase:firebase-core:17.0.0" for now the latest version is "com.google.firebase:firebase-core:16.0.4".
Later, I corrected the build file to use the correct version 'com.google.firebase:firebase-core:16.0.4'. Now while building the app, I am still getting the error.
Failed to resolve: com.google.firebase:firebase-core:17.0.0
I even tried to delete the dependency "com.google.firebase:firebase-core****" but still I am getting the error. Please help me to resolve.
Use same dependency for ads as used for the Core in your case (16.0.4).
Or follow this link for Further Instruction.
[https://firebase.google.com/docs/android/setup][1]
Also use implementation instead of api.

After upgrade Play Services to 15.0.0 having MergerException: Unable to merge dex while running

After upgrade Google Play Services to 15.0.0
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I have the same problem, just delete the .gradle file, and then clean your project from Build > Clean Project
you can find .gradle file in project view in the navigator on the top left
If you do not enabled Multidex follow this link: LINK
You should not include com.google.android.gms:play-services:... as a dependency. This adds ALL the Google Play Services APIs to your build and will probably require you to use MultiDex. Instead, follow the directions provided in the Setup Guid in the section titled Selectively compiling APIs into your executable to add as depencies only the specific APIs that you actually use.
But if you feel to use it, you can simple do the following:
Enable Multidex through build.gradle of your app module
multiDexEnabled true
Not Fix my problem. :(
Try this :
From the Build menu -> press the Clean Project button.
When task completed, press the Rebuild Project button from the Build menu.
compile is now deprecated if you are still using it. Use implementation or api

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

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.

Fail demo:transformDexArchiveWithExternalLibsDexMergerForMockDebug with a DexArchiveMergerException

After a rebuild I get :
Error:Execution failed for task ':demo:transformDexArchiveWithExternalLibsDexMergerForMockDebug'.
> com.android.builder.dexing.DexArchiveMergerException: com.android.tools.r8.errors.CompilationError: Program type already present: com.google.android.gms.common.internal.zzag
What does that error message mean? What is wrong?
when I replaces gradle implementation instruction by (the older) compile , it works.
The suggested workaround for this error is to delete the ./gradle folder inside your project or delete all the build folders and the gradle cache.
Additional references:
Dex error On Android Studio 3.0 Beta4
Unable to merge dex
Delete the .gradle directory.
Run your app again.
Notes
The .gradle directory is in your project's root folder. (You may have to show hidden files first.)
I have to do this every time I update a dependency module using Android 3.0.
Hope this helps!
This error (and any other Program type already present: com.google.android.gms.common.internal.xxxxxx error) can be caused by different Play Services and Firebase versions. Make sure all implementation 'com.google.android.gms:xxxx:12.0.0 and all implementation 'com.google.firebase:xxxxxx:12.0.0' have the same version (12.0.0) in this example.

Unable to Build the project after gradle :2.1.0

I was trying to implement google gcm in my app.For that, I require google play services to be added.All setup has made as required.But while building getting error like this:
Error:Execution failed for task ':app:clean'.
Unable to delete directory: /media/Development/Projects/Source/MyApp/app/build/intermediates/exploded-aar/AARPNow/oplytic_sdk-1.0/unspecified/jars
If I remove that oplytic_sdk-1.0 library and then same error will pointing to other dependencies.
Does anybody know whats wrong with my gradle?

Categories

Resources