Reputation: 1715
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.
Upvotes: 7
Views: 24373
Reputation: 98
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.
Upvotes: 4
Reputation: 3108
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
Upvotes: 3
Reputation: 638
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
Upvotes: 11
Reputation: 1314
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.
Upvotes: 2
Reputation: 52366
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'
Upvotes: 2
Reputation: 420
if you want an APK then use
flutter clean
flutter build apk
Upvotes: -2
Reputation: 91
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.
Upvotes: 4