在新位置软件包上运行Flutter会引发错误

时间:2019-02-20 16:32:49

标签: android android-studio gradle flutter

我已经使用Android Studio创建了一个基本的android flutter应用程序。我记得运行过该应用几次,但突然间它没有运行。尝试将targetSdkVersion和compileSdkVersion从27更改为28,尽管有帮助,但这是行不通的。尝试了解问题的根源,因为我是Android开发的新手。

我注意到的是: 仅当我在pubspec.yaml中添加geolocator或location软件包并将其导入时,才会引发以下错误。如果我将其删除,则该应用程序可以正常运行

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Android resource linking failed
  Output:  C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\incremental\mergeDebugResources\merged.
dir\values\values.xml:197: error: resource android:attr/fontVariationSettings not found.
  C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\incremental\mergeDebugResources\merged.dir\value
s\values.xml:198: error: resource android:attr/ttcIndex not found.
  error: failed linking references.

  Command: C:\Users\digi_yb\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\0a870866429dd545bdd071cb7f1
72c92\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\digi_yb\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\merged_manifests\debug\processDebugManif
est\merged\AndroidManifest.xml\
          -o\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\processed_res\debug\processDebugResource
s\out\resources-debug.ap_\
          -R\
          @C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\incremental\processDebugResources\resou
rces-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\generated\not_namespaced_r_class_sources\debug\process
DebugResources\r\
          --custom-package\
          de.digi3.digi3app\
          -0\
          apk\
          --output-text-symbols\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\symbols\debug\R.txt\
          --no-version-vectors
  Daemon:  AAPT2 aapt2-3.2.1-4818971-windows Daemon #0
  Output:  C:\Users\digi_yb\.gradle\caches\transforms-1\files-1.1\core-1.0.0-rc01.aar\037167aeb6c73f9e63ab1315d785696d\res\va
lues\values.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found.

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

  error: failed linking references.
  Command: C:\Users\digi_yb\.gradle\caches\transforms-1\files-1.1\aapt2-3.2.1-4818971-windows.jar\0a870866429dd545bdd071cb7f1
72c92\aapt2-3.2.1-4818971-windows\aapt2.exe link -I\
          C:\Users\digi_yb\AppData\Local\Android\sdk\platforms\android-27\android.jar\
          --manifest\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\merged_manifests\debug\processDebugManif
est\merged\AndroidManifest.xml\
          -o\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\processed_res\debug\processDebugResource
s\out\resources-debug.ap_\
          -R\
          @C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\intermediates\incremental\processDebugResources\resou
rces-list-for-resources-debug.ap_.txt\
          --auto-add-overlay\
          --java\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\build\app\generated\not_namespaced_r_class_sources\debug\process
DebugResources\r\
          --custom-package\
          de.digi3.digi3app\
          -0\
          apk\
          --output-text-symbols\
          C:\Users\digi_yb\Documents\flutter_tests\digi3_app\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 --sca
n to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 14s
Gradle task 'assembleDebug'... Done                         15.3s
Gradle task assembleDebug failed with exit code 1

1 个答案:

答案 0 :(得分:1)

该错误告诉我您尚未更新编译SDK版本。 :)“ android-27”表示您仍在使用编译SDK版本27。也许您忘记保存了,或者其他什么替代了它?应该是28版。