在项目中包含image_picker时出错(抖动)

时间:2019-02-01 03:52:48

标签: dart flutter

为什么在执行项目时仍会出现此错误?一旦将image_picker放入我的pubspec中,它就会发生。

  

失败:生成失败,发生异常。   * 什么地方出了错:   任务':app:processDebugResources'的执行失败。   Android资源链接失败     输出:/Users/s/Desktop/Flutter/a/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:331:错误:找不到资源android:attr / fontVariationSettings。     /Users/s/Desktop/Flutter/a/build/app/intermediates/incremental/mergeDebugResources/merged.dir/values/values.xml:331:错误:未找到资源android:attr / ttcIndex。     错误:链接引用失败。     命令:/Users/s/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/6d65e55edb223325e7c5119d99552582/aapt2-3.2.1-4818971-osx/aapt2链接-I \             /Users/s/Library/Android/sdk/platforms/android-27/android.jar \              - 表现\             /Users/s/Desktop/Flutter/a/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml \             -o \             /Users/s/Desktop/Flutter/a/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_ \             -R \             @ / Users / s / Desktop / Flutter / a / build / app / intermediates / incremental / processDebugResources / resources-list-for-resources-debug.ap_.txt \             --auto-add-overlay \             --java \             / Users / s / Desktop / Flutter / a / build / app / generated / not_namespaced_r_class_sources / debug / processDebugResources / r \             --custom-package \             com.example.a \             -0 \             apk \             --output-text-symbols \             /Users/s/Desktop/Flutter/a/build/app/intermediates/symbols/debug/R.txt \             --no-version-vectors     守护程序:AAPT2 aapt2-3.2.1-4818971-osx守护程序#0     输出:/Users/s/.gradle/caches/transforms-1/files-1.1/design-27.1.1.aar/fa938137e4d19d1dd06a6895b6e14886/res/values/values.xml:96:5-202:AAPT:错误:资源android :attr / fontVariationSettings找不到。

     

/Users/s/.gradle/caches/transforms-1/files-1.1/design-27.1.1.aar/fa938137e4d19d1dd06a6895b6e14886/res/values/values.xml:96:5-202:AAPT:错误:资源找不到android:attr / ttcIndex。     错误:链接引用失败。     命令:/Users/s/.gradle/caches/transforms-1/files-1.1/aapt2-3.2.1-4818971-osx.jar/6d65e55edb223325e7c5119d99552582/aapt2-3.2.1-4818971-osx/aapt2链接-I \             /Users/s/Library/Android/sdk/platforms/android-27/android.jar \              - 表现\             /Users/s/Desktop/Flutter/a/build/app/intermediates/merged_manifests/debug/processDebugManifest/merged/AndroidManifest.xml \             -o \             /Users/s/Desktop/Flutter/a/build/app/intermediates/processed_res/debug/processDebugResources/out/resources-debug.ap_ \             -R \             @ / Users / s / Desktop / Flutter / a / build / app / intermediates / incremental / processDebugResources / resources-list-for-resources-debug.ap_.txt \             --auto-add-overlay \             --java \             / Users / s / Desktop / Flutter / a / build / app / generated / not_namespaced_r_class_sources / debug / processDebugResources / r \             --custom-package \             com.example.a \             -0 \             apk \             --output-text-symbols \             /Users/s/Desktop/Flutter/a/build/app/intermediates/symbols/debug/R.txt \             --no-version-vectors     守护程序:AAPT2 aapt2-3.2.1-4818971-osx守护程序#0

3 个答案:

答案 0 :(得分:0)

将您的compileSdkVersion更改为28(在android / app / build.gradle下)

  

compileSdkVersion 28

然后运行命令

  

干净整洁

然后再次运行项目。

答案 1 :(得分:0)

@PhucTran的答案是正确的。 只需添加我必须从Android Studio中Invalidate Cache并重新启动它即可。

File-> Invalidate Cahe and Restart

答案 2 :(得分:0)

如果将支持库升级到28.0.0并且compileSdkVersion也不是28,则会出现此错误。

要解决此问题,请更改文件app\build.gradle

要解决此问题,文件app \ build.gradle compileSdkVersiontargetSdkVersion中的文件从最新更改为最新(现在更新为29)。

android {
    compileSdkVersion 29

...

defaultConfig {
    minSdkVersion 21
    targetSdkVersion 29
    multiDexEnabled true
    ...
}