今天,我在项目中遇到了与昨天工作时相同的错误,没有任何问题。
某些升级导致此错误IMO,我的解决方案是:
通过Android Studio打开项目
打开android/build.gradle并android/app/build.gradle
只需纠正IDE警告的内容,它通常会警告您的SDK,Kotlin和Gradle版本等。
它不是强制性的,但您可以检查.bashrc导出或环境变量,有时它可以解决一些问题。
编辑:更新SDK版本时,请不要忘记也升级项目依赖项。
解决方法它发生在任何地方。有一天,我运行的代码运行得很好,第二天,却没有碰到我的build.gradle文件或任何其他构建文件,却弹出了此错误。
我尝试了许多不同的解决方案,例如更改buildToolsVersion或将AAPT(不记得哪个)的特定标志设置为false。没事。我的app build.gradle文件:
android { compileSdkVersion 27 buildToolsVersion ’27.0.3’ sourceSets { main.java.srcDirs += ’src/main/kotlin’ } lintOptions { disable ’InvalidPackage’ } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId 'com.skydevs.bookx' minSdkVersion 16 targetSdkVersion 27 versionCode flutterVersionCode.toInteger() versionName flutterVersionName testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner' } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now,so `flutter run --release` works. signingConfig signingConfigs.debug } } } flutter { source ’../..’ } dependencies { implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version' testImplementation ’junit:junit:4.12’ androidTestImplementation ’com.android.support.test:runner:1.0.2’ androidTestImplementation ’com.android.support.test.espresso:espresso- core:3.0.2’ implementation ’com.google.firebase:firebase-core:16.0.1’ } apply plugin: ’com.google.gms.google-services’
我得到的错误是:
Execution failed for task ’:app:processDebugResources’.> Android resource linking failed Output: C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalmergeDebugResourcesmerged.dirvalues-v28values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found. C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalmergeDebugResourcesmerged.dirvalues-v28values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found. C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:905: error: resource android:attr/fontVariationSettings not found. C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalmergeDebugResourcesmerged.dirvaluesvalues.xml:905: error: resource android:attr/ttcIndex not found. error: failed linking references. Command: C:Usersbaada.gradlecachestransforms-1files-1.1aapt2-3.2.1-4818971-windows.jara5cc63922d025d4315a498efa486650caapt2-3.2.1-4818971-windowsaapt2.exe link -I C:UsersbaadaAppDataLocalAndroidsdkplatformsandroid-27android.jar --manifest C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesmerged_manifestsdebugprocessDebugManifestmergedAndroidManifest.xml -o C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesprocessed_resdebugprocessDebugResourcesoutresources-debug.ap_ -R @C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalprocessDebugResourcesresources-list-for-resources-debug.ap_.txt --auto-add-overlay --java C:UsersbaadaAndroidStudioProjectsbookxbuildappgeneratednot_namespaced_r_class_sourcesdebugprocessDebugResourcesr --custom-package com.example.bookx -0 apk --output-text-symbols C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatessymbolsdebugR.txt --no-version-vectors Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0 Output: C:Usersbaada.gradlecachestransforms-1files-1.1appcompat-1.0.2.aaraa44270b14856bd5a0b17a3c0a45cb34resvalues-v28values-v28.xml:9:5-12:13: AAPT: error: resource android:attr/dialogCornerRadius not found. C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalmergeDebugResourcesmerged.dirvalues-v28values-v28.xml:11: AAPT: error: resource android:attr/dialogCornerRadius not found. C:Usersbaada.gradlecachestransforms-1files-1.1core-1.0.1.aarbc8b94f938baa5558925fd51b49cb6bfresvaluesvalues.xml:89:5-125:25: AAPT: error: resource android:attr/fontVariationSettings not found. C:Usersbaada.gradlecachestransforms-1files-1.1core-1.0.1.aarbc8b94f938baa5558925fd51b49cb6bfresvaluesvalues.xml:89:5-125:25: AAPT: error: resource android:attr/ttcIndex not found. error: failed linking references. Command: C:Usersbaada.gradlecachestransforms-1files-1.1aapt2-3.2.1-4818971-windows.jara5cc63922d025d4315a498efa486650caapt2-3.2.1-4818971-windowsaapt2.exe link -I C:UsersbaadaAppDataLocalAndroidsdkplatformsandroid-27android.jar --manifest C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesmerged_manifestsdebugprocessDebugManifestmergedAndroidManifest.xml -o C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesprocessed_resdebugprocessDebugResourcesoutresources-debug.ap_ -R @C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatesincrementalprocessDebugResourcesresources-list-for-resources-debug.ap_.txt --auto-add-overlay --java C:UsersbaadaAndroidStudioProjectsbookxbuildappgeneratednot_namespaced_r_class_sourcesdebugprocessDebugResourcesr --custom-package com.example.bookx -0 apk --output-text-symbols C:UsersbaadaAndroidStudioProjectsbookxbuildappintermediatessymbolsdebugR.txt --no-version-vectors Daemon: AAPT2 aapt2-3.2.1-4818971-windows Daemon #0