我的Android进阶之旅------>解决Error:Unable to find method 'org.gradle.api.internal.project.ProjectInternal.g
今天在Github上面下载了一份代码,然后导入到Android Studio中直接报了如下图所示的错误:
Error: Unable to find method ‘org.gradle.api.internal.project.ProjectInternal.getPluginManager()Lorg/gradle/api/internal/plugins/PluginManagerInternal;’.
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】选项,发现怎么重新尝试还是无效果。如果点击【Stop Gradle build processes (requires restart)】选项,则直接退出了Android Studio,重启后还是无效。
最后我把该Github上面下载下来的代码和我已经运行正常的代码做对比,发现有两个地方的代码有很大的差异:
因为gradle版本为1.2.3我电脑上没有下载,因此我将gradle版本改为我目前Android Studio中所使用的gradle版本2.2.0-alpha4’,代码如下:
classpath com.android.tools.build:gradle:2.2.0-alpha4 // classpath com.android.tools.build:gradle:1.2.3
发现了项目工程文件目录gradle\wrapper里面找到gradle-wrapper.properties里面的内容不同。
位置如下图所示:
修改里面的值:将distributionUrl=https://services.gradle.org/distributions/gradle-2.2-all.zip改为distributionUrl=https://services.gradle.org/distributions/gradle-2.10-all.zip 。如下所示:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
改为:
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
修改后如下图所示:
zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
修改完之后,再重新编译即可。编译成功后,如下图所示:
Android | 音视频方向进阶路线及资源合集 但是系统相机和系统控件VideoView的局限性都是可定制型太差,系统相机的图像分辨率,视频码率以及VideoView的进度条等.
字节卷动 You will never know how excellent you are unless you impel yourself once.
相关文章
- 我的Android进阶之旅------>怎样将Activity变为半透明的对话框?
- Eclipse出现"Running Android Lint has encountered a problem"解决方式
- Android逆向之旅---破解"穿靴子的猫"游戏的收费功能
- Android源代码解析之(四)-->HandlerThread
- Android应用程序无法读写USB设备的解决方法
- Glide-Android下高效加载多媒体文件
- Android源代码解析之(三)-->异步任务AsyncTask
- Android 中布局设置导致的TextView不显示的问题
- Android入门之简单拨号器
- 了解与建设有中国特色的Android M&N(Android6.0和7.0新特性分析)
- Android原生控件 -- ProgressBar(进度加载) & ProgressDialog(进度展示对话框)
- Android Application的Gradle说明
- Android运行时异常“Binary XML file line # : Error inflating class”
- 一步一步学android控件(之十五) —— DegitalClock & AnalogClock
- Eclipse打包Android项目时用到proguard.cfg后,出现的Warning:can't find referenced class问题的解决方式
- Android Api Demos登顶之路(四十五)Loader-->Cursor
- ERROR: In <declare-styleable> MenuView, unable to find attribute android:preserveIconSpacing
- 【Android学习】系统架构&组件