我的库未检测到其gradle文件中提到的外部依赖项

时间:2018-07-05 11:01:30

标签: java android android-studio gradle

我已经创建了一个库,当我导入它时,gradle文件中提到的外部依赖项并没有被检测到,例如recyclerview,cameraview等。该库已经上传到jitpack且未检测到正在构建的外部依赖项摇动 这是我的图书馆构建奖章

apply plugin:  'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
group='com.github.r00786'
ext {
    PUBLISH_GROUP_ID = 'com.github'
    PUBLISH_ARTIFACT_ID = 'r00786'
    PUBLISH_VERSION = '1.8'
}

android {
    compileSdkVersion 27
    defaultConfig {

        minSdkVersion 15
        targetSdkVersion 27
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {

        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.android.support:support-v4:27.1.1'
    testImplementation 'junit:junit:4.12'
    implementation 'com.wonderkiln:camerakit:0.13.1'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
     implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    api("com.github.bumptech.glide:glide:4.6.1") {
        exclude group: "com.android.support"
    }



}


// build a jar with source files
task sourcesJar(type: Jar) {
    from android.sourceSets.main.java.srcDirs
    classifier = 'sources'
}

task javadoc(type: Javadoc) {
    failOnError  false
    source = android.sourceSets.main.java.sourceFiles
    classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
    classpath += configurations.compile
}

// build a jar with javadoc
task javadocJar(type: Jar, dependsOn: javadoc) {
    classifier = 'javadoc'
    from javadoc.destinationDir
}

artifacts {
    archives sourcesJar
    archives javadocJar
}



// Top-level build file where you can add configuration options common to all sub-projects/modules.

//项目级构建gradle

buildscript {

    repositories {
        google()
        jcenter()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.2'
        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

1 个答案:

答案 0 :(得分:1)

这是Maven插件1.5版的错误 使其2.0可以正常工作

  classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'