gpt4 book ai didi

android - AAPT 错误 : resource drawable/. .. 未找到

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:16:36 27 4
gpt4 key购买 nike

最近升级我的 android studio 后,我无法再构建我的项目。

每次执行构建时,我都会遇到以下错误:

error: resource drawable/splash_screen (aka com.whereisthemonkey.nowalism:drawable/splash_screen) not found.
Message{kind=ERROR, text=error: resource drawable/splash_screen (aka com.whereisthemonkey.nowalism:drawable/splash_screen) not found., sources=[C:\Users\Lucas\.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\cf575568f869a44c685b16e47de83a28\res\values\values.xml:1632:5-84], original message=, tool name=Optional.of(AAPT)}

即使文件 splash_screen.xml 存在于 drawable 文件夹下,此错误仍然存​​在。

重建、清理项目和使缓存失效都没有用!

添加行 android.enableAapt2=false 并不能解决真正的问题,因此我宁愿找到问题的根源。

下面显示了我的 gradle.build 文件:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'kotlin-kapt'//https://github.com/bumptech/glide/issues/1939

android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.whereisthemonkey.nowalism"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
// Keep the following configuration in order to target Java 8.
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs += [
'src/main/res-backgrounds',
'src/main/res-jobs',
]
}
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'

//Do not update due to dex error
implementation 'org.apache.commons:commons-lang3:3.6'

//Do not update due to dex error
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'

implementation 'com.aurelhubert:ahbottomnavigation:2.1.0'
implementation 'com.afollestad.material-dialogs:core:0.9.6.0'
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'

implementation 'com.amitshekhar.android:android-networking:1.0.1'
implementation 'org.apache.directory.studio:org.apache.commons.io:2.4'

implementation 'com.github.ome450901:SimpleRatingBar:1.4.1'

implementation 'com.sothree.slidinguppanel:library:3.4.0'

implementation 'com.github.esafirm.android-image-picker:imagepicker:1.12.0'
//Do not update due to dex error
implementation 'com.theartofdev.edmodo:android-image-cropper:2.5.1'

implementation 'com.github.bumptech.glide:glide:4.6.1'
kapt 'com.github.bumptech.glide:compiler:4.6.1'//https://github.com/bumptech/glide/issues/1939

implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'

implementation 'de.hdodenhof:circleimageview:2.2.0'

testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

implementation 'com.firebaseui:firebase-ui-auth:3.2.1'
implementation 'com.android.support:support-v4:27.1.1'
}


apply plugin: 'com.google.gms.google-services'

如有任何帮助,我们将不胜感激。

最佳答案

在我的例子中,它是一个 xml 选择器。在第一行我有两个这样的(感谢在我的文件中复制粘贴):

<?xml version="1.0" encoding="utf-8"?>

Android Studio 没有给出任何警告或其他信息。删除它解决了问题,但之后需要一个完整的干净构建。

关于android - AAPT 错误 : resource drawable/. .. 未找到,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49965610/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com