更新android studio 3.0后无法构建项目

问题描述 投票:3回答:2

在gradle.properties的底部添加了android.enableAapt2 = false gradle.properties

http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
    # org.gradle.parallel=true
    android.enableAapt2=false

build.gradle将sdk工具更新为26版本后更新了gradle文件sdk工具是最新的

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.example.madhural.myapplication"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.github.tarek360.RichPath:animator:0.0.9'
    compile 'com.github.mmoamenn:LuckyWheel_Android:0.0.2'
    compile 'com.google.code.gson:gson:2.6.1'
    testCompile 'junit:junit:4.12'
}

构建完成后得到波纹管错误

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
Error:No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher').
Error:No resource found that matches the given name (at 'roundIcon' with value '@mipmap/ic_launcher_round').
Error:No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:No resource found that matches the given name (at 'icon' with value '@mipmap/ic_launcher').
Error:No resource found that matches the given name (at 'roundIcon' with value '@mipmap/ic_launcher_round').
Error:No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error while executing process C:\Users\amin.p\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\Users\amin.p\AppData\Local\Android\Sdk\platforms\android-26\android.jar -M \\?\D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\res\merged\debug -m -J \\?\D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\generated\source\r\debug -F D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.madhural.myapplication -0 apk --output-text-symbols \\?\D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\symbols\debug --no-version-vectors}
Error:com.android.ide.common.process.ProcessException: Error while executing process C:\Users\amin.p\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe with arguments {package -f --no-crunch -I C:\Users\amin.p\AppData\Local\Android\Sdk\platforms\android-26\android.jar -M \\?\D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\manifests\full\debug\AndroidManifest.xml -S D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\res\merged\debug -m -J \\?\D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\generated\source\r\debug -F D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\res\debug\resources-debug.ap_ --custom-package com.example.madhural.myapplication -0 apk --output-text-symbols \\?\D:\Gamify Your World\GamifyYourWorld\GYWGameApp\app\build\intermediates\symbols\debug --no-version-vectors}
Error:org.gradle.process.internal.ExecException: Process 'command 'C:\Users\amin.p\AppData\Local\Android\Sdk\build-tools\26.0.2\aapt.exe'' finished with non-zero exit value 1
Error:Execution failed for task ':app:processDebugResources'.
> Failed to execute aapt
Information:BUILD FAILED in 13s
Information:10 errors
Information:0 warnings
Information:See complete output in console
android android-studio android-studio-3.0
2个回答
1
投票

我遇到了同样的问题:错误:任务':app:processDebugResources'的执行失败。

com.android.ide.common.process.ProcessException:org.gradle.process.internal.ExecException:进程'命令'C:\ Development \ Android \ Sdk \ build-tools \ 26.0.2 \ aapt.exe''结束于非零退出值1

这个问题是由于:我已经在style.xml中声明了styable,这是不正确的。

<!--<declare-styleable name="mapStyle"><attr name="layout_width"/><attr name="layout_height"/><attr name="layout_weight"/></declare-styleable>-->

当我评论它然后它工作正常。所以检查你的style.xml


0
投票

仔细检查清单和样式文件。它们可能存在错误。特别是如果您在styles.xml中创建了自定义样式。

在那个Build-> Clean Project之后,它应该有用

© www.soinside.com 2019 - 2024. All rights reserved.