【问题标题】:Publishing AAR to maven将 AAR 发布到 maven
【发布时间】:2015-05-20 02:09:30
【问题描述】:

我正在将 aar 文件发布到 maven。我已成功上传所有内容,但是当我将库的依赖项添加到示例项目时,它没有来自我的项目的源文件。

这是我的库的 build.gradle

apply plugin: 'com.android.library'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

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

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    // Volley
    compile 'com.mcxiaoke.volley:library:1.0.14'
    // Gson
    compile 'com.google.code.gson:gson:2.3.1'
}

这是我的项目的 build.gradle

// Top-level build file where you can add configuration options common to all sub-projects/modules.
apply plugin: 'com.android.library'

buildscript {
    repositories {
        mavenCentral()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.1.2'

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

allprojects {
    repositories {
        mavenCentral()
        jcenter()
    }
}

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"
    sourceSets {
        main {
            manifest.srcFile 'app/src/main/AndroidManifest.xml'
            java.srcDirs = ['app/src/main/java/com/ebrick/TestSpot']
        }
    }
}
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    // Volley
    compile 'com.mcxiaoke.volley:library:1.0.14'
    // Gson
    compile 'com.google.code.gson:gson:2.3.1'
}

apply from: 'maven_push.gradle'

如果我从项目 build.gradle 中删除 sourceSet,则会出现错误 AndroidManifest.xml not found。

【问题讨论】:

    标签: android maven gradle android-library aar


    【解决方案1】:

    更改版本号解决了我的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-06-08
      • 2016-07-18
      • 2017-03-10
      • 2017-10-14
      • 2016-02-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多