AAPT2资源失败错误

时间:2018-08-07 07:58:40

标签: android gradle android-resources aapt

问题无处不在。我刚刚在早上开始该项目,并将Android Studio更新为3.1.4。 我在构建gradle时出错:

Output:  C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2420: error: resource drawable/rounded_btn_green (aka sys_rom.ru.comfort_uk_app:drawable/rounded_btn_green) not found.
C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:2425: error: resource drawable/rounded_btn_red (aka sys_rom.ru.comfort_uk_app:drawable/rounded_btn_red) not found.

还有其他内容:

Command: C:\Users\Public\.gradle\caches\transforms-1\files-1.1\aapt2-3.3.0-alpha04-4818971-windows.jar\34f5a29e7c2942acb56467bc777e4710\aapt2-3.3.0-alpha04-4818971-windows\aapt2.exe link -I\
    C:\Users\Admin\AppData\Local\Android\Sdk\platforms\android-27\android.jar\
    --manifest\
    C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\intermediates\merged_manifests\debug\AndroidManifest.xml\
    -o\
    C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\intermediates\processed_res\debug\processDebugResources\out\resources-debug.ap_\
    -R\
    @C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\intermediates\incremental\processDebugResources\resources-list-for-resources-debug.ap_.txt\
    --auto-add-overlay\
    --java\
    C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\generated\not_namespaced_r_class_sources\debug\processDebugResources\r\
    --custom-package\
    sys_rom.ru.comfort_uk_app\
    -0\
    apk\
    --output-text-symbols\
    C:\Users\Admin\Documents\AndroidStudioProjects\Barnaul\comfort_uk\app\build\intermediates\symbols\debug\R.txt\
    --no-version-vectors
Daemon:  AAPT2 aapt2-3.3.0-alpha04-4818971-windows Daemon #0

我尝试过的事情:

  • 制作android.enableAapt2=false
  • 将min SDK设置为14,并将目标SDK设置为“ android-P”
  • 只是清洁/重建
  • 安装Android Studio 3.2 Beta 5
  • 文件->无效的现金/重新启动
  • 尝试在另一台计算机上构建(相同的错误)

配置文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0-alpha04'
        classpath 'com.google.gms:google-services:3.0.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

应用程序的配置:

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'

    defaultConfig {
        applicationId "sys_rom.ru.comfort_uk_app"
        minSdkVersion 14
        targetSdkVersion 27
        versionCode 9
        versionName "1"

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    useLibrary 'org.apache.http.legacy'

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.android.support:support-v4:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation "com.android.support:recyclerview-v7:27.1.1"
    implementation 'com.google.firebase:firebase-core:10.0.1'
    implementation 'com.google.firebase:firebase-messaging:10.0.1'
    implementation 'com.google.firebase:firebase-auth:10.0.1'
    implementation "com.squareup.picasso:picasso:2.5.0"

    implementation 'com.makeramen:roundedimageview:2.3.0'
}

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

1 个答案:

答案 0 :(得分:2)

问题是我已将这个字符串<?xml version="1.0" encoding="utf-8"?>两次放置在我的一个新可绘制对象的开头。