简体   繁体   English

无法构建Android APK-任务':app:mergeDebugResources'执行失败

[英]Unable to build Android APK - Execution failed for task ':app:mergeDebugResources'

Some People marked this question as duplicate. 有些人将此问题标记为重复。 But the issue is still not solved even after I tried all the methods which was given in similar question. 但是,即使我尝试了类似问题中给出的所有方法,该问题仍然无法解决。 aapt2.exe still throwing error and saying aapt2.exe is stopped working. aapt2.exe仍然抛出错误,并说aapt2.exe停止工作。

I have developed a project in Mac machine and it's completely working fine in that. 我已经在Mac机器上开发了一个项目,并且在其中完全可以正常工作。 Now I wanted to move this project to another system so that other members can also work in it. 现在,我想将此项目移至另一个系统,以便其他成员也可以在其中工作。 When I installed Android Studio and open this same project in Windows machine its showing me the following error and I can't able to generate any build from that system. 当我安装Android Studio并在Windows计算机中打开该项目时,它向我显示以下错误,并且我无法从该系统生成任何版本。 And I am getting following error in dialog box when I try to take build 当我尝试进行构建时,对话框中出现以下错误

aapt2.exe is stopped working
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> 8 exceptions were raised by workers:
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #0: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #6: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #5: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #4: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #3: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #2: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #1: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.
  com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.1-5326820-windows Daemon #7: Daemon startup failed
  This should not happen under normal circumstances, please file an issue if it does.

But I can able to create the new projects in the same machine and take build in that. 但是我可以在同一台计算机上创建新项目并在其中构建。 Only in this migrated project I am unable to take a build. 仅在这个已迁移的项目中,我无法进行构建。 And I checked and changed the Android build versions and gradle versions, also tried invalidate cache and restart but nothing solved my problem. 我检查并更改了Android构建版本和gradle版本,还尝试使缓存无效并重新启动,但没有任何解决方案。 Andr my gradle files are... Andr我的gradle文件是...

App Gradle File 应用程式档档案

apply plugin: 'com.android.application'
//apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    buildToolsVersion "28.0.3"
    defaultConfig {
        applicationId "com.sit.novus.novusmobileframework"
        minSdkVersion 24
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

dependencies {
    //compile fileTree(dir: 'libs', include: ['*.jar'])
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    testImplementation ('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    //Media Picker
    implementation project(path: ':switchdatetime')
    implementation project(path: ':RTextEditorView-0.1.1')

    implementation  'com.android.support:appcompat-v7:28.0.0'
    implementation  'com.android.support:design:28.0.0'
    implementation  'com.android.support:cardview-v7:28.0.0'
    implementation  'com.github.bumptech.glide:glide:3.7.0'
    implementation  'com.android.support:recyclerview-v7:28.0.0'
    implementation  'com.android.volley:volley:1.1.0'
    implementation  'com.chootdev:csnackbar:1.3.1'
    implementation  'us.belka:androidtoggleswitch:1.2.2'
    implementation  'com.github.zcweng:switch-button:0.0.3@aar'
    implementation  'com.github.marcoscgdev:FingerAuth:1.0.0'
    implementation  'com.erikagtierrez.multiple_media_picker:multiple-media-picker:1.0.3'
    implementation  'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.jaredrummler:colorpicker:1.0.1'
    implementation 'com.droidninja:filepicker:2.2.1'

    testImplementation 'junit:junit:4.12'
}
configurations.all {
    resolutionStrategy.eachDependency { DependencyResolveDetails details ->
        def requested = details.requested
        if (requested.group == 'com.android.support') {
            if (!requested.name.startsWith("multidex")) {
                details.useVersion '25.3.0'
            }
        }
    }
}

Project Gradle File 项目Gradle文件

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

buildscript {
    repositories {
        maven {
            url "https://jitpack.io"
        }
        jcenter()
        google()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.4.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
        jcenter()
    }

}

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

Gradle-Wrapper-Properties 摇篮-包装-属性

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

Run following command from Android studio terminal/ubuntu machine shell. 从Android Studio终端/ ubuntu机器外壳运行以下命令。

gradlew clean
gradlew assembleDebug --debug

This is Temporary Solution. 这是临时解决方案。

use Gradle version 使用Gradle版本

 classpath 'com.android.tools.build:gradle:3.3.2'

and in gradle-wrapper.properties change distributionUrl to gradle-wrapper.properties改变distributionUrl

https\://services.gradle.org/distributions/gradle-4.10.1-all.zip

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 任务':app:mergeDebugResources'执行失败并生成错误 - Execution failed for task ':app:mergeDebugResources' & Build errors 任务':app:mergeDebugResources'的android studio执行失败 - android studio Execution failed for task ':app:mergeDebugResources' 任务 ':app:mergeDebugResources' 执行失败。 安卓工作室 - Execution failed for task ':app:mergeDebugResources'. Android studio Android - 错误:任务执行失败':app:mergeDebugResources' - Android - Error:Execution failed for task ':app:mergeDebugResources' 任务执行失败:':app:mergeDebugResources'。 Android工作室 - Execution failed for task :':app:mergeDebugResources'. Android Studio Android Studio中的任务':app:mergeDebugResources'执行失败 - Execution failed for task ':app:mergeDebugResources' in Android Studio 任务':app:mergeDebugResources'的执行失败。 > -1 - Execution failed for task ':app:mergeDebugResources'. > -1 FAILURE:构建失败并出现异常。 任务“:app:mergeDebugResources”执行失败 - FAILURE: Build failed with an exception. Execution failed for task ':app:mergeDebugResources' 任务执行失败':app:mergeDebugResources' - Execution failed for task ':app:mergeDebugResources' Android Studio 执行任务“:app:mergeDebugResources”失败。 并且无法建立一些目录 - Android Studio Execution failed for task ':app:mergeDebugResources'. and Failed to build some directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM