eclipse 如何修复错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42479407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:22:54  来源:igfitidea点击:

How fix Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

javaandroideclipseandroid-studio

提问by

I have a project in Eclipse and I export to gradle project and open in Android Studio when I sync project I get Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error:Execution failed for task ':app:mergeDebugResources'.

我在 Eclipse 中有一个项目,我导出到 gradle 项目并在同步项目时在 Android Studio 中打开我收到 Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error:Execution failed for任务':app:mergeDebugResources'。

Error: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException:

错误:java.util.concurrent.ExecutionException:com.android.ide.common.process.ProcessException:

This is my build.gradle :

这是我的 build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 19
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.smok.maps"
        minSdkVersion 8
        targetSdkVersion 19
    }

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

dependencies {
    compile 'com.android.support:support-v4:19.1.0'
    compile 'joda-time:joda-time:2.3'
    compile files('libs/ksoap2-android-assembly-3.6.0-jar-with-dependencies.jar')
    compile files('libs/osmbonuspack_v4.9.jar')
    compile files('libs/osmdroid-android-4.2-javadoc.jar')
    compile files('libs/osmdroid-android-4.2.jar')
    compile files('libs/slf4j-android-1.5.8.jar')
}

采纳答案by Mohammedsalim Shivani

Well, I got this issue because my project was imported from Eclipse to Android Studio and dependencies were missing in gradle.

好吧,我遇到这个问题是因为我的项目是从 Eclipse 导入到 Android Studio 的,并且 gradle 中缺少依赖项。

I got rid of it after adding

添加后我摆脱了它

useLibrary 'org.apache.http.legacy'

in

defaultConfig {
}

below

以下

targetSdkVersion 25

After, this I had to set

之后,我必须设置

minSdkVersion 9

Also, I added following lines

另外,我添加了以下几行

aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false

above

以上

defaultConfig {
    //code snippet
}

So, that it looks like,

所以,它看起来像,

android {

    compileSdkVersion 25
    buildToolsVersion '25.0.2'

    aaptOptions.cruncherEnabled = false
    aaptOptions.useNewCruncher = false

    defaultConfig {
        applicationId "xxx.xxxx.xxxx.xxxx"
        minSdkVersion 9
        targetSdkVersion 25
        useLibrary  'org.apache.http.legacy'
        compileOptions {
            sourceCompatibility JavaVersion.VERSION_1_5
            targetCompatibility JavaVersion.VERSION_1_5
        }
        //remaining code snippet
        //.....
    }
    //remaining code snippet
    //.....
}

@tompok, you are getting this error maybe due to jar files you are using in dependencies may not be there.

@tompok,您收到此错误可能是因为您在依赖项中使用的 jar 文件可能不存在。

Instead Google for their gradle dependencies and place the package name in place of path like it is in first line:

相反,谷歌搜索他们的 gradle 依赖项,并将包名放在路径的位置,就像在第一行一样:

compile 'com.android.support:support-v4:19.1.0'

Replace remaining dependencies in the above format.

以上述格式替换剩余的依赖项。

Hope, it will help you.

希望,它会帮助你。

______________________________________

______________________________________

EDIT:

编辑:

You are facing this problem since you are using buildToolsVersion 25.0.2whereas library you are using is compile 'com.android.support:support-v4:19.1.0'

您正面临这个问题,因为您正在使用buildToolsVersion 25.0.2而您正在使用的库是compile 'com.android.support:support-v4:19.1.0'

Just change it to compile 'com.android.support:support-v4:25.0.2'and your issue will be solved.

只需将其更改为compile 'com.android.support:support-v4:25.0.2',您的问题就会得到解决。

Ask if you face any other issue else accept it as answer so it may help others.

询问您是否面临任何其他问题,否则将其作为答案,以便对其他人有所帮助。

回答by Samin

Try code on your module build.gradle:

在你的模块 build.gradle 上尝试代码:

 android {
 // ...
 aaptOptions.cruncherEnabled = false
 aaptOptions.useNewCruncher = false
 // ...
 }

It means Android studio DO NOT check PNG strictly.

这意味着 Android studio 不严格检查 PNG。

回答by Chuanhang.gu

I met this problem, after draw the left and bottom stratch line for .9 .png then it ok. Good luck.

我遇到了这个问题,在为 .9 .png 绘制了左侧和底部层线之后就可以了。祝你好运。

回答by ir2pid

most of the time is a corrupt PNG image added recently to the project which cause this error. Check the git log and replace the file.

大多数情况下是最近添加到项目中的损坏的 PNG 图像导致此错误。检查git日志并替换文件。

Sometimes menu : File > InvalidateCaches/Restart also helps

有时菜单: File > InvalidateCaches/Restart also helps

回答by BharathRao

Well, I didn't got the solution when I used in android studio 3.1

嗯,我在android studio 3.1中使用的时候没有得到解决方案

android {
 // ...
 aaptOptions.cruncherEnabled = false
 aaptOptions.useNewCruncher = false
 // ...
 }

Actually I'm in the process of importing the eclipse project to latest android studio. I spend around three day in searching for this specific error.

实际上,我正在将 eclipse 项目导入到最新的 android studio。我花了大约三天的时间来搜索这个特定的错误。

 Error:java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Error:Execution failed for task ':app:mergeDebugResources'.

I found some references from the following links...

我从以下链接中找到了一些参考资料...

After that I searched In the drawablefor the images with the extension image_name.9.png. and renamedit to image_name.png. After that this error got disappeared. Again this worked for my project, still not sure about other causes for this problem. I hope that this may be useful for someone!

之后,我在drawable 中搜索带有扩展名的图像image_name.9.png。并将其重命名image_name.png. 之后这个错误就消失了。这再次适用于我的项目,仍然不确定此问题的其他原因。我希望这可能对某人有用!

回答by Samnjor

Invalidate the caches then close the project and import it again.

使缓存无效,然后关闭项目并再次导入。