这可能是重复的,但是我和其他一些人无法通过our app.
找到解决此构建问题的方法一段时间以来,我们已经获得了有关不赞成使用的库的注释和警告,但是似乎这个新问题现在完全阻止了构建(下面的完整输出):
major version 53 is newer than 52, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
一个重要的警告是flutter build appbundle --target-platform android-arm,android-arm64,android-x64
可以很好地工作,只是显示不推荐使用的音符。
我应该怎么做才能修复apk版本;如果事实证明这是问题,我如何如上所述更新编译器?如何更新已弃用的库?
我正在将Visual Studio Code与Flutter和Dart插件一起使用,这是我的flutter doctor
输出(所有警告均不相关):
[√] Flutter (Channel beta, 1.22.0-12.1.pre, on Microsoft Windows [Version 10.0.18363.1139], locale hu-HU)
• Flutter version 1.22.0-12.1.pre at C:\Users\fodor\Documents\_Android\FlutterSDK\flutter
• Framework revision 8b3760638a (7 weeks ago), 2020-09-15 17:47:13 -0700
• Engine revision 4654fc6cf6
• Dart version 2.10.0 (build 2.10.0-110.3.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at C:\Users\fodor\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
• All Android licenses accepted.
[!] Android Studio (version 4.0)
• Android Studio at C:\Program Files\Android\Android Studio1
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
[√] VS Code, 64-bit edition (version 1.50.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.16.0
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
完整输出:
PS C:\Users\fodor\Documents\_Android\Flutter\_FILC4\filcnaplo> flutter build apk --release
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
Note: C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\downloads_path_provider-0.1.0\android\src\main\java\it\nplace\downloadspathprovider\DownloadsPathProviderPlugin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\file_picker-1.13.3\android\src\main\java\com\mr\flutter\plugin\filepicker\FileUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\image_cropper-1.3.1\android\src\main\java\vn\hunghd\flutter\plugins\imagecropper\FileUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
warning: C:\Users\fodor\AppData\Local\Android\sdk\build-tools\30.0.0\core-lambda-stubs.jar(java/lang/invoke/LambdaMetafactory.class): major version 53 is newer than 52, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
1 warning
warning: C:\Users\fodor\AppData\Local\Android\sdk\build-tools\30.0.0\core-lambda-stubs.jar(java/lang/invoke/LambdaMetafactory.class): major version 53 is newer than 52, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
1 warning
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\sqflite-1.3.1+2\android\src\main\java\com\tekartik\sqflite\SqflitePlugin.java:1043: warning: [deprecation] Handler() in Handler has been deprecated
final Handler handler = new Handler();
^
1 warning
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:9: warning: [deprecation] AsyncTask in android.os has been deprecated
import android.os.AsyncTask;
^
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:121: warning: [deprecation] AsyncTask in android.os has been deprecated
new AsyncTask<Void, Void, Boolean>() {
^
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:121: warning: [deprecation] AsyncTask() in AsyncTask has been deprecated
new AsyncTask<Void, Void, Boolean>() {
^
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:123: warning: [deprecation] doInBackground(Params...) in AsyncTask has been deprecated
protected Boolean doInBackground(Void... voids) {
^
where Params,Result are type-variables:
Params extends Object declared in class AsyncTask
Result extends Object declared in class AsyncTask
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:121: warning: [deprecation] AsyncTask() in AsyncTask has been deprecated
new AsyncTask<Void, Void, Boolean>() {
^
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:128: warning: [deprecation] onPostExecute(Result) in AsyncTask has been deprecated
protected void onPostExecute(Boolean value) {
^
where Result is a type-variable:
C:\Users\fodor\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+2\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:131: warning: [deprecation] execute(Params...) in AsyncTask has been deprecated
}.execute();
where Params,Progress,Result are type-variables:
Params extends Object declared in class AsyncTask
Progress extends Object declared in class AsyncTask
Result extends Object declared in class AsyncTask
7 warnings
warning: C:\Users\fodor\AppData\Local\Android\sdk\build-tools\30.0.0\core-lambda-stubs.jar(java/lang/invoke/LambdaMetafactory.class): major version 53 is newer than 52, the highest major version supported by this compiler.
It is recommended that the compiler be upgraded.
error: warnings found and -Werror specified
1 error
1 warning
* What went wrong:
Execution failed for task ':video_player:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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 1m 37s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 98,4s
Gradle task assembleRelease failed with exit code 1
谢谢您的帮助。
答案 0 :(得分:0)
如果您仔细阅读输出,则表示(唯一)错误是存在警告,并且由于编译选项-Werror,它们被视为错误。也许只是删除-Werror选项?
答案 1 :(得分:0)
新的SDK版本陷入了混乱,我发布此答案时并未意识到问题的路由原因。无论哪种方式,它都应该起作用:
将此内容放在buid.gradle
部分之后的allprojects{}
中:
subprojects {
afterEvaluate {project ->
if (project.plugins.hasPlugin('android') || project.plugins.hasPlugin('android-library')) {
android {
compileSdkVersion 29
buildToolsVersion '29.0.0'
}
}
}
}