GitHub上找到一个ViewPager项目,导入AndroidStudio一直报错Cause: org/gradle/api/publication/maven/internal/DefaultMa

报错的内容:

Error:(2, 0) Cause: org/gradle/api/publication/maven/internal/DefaultMavenFactory

<a href="openFile:C:\Users\Mr.young\Desktop\Android-ConvenientBanner-master\convenientbanner\build.gradle">Open File</a>


去网上搜了很多,大多是说引用库里的apply plugin: ‘android-maven‘ 有问题

1.引用库中除了android{...},  dependence{...},  apply plugin 其他全删掉,包括apply plugin: ‘android-maven‘ 这句

2.再把引用库和project里的build.gradle中compileSdkVersion、buildToolsVersion确认一致后,发现可以使用了

最后引用库中的build.gradle变成这样

apply plugin: 'com.android.library'
apply plugin: 'com.jfrog.bintray'

version = "1.0.9"//aar的版本

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        minSdkVersion 14
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile ('com.android.support:appcompat-v7:21.0.3')
}


project中的build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    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-plugin:1.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

 
参考资料:
http://www.bubuko.com/infodetail-1039660.html
还有一篇告诉我把引用库除了android{...},  dependence{...},  apply plugin 其他全删掉,地址找不到了

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值