It gives such an error when trying to make this file apk.
C:flutterbinflutter.bat --no-color build apk
Building without sound null safety
[!] 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 'assembleRelease'...
FAILURE: Build failed with an exception.
* Where:
Build file 'C:UsersAlpAndroidStudioProjectsInstaUIandroidbuild.gradle' line: 24
* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Failed to notify project evaluation listener.
> AndroidX must be enabled when Jetifier is enabled. To resolve, set android.useAndroidX=true in your gradle.properties file.
> Could not get unknown property 'ndkVersion' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
* 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.
BU�LD FAILED in 6s
Running Gradle task 'assembleRelease'... 7,1s
Gradle task assembleRelease failed with exit code 1
Process finished with exit code 1
2
Answers
For your
first error
which isAndroidX must be enabled when Jetifier is enabled. To resolve, set android.useAndroidX=true in your gradle.properties file.
Add following two lines in
gradle.properties
file.For your
second error
, based on your error messageCould not get unknown property 'ndkVersion' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
you need to do the following:Navigate to
android >> app >> build.gradle
and change yourflutter.ndkVersion
to the latest stable version. You can check the latest NDK stable version hereandroid/build.gradle
android/app/build.gradle-1
android/app/build.gradl-2