更新时间:2023-01-25 15:32:31
错误:任务执行失败 ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException:处理命令 C:\ Program Files \ Java \ jdk1.7.0_79 \ bin \ java.exe完成 非零退出值1
Error:Execution failed for task ':app:transformClassesWithDexForDebug'. com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
由于许多原因,发生了较高的错误.因此,我可以说明为什么会发生此错误,以及如何解决该错误.
The upper error occure due to lot of reason. So I can put why this error occure and how to solve it.
原因1:类文件名的重复
解决方案:
将某些类文件重构为库项目时.那时您要编写类文件的名称,因此,请仔细检查您是否没有重复的名称
when your refactoring of some of your class files to a library project. and that time you write name of class file So, double check that you do not have any duplicate names
原因2:当您有大量缓存时
解决方案:
有时候,如果您有大量的缓存,则会发生此错误,请解决.
转到File/Invalidate caches / Restart
,然后选择Invalidate and Restart
,它将清除您的缓存.
Sometime if you have lot of cache memory then this error occure so solve it.
go to File/Invalidate caches / Restart
then select Invalidate and Restart
it will clean your cache memory.
原因3::存在内部错误或使用Beta版本切换回稳定版本时.
REASON 3 : When there is internal bug or used beta Version to Switch back to stable version.
解决方案:
解决方案很简单,请转到构建"菜单,然后单击"Clean Project
",然后在清洁后单击"Rebuild Project
".
Solution is just simple go to Build menu and click Clean Project
and after cleaning click Rebuild Project
.
原因4::当系统内存不足时.
REASON 4 : When you memory of the system Configuration is low.
解决方案:
打开任务管理器并停止其他当时不常用的应用程序,以便释放空间并解决OutOfMemory
.
open Task Manager and stop the other application which are not most used at that time so it will free the space and solve OutOfMemory
.
原因5:问题是您的方法计数已超过65K.
REASON 5 : The problem is your method count has exceed from 65K.
解决方案:
打开您的项目build.gradle
文件添加
defaultConfig {
...
multiDexEnabled true
}
并在依赖项中添加以下行.
and in dependencies add below line.
dependencies
{
compile 'com.android.support:multidex:1.0.0'
}