在控制台执行flutter run
指令启动flutter项目时,突然出现以下错误,懵了一下:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
Output: D:\flutter_shop\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:86: error: resource android:attr/fontVariationSettings not found.
D:\flutter_shop\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:87: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c6f034b22b3d3887225d461936d35a7f\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\Administrator\AppData\Local\Android\sdk\platforms\android-27\android.jar\
--manifest\
D:\flutter_shop\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
D:\flutter_shop\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@D:\flutter_shop\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
D:\flutter_shop\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.example.fluttershop\
-0\
apk\
--output-text-symbols\
D:\flutter_shop\build\app\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
Output: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\core-1.0.2.aar\71f3aaf5497578c2e474b508e78e8924\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\core-1.0.2.aar\71f3aaf5497578c2e474b508e78e8924\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.
Command: C:\Users\Administrator\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c6f034b22b3d3887225d461936d35a7f\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
C:\Users\Administrator\AppData\Local\Android\sdk\platforms\android-27\android.jar\
--manifest\
D:\flutter_shop\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
-o\
D:\flutter_shop\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
-R\
@D:\flutter_shop\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
--auto-add-overlay\
--java\
D:\flutter_shop\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
--custom-package\
com.example.fluttershop\
-0\
apk\
--output-text-symbols\
D:\flutter_shop\build\app\intermediates\symbols\debug\R.txt\
--no-version-vectors
Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
* 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 7s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 7.8s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
尝试了几种方式之后都还是报错,好吧,继续找解决方案吧,哈哈,终于找到了:
在这里 找到了解决的办法 https://www.javaear.com/question/54472636.html
步骤如下:
(1)修改compileSdkVersion
在android/app/build.gradle
下面修改compileSdkVersion
为28
(2)执行指令清理一下之前生成的一些文件
flutter clean
(3)在控制台重新启动flutter
项目
flutter run
好了,项目终于又重新跑起来了~~~~~~~
点赞是最好的支持,关注是最大的鼓励。亲爱的朋友,很荣幸在简书遇到您,若有疑问,欢迎探讨~~~。