The issue I was facing was to build and run my application and terminal saying 'Your project is doesn't support AndroidX'.
Solution: https://flutter.dev/docs/development/androidx-migration
So I went to the given link and tried to implement it by the help of Android Studio, but it always leads to No usage found.
So I went back to the link and tried the other approach of editing the gradle.properties in android level (android/gradle) and add these properties:
android.useAndroidX=true
android.enableJetifier=true
Related
I just updated Android studio 3.6.1 and while building my app I got following warning:
Configure project :app
WARNING: The following project options are deprecated and have been removed:
android.enableUnitTestBinaryResources
The raw resource for unit test functionality is removed.
What is this warning about and how to remove this?
The robolectric instructions say that this configuration is not necessary with Android Studio 3.3+
So, please check your gradle.properties file and remove this line:
android.enableUnitTestBinaryResources=true
In my case, I just cleared my gradle cache files and that seemed to have resolved the problem
My problem solved by removing configuration at gradle.properties. see below:
#android.enableBuildCache=true
I developed an app in flutter with Visual Studio code on Mac. I ran the application without any kind of problem on IOS. I also installed it on a physical device and it works perfectly, but I have a problem generating the Android project study and its APK on with flutter.
Message:
flutter build appbundle
[!] Your app isn't using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the
steps on ...
Running Gradle task 'bundleRelease'...
Note: Some input files use unchecked or unsafe operations.
Running Gradle task 'bundleRelease'... Note: Recompile with -Xlint:unchecked for details.
Running Gradle task 'bundleRelease'...
Running Gradle task 'bundleRelease'... Done 217,9s (!)
Gradle build failed to produce an .aab file. It's likely that this file was generated under
/Users/riccardo/Desktop/QuoteFlutter/quote/build, but the tool couldn't find it.
in my own case my gradle.properties was missing. I Just created a new gradle.properties file inside the android folder, with the below parameter
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
you should go to
YourAppName=> android => gradle.properties
inside gradle.properties add these two lines
android.useAndroidX=true
android.enableJetifier=true
dat should solve it.
The error description clearly states that
Your app isn't using AndroidX.
To avoid potential build failures, you can quickly migrate your app by following the
steps on ...
How to resolve this?
Follow this detailed documentation.
this because your project is missing gradle.prperties file >> open terminal in android studio or vs code and write "flutter create ." it will create missing file one of them is gradle.properties.
I had an old project using Firestore, that I was trying to open, and got this message. I could not find any easy way to fix it.
These were the steps I took to migrate it, hope it helps someone.
Create a new folder.
Then run this command in Terminal, in the folder:
flutter create --org com.yourdomain your_app_name
Copy the files from lib folder, (and any other modifications from android or ios folders).
Copy google-services.json to android\app folder.
Modify pubspec.yaml and copy the dependencies under dependencies:
Change android\app\build.gradle change version to:
minSdkVersion 21
Add the plugins needed in android\app\build.gradle:
apply plugin: 'com.google.gms.google-services'
In Android\build.gradle file:
Add the dependency (with your version):
classpath 'com.google.gms:google-services:4.3.3'
You need to convert your project to AndroidX. Execute the following command:
flutter create --androidx -t <project-type> <new-project-path>
Project types can be app, package or plugin
More information here.
Note: This Problem can also come while building an app downloaded from github, in VSCode with Flutter.
its August 2021
Answer:
if you are not using android studio as i am using vscode.
add below lines to flutter_app_path/android/gradle.properties.
android.useAndroidX=true
android.enableJetifier=true
Google introduced android jetpack(another topic) in which AndroidX package name and namespace default for jetpack libraries and minimum support library 28 required what i guess now flutter team wants to migrate flutter support to android jetpack near future. come to point now migrating to androidx make sure your project has support library 28
add below lines to flutter_app_path/android/app/build.gradle.
android {
compileSdkVersion 28
// other lines of code
}
Optional Story
i had same issue when i cloned my old flutter repo
if you have cloned flutter legacy app repo from github and your development flutter SDK version is 2.2.x first you need to migrate your app to NULL Safety after you should migrate to androidx follow my Answer
if you want an APK then use
flutter clean
flutter build apk
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 am trying to redirect my users to an email client so they can send an attachement i have created within my app.
However on adding flutter_email_sender to my pubspec.yaml my app no longer compiles.
I am getting the following error:
I have tried adding the line to my AndroidManifest with no success.
"The prefix 'tools' for at tribute 'tools:replace' associated with an element type 'application' is not bound"
The documentation says i should have compileSdkVersion 28 which i have.
How do i resolve this error?
You need to migrate to androidx. Which means you need to update all packages that you added in your pubspec.yaml to ensure that they are compatible with androidx. So make sure that all your packages are up to date, then open the android project of your flutter app with android studio. Go to Refactor-> Migrate to AndroidX. Then rebuild your project. And you will be fine.
Hope it helps!
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.