最近开始练习使用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)

    但是在我这里没有作用依然报错.

    然后我又找到一篇贴子,顺利解决了这个问题:

              当你使用的Gradle版本是2.4以上,Android插件版本是1.3.0以上的时候就会出现这个问题,这时候你只需将android-maven-gradle-plugin插件版本改为 classpath ‘com.github.dcendents:android-maven-gradle-plugin:1.3’ 即可
        最后把上面的代码改成:
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}
    顺利解决问题


更多相关文章

  1. android 浏览器插件开发 - 流程(1)
  2. Andriod开发环境安装
  3. Linux(ubuntu11.10)下 配置android4.0.3开发环境零基础教程
  4. 个人自制unity插件"android动态权限自动申请"的用法
  5. 用Android(安卓)Studio在windows下面查看android源码
  6. Android高级开发教程实战视频
  7. android 接支付宝在4.1版本下报java.security.spec.InvalidKeySp
  8. android studio 代码插件常用code整理
  9. android studio 导入module作为lib使用

随机推荐

  1. 2011.09.26(4)——— android sample之Note
  2. Android 2.1 源码结构分析
  3. 什么是Android内核
  4. Android之从Browser中打开本地的应用程序
  5. 在Flutter启动Android的后台服务
  6. Android 开发问题集合
  7. android-map-key获取
  8. Android近百个项目的源代码
  9. Android之---Android Studio开发最NB(牛逼
  10. 使用多状态按钮ToggleButton