运行应用程序时构建失败,出现异常

时间:2019-02-07 17:21:10

标签: flutter

运行我的应用程序时,我在控制台中收到此错误,并且无法运行该应用程序 该应用程序曾经正常运行,突然间出现了什么问题? 我不明白这个问题 这是按下运行应用程序后控制台出现的错误

运行应用程序时构建失败,出现异常

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Gradle task 'assembleDebug'...

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  E:\Projects\Flutter\labyeeh_store\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:137: error: resource android:attr/fontVariationSettings not found.
  E:\Projects\Flutter\labyeeh_store\build\app\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:137: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\Paymac\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c7b9bfbf0a2c12e55a72f45c789022ac\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\Paymac\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          E:\Projects\Flutter\labyeeh_store\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          E:\Projects\Flutter\labyeeh_store\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @E:\Projects\Flutter\labyeeh_store\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          E:\Projects\Flutter\labyeeh_store\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.labyeeh.labyeehstore\
          -0\
          apk\
          --output-text-symbols\
          E:\Projects\Flutter\labyeeh_store\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\Paymac\.gradle\caches\transforms-1\files-1.1\core-1.0.0-rc01.aar\cb81f74487d3747960ee323a92375a57\res\values\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

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

  error: failed linking references.
  Command: C:\Users\Paymac\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\c7b9bfbf0a2c12e55a72f45c789022ac\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\Paymac\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          E:\Projects\Flutter\labyeeh_store\build\app\intermediates\merged_manifests\debug\processDebugManifest\merged\AndroidManifest.xml\
          -o\
          E:\Projects\Flutter\labyeeh_store\build\app\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
          -R\
          @E:\Projects\Flutter\labyeeh_store\build\app\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          E:\Projects\Flutter\labyeeh_store\build\app\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
          --custom-package\
          com.labyeeh.labyeehstore\
          -0\
          apk\
          --output-text-symbols\
          E:\Projects\Flutter\labyeeh_store\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 3s
Finished with error: Gradle task assembleDebug failed with exit code 1

1 个答案:

答案 0 :(得分:0)

旧的颤抖项目只是以荒谬的方式中断

https://github.com/flutter/flutter/issues/16441

有一种方法可以在我在这里的项目中修复它

https://github.com/hungrymonkey/mic_stream/issues/2

步骤:  1.将所有插件和Flutter环境更新为稳定版1.0 在您的pubspec.yaml中添加

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0" 
  1. 将您的android studio更新到最新的稳定版
  2. 根据mran-google https://github.com/flutter/flutter/issues/16215#issuecomment-378502866

  3. 打开your_project/android/文件夹

  4. 运行构建并进行所有小修复

  5. your_project/android/build.gradle中,类路径等级版本应更改为3.2.1 https://github.com/flutter/flutter/pull/17942/files
  6. your_project/android/gradle/wrapper/gradle-wrapper.properties中,将distributionUrlhttps\://services.gradle.org/distributions/gradle-3.x-all.zip更改为https\://services.gradle.org/distributions/gradle-4.6-all.zip
  7. 修复所有Dart 1-2转换错误

我相信这些都是在迁移旧项目时所需的全部更改。