问题描述
最近升级了我的android studio之后,我无法再构建项目了.
After recently upgrading my android studio, I am not able to build my project anymore.
每次执行构建时,都会发生以下错误:
Every time I execute a build, I am struck with the following error:
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,该错误仍然存在.
This error persists, even though the file splash_screen.xml exists under the drawable folder.
重建,清理项目和使高速缓存无效!
Rebuilding, cleaning the project and invalidating caches did not work!
添加android.enableAapt2 = false行并不能解决真正的问题,因此我宁愿找到问题的根源.
Adding the line android.enableAapt2=false does not resolve the real issue and I would therefore rather find the root of the problem.
以下显示了我的gradle.build文件:
The following shows my gradle.build file:
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'
我们非常感谢您的帮助.
Any help is kindly appreciated.
推荐答案
我修复了该错误,该错误可能来自格式错误的复制XML文件(可能有些行尾混淆)
I fixed the error, which was probably coming from a mal-formatted copied XML file (probably some line-ending confusion)
重写这些错误可以修复错误,尽管Android Studio显示了另一个文件作为问题的根源,而实际上这与错误本身无关.
Rewriting those fixed the error, although Android Studio displayed another file as the source of the problem, which in fact had nothing to do with the error itself.
这篇关于AAPT错误:资源可绘制/...未找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!