Android(安卓)Studio导入第三方库报错处理
16lz
2021-01-26
最近开始练习使用Android Studio开发Android应用,之前一直都是在使用eclipse.今天早上在使用studio导入第三方库的时候出现了问题直到现在才处理好,有必要记下来.
我要导入的库是PullToNextLayout,在GitHub上搜索名字就可以找到.
当导入成功后报的第一个错是:
Error:(3, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
这是因为在PullToNextLayout的build.gradle的plugin是这样的:
apply plugin: 'com.android.library'apply plugin: 'com.github.dcendents.android-maven'apply plugin: 'com.jfrog.bintray'
这个错误需要打开工程(就是最外层)的build.gradle,做如下修改:
dependencies { //其他的classpath配置 //下面这两行是需要添加的 classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' classpath 'com.github.dcendents:android-maven-plugin:1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files}
修改完成之后又出现了新的错误:
Error:Unable to load class 'org.gradle.api.publication.maven.internal.DefaultMavenFactory'.
我在stackoverflow上看到一种做法可以处理这个报错:
去设置的 Build, Execution, Deployment > Build Tools > Gradle
勾选Use default gradle wrapper (Recommended)
但是在我这里没有作用依然报错.
然后我又找到一篇贴子,顺利解决了这个问题:
最后把上面的代码改成:
dependencies { classpath 'com.android.tools.build:gradle:1.3.0' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files}
顺利解决问题
更多相关文章
- android 浏览器插件开发 - 流程(1)
- Andriod开发环境安装
- Linux(ubuntu11.10)下 配置android4.0.3开发环境零基础教程
- 个人自制unity插件"android动态权限自动申请"的用法
- 用Android(安卓)Studio在windows下面查看android源码
- Android高级开发教程实战视频
- android 接支付宝在4.1版本下报java.security.spec.InvalidKeySp
- android studio 代码插件常用code整理
- android studio 导入module作为lib使用