首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AAPT错误:资源可提取/.未找到

AAPT错误:资源可提取/.未找到
EN

Stack Overflow用户
提问于 2018-04-22 11:53:01
回答 26查看 86.6K关注 0票数 57

在最近升级了我的android工作室之后,我再也无法构建我的项目了。

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

代码语言:javascript
复制
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存在于可绘图文件夹下,此错误仍然存在。

重建,清理项目和无效的缓存是无效的!

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

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

代码语言:javascript
复制
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'

如有任何帮助,敬请见谅。

EN

回答 26

Stack Overflow用户

回答已采纳

发布于 2018-04-22 14:10:54

我修正了这个错误,这个错误可能来自一个格式错误的复制的XML文件(可能是一些行结束的混乱)。

重写这些错误,尽管Android显示了另一个文件作为问题的来源,这实际上与错误本身无关。

票数 39
EN

Stack Overflow用户

发布于 2018-12-30 12:05:20

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

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>

安卓工作室没有给出任何警告什么的。删除它解决了问题,但它需要一个完全干净的构建之后。

票数 135
EN

Stack Overflow用户

发布于 2019-09-22 20:51:57

在我的例子中,我删除了名称空间声明副本,比如xmlns:android="http://schemas.android.com/apk/res/android"

并使用Analyse检查代码工具在日志中显示错误,然后在可绘制资源中解决其他文件中的错误。

票数 9
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49965610

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档