我更新了我的 Flutter SDK,我添加了 AndroidX,并且还应用了迁移步骤,我可以毫无问题地运行我的项目。但是当我尝试构建我的项目时,我收到以下错误。
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to reduce the APK size.
To generate an app bundle, run:
flutter build appbundle --target-platform android-arm,android-arm64,android-x64
Learn more on: https://developer.android.com/guide/app-bundle
To split the APKs per ABI, run:
flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
Learn more on: https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lintVitalRelease'.
> Could not resolve all artifacts for configuration ':app:debugRuntimeClasspath'.
> Failed to transform libs.jar to match attributes {artifactType=processed-jar, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\oeu\pr\Flutter\projectname\build\app\intermediates\flutter\debug\libs.jar.
> Transform's input file does not exist: C:\oeu\pr\Flutter\projectname\build\app\intermediates\flutter\debug\libs.jar. (See https://issuetracker.google.com/issues/158753935)
* 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.
* Get more help at https://help.gradle.org
BUILD FAILED in 2m 30s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 151,5s (!)
Gradle task assembleRelease failed with exit code 1
这是我的flutter doctor -v
[√] Flutter (Channel stable, 1.22.5, on Microsoft Windows [Version 10.0.18363.1256], locale tr-TR)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Android Studio (version 4.1.0)
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.51.1)
[√] Connected device (1 available)
答案 0 :(得分:1)
如果您更新 Dart SDK,请按照以下步骤构建 apk,
如果您的错误是 debug/libs.jar,则 build --debug
然后是 --release
。
如果您的错误是 profile/libs.jar,则 build --profile
然后是 --release
。
然后你可以运行 flutter build apk --relase
或 flutter build apk
强烈建议阅读此answer。
答案 1 :(得分:0)
从 flutter doctor
来看,您似乎缺少 Flutter 和 Dart 插件。它可能已被删除,或者位置意外更改。尝试重新安装相同的。会解决问题