简体   繁体   中英

AAPT2 failed resources error

The problem came out of nowhere. I've just started the project at the morning and updated Android Studio to 3.1.4. I have an error while gradle building:

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.

And something more:

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

What I've tried:

  • make android.enableAapt2=false
  • set min SDK to 14 and target SDK to 'android-P'
  • just clean/rebuild
  • install Android Studio 3.2 Beta 5
  • File -> Invalid Cashes/Restart
  • try to build on another computer (the same error)

Config files:

// 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
}

App's config:

    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'

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM