skip to Main Content

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


  1. For your first error which is AndroidX 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.

    android.useAndroidX=true
    android.enableJetifier=true
    

    For your second error, based on your error message Could 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 your flutter.ndkVersion to the latest stable version. You can check the latest NDK stable version here

    enter image description here

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search