任务“:app:processDebugResources”的Flutter执行失败

roqulrg3  于 2023-10-22  发布在  Flutter
关注(0)|答案(4)|浏览(162)

当Flutter beta v1.0.0发布时,我离开了我的Flutter项目一段时间。现在,我将我的项目转移到一个新的系统,使用最新的Flutter(稳定版v1.2.1)和Dart,并遇到了这个构建异常问题。
注意这个项目是我的老桌面Flutter医生输出以下工作正常

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v1.0.0, on Linux, locale en_GB.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[✓] Android Studio (version 3.2)
    ✗ Flutter plugin not installed; this adds Flutter specific functionality.
    ✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (1 available)

新/当前系统的Flutter医生输出

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.2.1, on Microsoft Windows [Version 10.0.17763.379], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[!] Android Studio (version 3.2)
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
[√] VS Code (version 1.32.3)
[√] Connected device (1 available)

pubsec.yaml
gist link to pubsec.yaml
因为我回来后很长一段时间,我不知道什么变化,Flutter经历了谁可以帮助我吗
当前系统的Flutter运行输出

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                              1.5s
Resolving dependencies...                                           6.0s

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:956: error: resource android:attr/fontVariationSettings not found.
  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:957: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\18c59619c56cba96590906f3917a302b\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\powerpurple\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          D:\Android Projects\maze-flutter\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          D:\Android Projects\maze-flutter\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @D:\Android Projects\maze-flutter\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          D:\Android Projects\maze-flutter\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.example.codee\
          -0\
          apk\
          --output-text-symbols\
          D:\Android Projects\maze-flutter\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\appcompat-1.0.0-rc01.aar\353a670f458ae84ffafa8b187ee27491\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

  C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\f099bdc17ba82cfe6a5a3ab5ab60bee4\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

  C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\f099bdc17ba82cfe6a5a3ab5ab60bee4\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.

  error: failed linking references.
  Command: C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\18c59619c56cba96590906f3917a302b\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\powerpurple\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          D:\Android Projects\maze-flutter\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          D:\Android Projects\maze-flutter\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @D:\Android Projects\maze-flutter\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          D:\Android Projects\maze-flutter\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.example.codee\
          -0\
          apk\
          --output-text-symbols\
          D:\Android Projects\maze-flutter\build\app\intermediates\symbols\debug\R.txt\
PS D:\Android Projects\maze-flutter> flutter run
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with
"--enable-software-rendering".
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...                                              1.4s
Resolving dependencies...                                           5.7s

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:956: error: resource android:attr/fontVariationSettings not found.
  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:957: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\18c59619c56cba96590906f3917a302b\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\powerpurple\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          D:\Android Projects\maze-flutter\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          D:\Android Projects\maze-flutter\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @D:\Android Projects\maze-flutter\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          D:\Android Projects\maze-flutter\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.example.codee\
          -0\
          apk\
          --output-text-symbols\
          D:\Android Projects\maze-flutter\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\appcompat-1.0.0-rc01.aar\353a670f458ae84ffafa8b187ee27491\res\values-v28\values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found.

  D:\Android Projects\maze-flutter\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values-v28\values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found.

  C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\f099bdc17ba82cfe6a5a3ab5ab60bee4\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

  C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\core-1.0.1.aar\f099bdc17ba82cfe6a5a3ab5ab60bee4\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found.

  error: failed linking references.
  Command: C:\Users\powerpurple\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\18c59619c56cba96590906f3917a302b\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\powerpurple\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          D:\Android Projects\maze-flutter\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          D:\Android Projects\maze-flutter\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @D:\Android Projects\maze-flutter\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          D:\Android Projects\maze-flutter\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.example.codee\
          -0\
          apk\
          --output-text-symbols\
          D:\Android Projects\maze-flutter\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 18s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        19.6s
*******************************************************************************************
The Gradle failure may have been because of AndroidX incompatibilities in this Flutter app.
See * for more information on the problem and how to fix it.
*******************************************************************************************
Gradle task assembleDebug failed with exit code 1
vmjh9lq9

vmjh9lq91#

缺少的资源仅在API 28中添加。您需要将build.gradle文件中的compileSDKversio n更新到版本28。

gcuhipw9

gcuhipw92#

compileSdkVersion更新为我工作!

/AppName/android/app/build.gradle

adnroid**compileSdkVersion: 28compileSdkVersion: 30**
操作系统:Ubuntu 20.04
Android模拟器API 30
dart 2.10.2
Flutter 1.22.2

hts6caw3

hts6caw33#

在defaultConfig中转到/AppName/android/app/build.gradle,

compileSdkVersion 31
    targetSdkVersion 31

对我很有效!

rqenqsqc

rqenqsqc4#

gradle.properties中添加此行

org.gradle.jvmargs=-Xmx1536M --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

相关问题