1、问题出现原因android studio中libs下加入了ant.jar
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 2
解决方式:
在build.gradle中添加
defaultConfig {
multiDexEnabled true
}
2、问题出现原因android studio中libs下加入了ant.jar运行程序,5.0系统正常,4.4系统运行报错如下
java.lang.NoClassDefFoundError: retrofit.BuiltInConverters
at retrofit.Retrofit$Builder.(Retrofit.java:290)
at com.jzg.jcpt.app.AppContext.initHttp(AppContext.java:173)
at com.jzg.jcpt.app.AppContext.onCreate(AppContext.java:127)
at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4394)
at android.app.ActivityThread.access$1600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1273)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5072)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
at dalvik.system.NativeStart.main(Native Method)
解决方式:
1、build.gradle中增加compile'com.android.support:multidex:1.0.0'
2、增加
defaultConfig {
multiDexEnabled true
}
3、Application中增加
@Override
protected void attachBaseContext(Context context){
super.attachBaseContext(context);
MultiDex.install(this);}
或者o'nCreate()中增加
3、错误原因Gradle版本太老
Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "fe895e69480f73242f848a0292c2a5feab8b7328"
解决方式:
在http://services.gradle.org/distributions下载最新的版本
4、错误原因Gradle DSL method not found: 'runProguard()'是因为runProguard方法已经过时
解决方式:
build.gradle文件中把runProguard替换成minifyEnabled
5、生成main方法
psvm快捷键TAB就可以生成main方法了