【发布时间】:2021-08-26 00:56:39
【问题描述】:
我正在尝试构建我的颤振应用程序的 apk,但是当我运行此命令时
flutter build apk
我遇到以下错误;
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':clipboard_manager:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
/home/username/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/fontVariationSettings not found.
/home/username/.gradle/caches/transforms-2/files-2.1/a528b13ac93e64cafa3d0480e2c93207/core-1.1.0/res/values/values.xml:142:5-173:25: AAPT: error: resource android:attr/ttcIndex not found.
* 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 9s
Running Gradle task 'assembleRelease'...
Running Gradle task 'assembleRelease'... Done 10.1s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetifier to solve the
incompatibility.
Building plugin clipboard_manager...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 741ms
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'clipboard_manager'.
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
* 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 0s
The plugin clipboard_manager could not be built due to the issue above.
我收到了flutter pub outdated --mode=null-safety
Package Name Current Upgradable Resolvable Latest
direct dependencies:
clipboard_manager ✗0.0.4 ✗0.0.4 ✗0.0.4 ✗0.0.4
cupertino_icons ✗0.1.3 ✗0.1.3 ✓1.0.3 ✓1.0.3
dio ✗3.0.10 ✗3.0.10 ✓4.0.0 ✓4.0.0
flutter_circular_chart ✗0.1.0 ✗0.1.0 ✗0.1.0 ✗0.1.0
flutter_secure_storage ✗3.3.5 ✗3.3.5 ✓4.2.0 ✓4.2.0
flutter_svg ✗0.19.3 ✗0.19.3 ✓0.22.0 ✓0.22.0
http ✗0.12.2 ✗0.12.2 ✓0.13.3 ✓0.13.3
image_picker ✗0.6.5+3 ✗0.6.5+3 ✓0.8.0+3 ✓0.8.0+3
logger ✗0.9.4 ✗0.9.4 ✓1.0.0 ✓1.0.0
provider ✗4.3.3 ✗4.3.3 ✓5.0.0 ✓5.0.0
8 dependencies are constrained to versions that are older than a resolvable version.
To update these dependencies, edit pubspec.yaml, or run `flutter pub upgrade --null-safety`.
我已经搜索过了,他们告诉我将 flutter.sdk 更改为 home.username/Android/Sdk 我这样做了,但是在运行 buiuld 命令后,我得到了 home/lechat/snap/flutter/common/flutter在 local.properties 中的 flutter.sdk 中。 我不知道问题到底是什么。请帮我解决这个问题。如果您有任何其他信息,我准备分享。 我也关注了这个问题,related problem 但仍然出现同样的错误。
【问题讨论】:
-
如果显示 pub 已过时,您是否尝试过更新依赖项并运行 dart fix --dry-run 和 flutter fix --apply?
-
您能否告诉我执行这些修复的确切命令。真的很有帮助
-
当然,如果它可以作为答案发布,则可以升级软件包,您可以使用“flutter pub update”。要检查您的应用是否需要 fixe4s,您可以运行“dart --dry-run”,如果需要修复,请运行“flutter fix --apply”
-
是更新还是升级?
-
嘿嘿检查这个命令是否正确
flutter fix --apply
标签: flutter flutter-dependencies