AndroidStudio编译出现Caused by: java.lang.ArrayIndexOutOfBoundsException: 4其中一种的原因
Caused by: java.lang.ArrayIndexOutOfBoundsException: 4 at com.android.tools.profiler.asm.ClassReader.a(Unknown Source) at com.android.tools.profiler.asm.ClassReader.a(Unknown Source) at com.android.tools.profiler.asm.ClassReader.a(Unknown Source) at com.android.tools.profiler.asm.ClassReader.b(Unknown Source) at com.android.tools.profiler.asm.ClassReader.accept(Unknown Source) at com.android.tools.profiler.asm.ClassReader.accept(Unknown Source)
编译出现上述问题,不妨往错误日志的上文继续跟踪。
我发现如下错误日志:
* What went wrong: Execution failed for task ‘:XXX:transformClassesWithProfilers-transformForZhaoDebug‘. > 4 * Try: Run with --debug option to get more log output. * Exception is: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:XXX:transformClassesWithProfilers-transformForZhaoDebug‘. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:63) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
如此可以发现是某个with profilers的配置错误造成的。
解决:
在AndroidStudio中Run/Debug Configurations取消勾选如下:
文章来自:http://www.cnblogs.com/laozhao1005/p/7489064.html