出于某種原因,突然間我的應用程式無法構建了。首先我遇到了 flutter devtools 問題,然后我升級到 Flutter 2.8.1,現在我的應用程式無法構建。我嘗試將 Gradle 升級到 7.3.3 和 JDK 17,但仍然無法構建我的應用程式,我搜索了整個 GitHub 和 StackOverflow,但找不到解決方案。
這是我的第一個錯誤:
* What went wrong:
Execution failed for task ':app:processDebugMainManifest'.
←[33m> ←[39mUnable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module @27ec650
我通過添加修復:
--add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED
到 gradle.properties。
但是現在當我嘗試構建時,我又遇到了另一個錯誤:
* What went wrong:
Execution failed for task ':app:lint'.
←[33m> ←[39mLint found errors in the project; aborting build.
Fix the issues identified by lint, or add the following to your build script to proceed with errors:
...
android {
lintOptions {
abortOnError false
}
}
...
Errors found:
...\android\app\src\main\AndroidManifest.xml:5: Error: Class referenced in the manifest, com.example.my_app.${applicationName}, was not found in the project or the libraries [MissingClass]
android:name="${applicationName}"
~~~~~~~~~~~~~~~~~~
這是我的 flutter doctor -v
[√] Flutter (Channel stable, 2.8.1, on Microsoft Windows [Version 10.0.22000.376], locale hr-HR)
? Flutter version 2.8.1 at C:\flutter
? Upstream repository https://github.com/flutter/flutter.git
? Framework revision 77d935af4d (12 days ago), 2021-12-16 08:37:33 -0800
? Engine revision 890a5fca2e
? Dart version 2.15.1
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
? Android SDK at C:\Users\domin\AppData\Local\Android\sdk
? Platform android-31, build-tools 31.0.0
? Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
? Java version OpenJDK Runtime Environment (build 11.0.10 0-b96-7249189)
? All Android licenses accepted.
[√] Chrome - develop for the web
? Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 2020.3)
? Android Studio at C:\Program Files\Android\Android Studio
? Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
? Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
? Java version OpenJDK Runtime Environment (build 11.0.10 0-b96-7249189)
[√] IntelliJ IDEA Community Edition (version 2021.2)
? IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.2.2
? Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
? Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.63.2)
? VS Code at C:\Users\domin\AppData\Local\Programs\Microsoft VS Code
? Flutter extension version 3.29.0
[√] Connected device (2 available)
? Chrome (web) ? chrome ? web-javascript ? Google Chrome 96.0.4664.110
? Edge (web) ? edge ? web-javascript ? Microsoft Edge 96.0.1054.43
? No issues found!
uj5u.com熱心網友回復:
將此添加到您的app/build.gradle檔案中
android {
//...
lintOptions {
abortOnError false
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/395961.html
