- Home /
Gradle Build error : Could not resolve all files for configuration ':releaseCompileClasspath'.
Hey guys I recently updated my facebook SDK and due to merge conflicts when building the app caused by the extra libraries that had to be added to the project by the Play Services Resolver I had to edit my Gradle.properties file to look like below.
org.gradle.jvmargs=-Xmx4096M
android.useAndroidX=true
android.enableJetifier=true
I did this mainly cause some of the support libraries were the cause of the merge conflicts. But now I keep getting the following error and I do not know how to fix it. Any help will be appreciated. Thanks!
* What went wrong:
Execution failed for task ':preReleaseBuild'.
> Could not resolve all files for configuration ':releaseCompileClasspath'.
> Failed to transform artifact 'com.android.support.support-v4-27.0.2.aar (:com.android.support.support-v4-27.0.2:)' to match attributes {artifactType=android-manifest}
> Execution failed for JetifyTransform: D:\Unity\Projects\Mzito-NewBG\2017.3\Mzito - Unity 2018.1.2f1 - GameTrove\Mzito\Temp\gradleOut\libs\com.android.support.support-v4-27.0.2.aar.
> Failed to transform 'D:\Unity\Projects\Mzito-NewBG\2017.3\Mzito - Unity 2018.1.2f1 - GameTrove\Mzito\Temp\gradleOut\libs\com.android.support.support-v4-27.0.2.aar' using Jetifier. Reason: The given artifact contains a string literal with a package reference 'android.support.v4' that cannot be safely rewritten. Libraries using reflection such as annotation processors need to be updated manually to add support for androidx.. (Run with --stacktrace for more details.)
Hi there! I'm having the same error since adding firebase to my Unity 2019.3.14f1 project. Just wondering if you found a solution? Thanks, Fin.
Hello Fin! Did you find any solution? I have the exact same problem (adding Firebase) and use the same Unity version.
Hi Natasha! I did manage to solve the issue! If I remember correctly for me the issue was caused by a conflict with the $$anonymous$$apbox SDK including an older version of the Google support library... I'll double-check this tomorrow and post some more info!
Answer by justFin · Oct 16, 2020 at 07:50 PM
For me, this issue was caused by having the Mapbox SDK versions of some libraries clashing with new Android X libraries. I was able to solve this by manually "Jetifying" two files:
Mapbox/Core/Plugins/Android/mapbox-android-telemetry-2-1-0.aar
Mapbox/Unity/Location/Plugins/Android/com.mapbox.android.unity-debug.aar.
This is further explained in this post: https://github.com/mapbox/mapbox-unity-sdk/issues/1438
I also had to entirely remove/delete the following files from Mapbox\Core\Plugins\Android:
appcompat-v7-25.1.0.aar
com.mapbox.android.unity-debug.aar
libtelemetry-full-release.aar
MapboxDependencies.xml
support-compat-25.1.0.aar
support-core-ui-25.1.0.aar
support-core-utils-25.1.0.aar
support-v4-25.1.0.aar
Here are some other posts that helped my find a solution: https://github.com/mapbox/mapbox-unity-sdk/issues/646, https://stackoverflow.com/questions/62375030/unity-android-cant-build-firebase-and-mapbox-project
I hope this helps @Natasha_P, and anyone else who might experience this same issue!
Thank you so much @justFin ! It worked like a charm! Deleting the .aar files did the job and the android app was able to link to Firebase without problems caused by duplicate classes and conficting SDKs :)