I try to clone my teammate project, i did yarn install and run android but when the process is done, i found an error said:
A problem occurred evaluating project ':#mauron85_react-native-background-geolocation-common'
Other explanation are:
Failed to apply plugin [id 'com.android.internal.library']
The option 'android.enableUnitTestBinaryResources' is deprecated.
The current default is 'false'.
It has been removed from the current version of the Android Gradle plugin.
The raw resource for unit test functionality is removed.
We still want to use this dependecy because it requires on our project, my React Native version is 0.61.5
is there any solution regarding this problem?
Add the following line in gradle.properties in android folder.
android.enableUnitTestBinaryResources=false
i am working on a react native android project but i am stuck on this error
> Task :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
D8: Program type already present: androidx.versionedparcelable.NonParcelField
FAILURE: Build failed with an exception.
i have tried to change multi dex to false in build.gradle
defaultconfig {...
multiDexEnabled false
...}
i dont want to migrate to androidx , i just want to get rid of androidx & this error ;
please help me , thanks in advance
Based on my research couldn't not find an easy way or should I say a correct way to draw back from androidx, to solve the above issue just add the following to your gradle.properties
android.useAndroidX=true
android.enableJetifier=true
That might cause another issue like
Execution failed for task
':react-native-navigation:compileReactNative57_5DebugJavaWithJavac'
the reason of this error, if it occured, after migrating your android project to androidx, many of your react-native libraries ship native Java code and have not been updated, updating it manually is tedious, I was able to do so by using this library jetifier simply by running
npm i --save-dev jetifier
npx jetify
In my case there were still some libraries causing some issues such us react-native-fast-image, as a workaround, I created a gradle.properties inside /node_modules/react-native-fast-image/android and deactivated AndroidX and Jetifier for this module:
android.useAndroidX=false
android.enableJetifier=false
The answer that Ahmed posted is a great solution once you've migrated to AndroidX. In my case I found out that only one library in my application was using AndroidX from this thread
In short my solution was to simply yarn upgrade react-native-device-info#latest The app build as expected after rebuilding it
Please follow the following steps:
Open Android Studio
Click on Refactor on the top menu bar
Click on Migrate too AppCompat
I hope this shall help you
I ran into a similar problem: I'm updating an app for RN 0.60.0. In my case, I had a dependency in build.gradle with a '+' in its version, and that particular dependency got updated, which broke my build.
In my case, explicitly specifying the version number resolved my problem.
./gradlew app:dependencies will show a tree of your dependencies; this might point you in the right direction as well.
I just import webview_flutter plugin and found that the plugin has incompatible with my flutter environment. Then using Android Studio I migrate my AndroidX environment with "Migrate to AndroidX" option.
I want to use webview_flutter plugin for viewing the page. Help appreciated.
Here is the error message
Launching lib/main.dart on Andromax B26D2H in debug mode...
D8: Program type already present: android.support.v4.media.MediaBrowserCompat$ItemCallback
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/22.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/105.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/148.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/133.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/72.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/128.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/79.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/88.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/110.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/67.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/120.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/91.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/102.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/6.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/118.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/5.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/52.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/58.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/43.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/127.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/142.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/151.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/19.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/34.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/46.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/63.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/107.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/9.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/31.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/15.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/115.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/70.jar, /Users/tio/Documents/Development/firecek_2019/build/app/intermediates/transforms/dexBuilder/debug/62.jar,
Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: android.support.v4.media.MediaBrowserCompat$ItemCallback
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 4m 59s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://flutter.dev/docs/development/packages-and-plugins/androidx-compatibility for more information on the problem and how to fix it.
Gradle task assembleDebug failed with exit code 1
Exited (sigterm)
Thanks for your suggestion,
I've fixed it by doing these steps :
1. Try adding this line In your Project folder > android > app > build.gradle, add the following Line in
multiDexEnabled true
inside defaultConfig
Then upgrade gradle dependency in the android/build.gradle file: classpath 'com.android.tools.build:gradle:3.3.1' (previously on version 3.2.1)
Run flutter clean and rebuild your project
First make sure that all your packages in the pubspec.yaml are of the latest version. Then open the android project of your flutter app with android studio, select Refactor->Migrate to Androidx(make sure that you are doing that that from the android project and not from the flutter one). Wait until android studio finishes migrating your project, rebuild your project. Hope it helps!
I found this solution on Github by #tiklupxgit, solved this issue quickly.
Update this line in [Project Directory]/android/build.gradle
classpath 'com.android.tools.build:gradle:3.5.4'
Now run these commands in your terminal under [Project Directory]
flutter clean && flutter pub get
Finally, build your project again.
It seems like you are facing issues with dex and androidX.
Follow https://stackoverflow.com/a/56490440/9236994
this answer to resolve your issue.
Create a new flutter project and move existing code to it: flutter migration
flutter create --androidx -t <project-type> <new-project-path>
eg: flutter create --androidx -t app .
I have tried the best ever possible ways to break it down. I have been trying to use youtube videos from URL using the youtube video flutter plugin and getting androidx incompatibilities plugin error. Finally, I found the result. Just update
the build.Gradle file in android - classpath
'com.android.tools.build:gradle:4.1.0'
gradle-wrapper.properties
distributionUrl=https://services.Gradle.org/distributions/gradle-6.7-all.zip
update the value as above it will work perfect, as for me.
For me, I copied settings.gradle file
to the new file settings_aar.gradle
Then Removed the following code from settings_aar.gradle:
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
Ok I finally solved the problem thanks to #Navpreet Singh
In order to fix the problem of the default grey icon of Firebase FCM (on Xiaomi devices) I added in the Manifest:
From then on, I got this error when building the application:
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Completed 20,2s
The build failed probably because of AndroidX incompatibilities in a plugin. The tool is about to
try to use Jetifier to resolve the incompatibility.
Building the cloud_firestore plugin...
Exception: The cloud_firestore plugin could not be built because of the above problem.
Running the Gradle task 'assembleAarRelease'...
When I commented out the metadata in the Manifest, the program started to compile again.
Just Enable multidex in app/build.gradle file.
defaultConfig {
....
multiDexEnabled true
}
dependencies {
.....
implementation 'com.android.support:multidex:2.0.1'
}
You just only run 'get packages' in your pubspec.yaml and the probles will be solve
you can solve this issue by following these step which is given in this link
https://medium.com/#sahaishashank2507/the-gradle-failure-may-have-been-because-of-androidx-incompatibilities-in-this-flutter-app-39b34acee40e?source=---------2------------------
You need to open your project in the android studio.
select Refactor->Migrate to Androidx(You need to migrate Android Project not
flutter one)
Android Studio finish some process you have to wait for it .
Than rebuild your project and it will work fine.
it can resolve your issue
I'm using Android Studio 3.2 Canary 14 and am trying to migrate an existing project to use AndroidX. It sounds from https://developer.android.com/topic/libraries/support-library/androidx-rn that I have to have set android.enableJetifier=true (this was done automatically for me when selecting "Refactor to AndroidX.." option). I've also updated target API level to 28. Anyone else seeing this issue?
Failed to transform
'/Users/jooreill/.gradle/caches/modules-2/files-2.1/com.google.firebase/firebase-perf/15.0.0/6e68f6e44b0c9d91756f903547ee3853349ae666/firebase-perf-15.0.0.aar' using Jetifier. Reason: null. (Run with --stacktrace for more
details.) To disable Jetifier, set android.enableJetifier=false in
your gradle.properties file.
The above error occurs when I run "Clean". In general am getting multiple errors like following if a do gradle sync:
Unable to resolve dependency for
':app-instant#debug/compileClasspath': Failed to transform file
'play-services-measurement-base-15.0.2.aar' to match attributes
{artifactType=jetified-aar} using transform JetifyTransform
For those experiencing the same issue with Android Studio 3.2 Canary 15 (or later) after using "Refactor to AndroidX...":
I had to update some dependencies manually, i.e. change
classpath 'io.fabric.tools:gradle:1.25.1'
to
classpath 'io.fabric.tools:gradle:1.27.0'
in my project's build.gradle file.
If you're using dagger you have to upgrade to version 2.20 or later.
This is because some libraries are not yet compatible with the AndroidX refactor as mentioned under Known issues in the AndroidX release notes.
I had been experiencing this problem while running assembleAndroidTest on Jenkins.
The weirdest part was that this task ran sans any issues on my mac's terminal without any issues, but failed on Jenkins with-
Failed to transform file 'cucumber-java-1.2.5.jar' to match attributes {artifactType=processed-jar} using transform JetifyTransform
Had been looking for solutions for a couple of days now, having worked though different suggestions - none of which worked.
Finally, disabling Jetifier in gradle.properties resolved it for me.
android.enableJetifier=false
I was able to work around a similar problem by excluding a certain library from being jetified, which can be done by adding to gradle.properties:
android.jetifier.blacklist = ...
Note that this option was added in Android Gradle plugin 3.3.0-rc01 as a temporary workaround.
See https://issuetracker.google.com/issues/119135578#comment5 for more details.
As per a statement on the AndroidX refactor made by a Google Engineer (Support Library) during the I/O session "What's New in Support Library?", Google already discovered bugs related to Jetifier in Android Studio 3.2 Canary 14.
Thus, it is advised to wait until Canary 15 (to be released the coming week) before starting the AndroidX migration process.
I had this same error after adding JDK 11 to my machine. It set itself as default JDK and this error started happening.
After setting JDK 8 as default, it was fixed.
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.