您的应用未使用 AndroidX - Flutter 不允许我生成 apk

rik*_*iki 6 android gradle dart flutter

我在 Mac 上使用 Visual Studio 代码开发了一个应用程序。我在 IOS 上运行该应用程序没有任何问题。我还在物理设备上安装了它,它运行良好,但我在生成 Android 项目研究及其 APK 时遇到了问题。

留言

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.
Run Code Online (Sandbox Code Playgroud)

God*_*win 8

在我自己的情况下,我的 gradle.properties 丢失了。我刚刚在 android 文件夹中创建了一个新的 gradle.properties 文件,参数如下

org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
Run Code Online (Sandbox Code Playgroud)


小智 4

这是因为您的项目缺少 gradle.prperties 文件 >> 在 android studio 或 vs code 中打开终端并写入“flutter create”。它将创建丢失的文件,其中之一是 gradle.properties。