Android Studio’s various pitfalls: finished with non-zero exit value 1 and Return code 1 for dex process.

For errors such as finished with non-zero exit value 1 , it can be resolved as follows:
android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"

//Add the following code to solve
 dexOptions { 
        javaMaxHeapSize "4g"
    

}

}

After adding the above code, the error is indeed not reported, and it runs correctly. But what I didn’t expect was that when I restarted the computer,

An accident came, and it couldn't run anymore, and the same error was reported! Later, I removed that piece of code and then ran it and reported individual errors, as follows:

Error:Execution failed for task ':app:transformClassesWithDexForDebug'. > com.android.build.api.transform.TransformException:

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

com.android.ide.common.process.ProcessException: Return code 1 for dex process.

The solution I found is: build->clean project, it works!

Also, I haven't written much code yet. Each compilation takes 7, 8, or even ten minutes. It's super slow and I really want to give up learning Android, but as a programmer, patience is a required course. The solution found is:

Check offline work under File->settings. It won't waste so much time every time you compile the dependent library, but you must remember to remove it next time you want to add the dependent library! Because of networking

Download the dependent library.

Why does AS always show some errors? I upgraded to version 2.2.2 before, and after creating a new project, various errors were reported saying that the dependent library could not be released, and I couldn't find a solution online. It was cheating. . Reluctant to uninstall, re

I installed version 2.1.2 and reported can't resolve junit. I had to comment out the junit in the dependent library. I still don't understand why this happens, hey. .

Guess you like

Origin blog.csdn.net/kerwinJu/article/details/53048555