Android Studio编译异常解决记录
2017-06-05 10:27
239 查看
1. Gradle Sync Issues
错误信息如下:
Error:Unable to find method ‘com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V’.
Possible causes for this unexpected error include:
Gradle’s dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
Re-download dependencies and sync project (requires network)
The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
Stop Gradle build processes (requires restart)
Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project.
In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
按错误提示,多次点击【Re-download dependencies and sync project (requires network)】发觉都无任何效果;点击【Stop Gradle build processes (requires restart)】,在Android Studio重启几次之后也无效果。
此时怀疑有可能是Gradle版本问题,查看该程序的Gradle版本为:
classpath 'com.android.tools.build:gradle:2.1.3'
查看本机发现并不包含此版本的Gradle,因此将其修改为本机已经下载的Gradle版本:
classpath 'com.android.tools.build:gradle:2.3.2'
重新编译,错误变成了:
该问题应该是因为本机没有安装appcompat-v7:25.3.1版本造成的,可采用如下两种解决方案:
①按照提示安装新版本的包;
②将该版本修改为本机已安装的包版本,如25.2.0;
经修改过后,程序可以编译通过,问题顺利解决。
相关文章推荐
- Android studio NDK 编译 "$USE_DEPRECATED_NDK=true" 异常问题解决
- android studio DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. >
- android studio DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. >
- android studio NDK使用,编译c生成.so实践记录
- 记录几种ubuntu下android编译错误解决方法
- android studio 提高编译的速度,安装apk过慢问题解决
- 转:AndroidStudio导入httpmime jar编译不通过的解决办法
- Android Studio编译时,adb报错的解决方法
- studio android.useDeprecatedNdk=true解决ndk提示版本低不能自动编译jni
- DEX 方法超过64K限制和gradle编译OOM问题解决,异常名:Error:Execution failed for task ':app:dexDebug'. > com.android.ide
- Android Studio 怎么添加使用第三方jar包及无法编译的问题解决方法
- android studio 子工程模块编译可以通过,运行时却找不道子工程包名解决
- android 编译错误记录(待解决)
- Android中NoClassDefFoundError异常解决记录
- android studio some file crunching failed,se logs for datails编译错误的解决办法
- Android Studio 问题解决记录
- Android studio编译之后显示中文乱码的问题解决办法
- Android Studio导入Fresco项目编译报错unable to expand TAR 'imagepipeline\build\downloads\libjpeg-turbo-1.3.1.tar.gz'解决
- android studio编译android M时无法使用org.apache.http.**的解决方法
- [异常解决] android studio检测不到手机的解决办法——ADB驱动自己安装