它给出了这样的错误时,试图使此文件的apk.
C:\flutter\bin\flutter.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:\Users\Alp\AndroidStudioProjects\InstaUI\android\build.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条答案
按热度按时间uajslkp61#
对于
first error
,即AndroidX must be enabled when Jetifier is enabled. To resolve, set android.useAndroidX=true in your gradle.properties file.
在
gradle.properties
文件中添加以下两行。对于
second error
,根据错误消息Could not get unknown property 'ndkVersion' for extension 'android' of type com.android.build.gradle.internal.dsl.BaseAppModuleExtension.
,您需要执行以下操作:导航到
android >> app >> build.gradle
,将您的flutter.ndkVersion
更改为最新的稳定版本,您可以查看最新的NDK稳定版本hereccrfmcuu2#
android/build.gradle
android/app/build.gradle-1
android/app/build.gradl-2