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

来源:互联网 发布:西门子200plc编程电缆 编辑:程序博客网 时间:2024/06/05 04:42

报错的内容:

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 0