android project: process finished with non-zero exit value 2

狂风中的少年 提交于 2019-11-29 06:44:29

This happened for me when I was refactoring some class files to a library project and I had a duplicate name of a class file. So, double check that you do not have any duplicate names.

Android Studio suggests,

Avoid using + in version numbers can lead to unpredictable and unrepeatable builds.

+ in dependencies lets you pick up automatically the latest available version rather than a specific one, however this is not recommended.

You may have tested with a slightly different version than what build server used.

After Removing Plus Sign and Adding a Specific Version problem was solved in my case.

The date of when this happened to me was 07/08/2016.

I just got this exact error after updating to the newest android studio.

I resolved it by updating my java jdk from java jdk 7 to java jdk 8.

Now my builds work fine. I think the newest version of android studio requires jdk 8…

In my case I write in the build.gradle dependencies from the parse quick guide

dependencies{
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}

then I replace with

dependencies {
    compile 'com.parse.bolts:bolts-android:1.+'
    compile fileTree(dir: 'libs', include: 'Parse-*.jar')
}

Save the changes, restart the android studio and run the project. It worked in my case.

I have used this command in build.gradle file.

configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}

It has resolved this "non-zero-exit-value" and another one 'duplicate entry during packageAllDebugClassesForMultiDex'.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!