Gradle不会将“apk”发布到远程存储库

时间:2015-06-17 12:16:24

标签: android maven gradle build.gradle

以下build.gradle忽略已定义的工件(apk文件)并尝试位于

中的publish个文件
  

构建/输出/ 映射 / release /

像:

  • 的mapping.txt
  • seeds.txt
  • unused.txt

我真正想要发布的是:

  

构建/输出/的 APK /myApp-release.apk

我得到的错误如下,但那是因为脚本正在查看上面的多个文件。

  

POM不能有多个具有相同类型和分类器的工件。已经有MavenArtifact myApp_Android:apk:apk:null,试图添加MavenArtifact myApp_Android:apk:apk:null。

我在这里缺少什么?

这是脚本:

apply plugin: 'com.android.application'
apply plugin: 'maven'

ext {
    destFile = file('build/outputs/apk/myApp-release.apk')
}

dependencies {
    provided 'com.amazon:amazonmaps:1.0.2'
    provided files('libs/maps.jar') //maps v1

    compile(
            'com.google.code.gson:gson:2.3',
            'com.jayway.android.robotium:robotium-solo:5.2.1',
            'com.google.android:play-services:4.0.30@aar',
            'com.android.support:appcompat-v7:19.1.0',
            'commons-codec:commons-codec:1.4.mm',
            'net.hockeyapp.android:HockeySDK:2.2.1',
            'com.db4o:db4o:8.0.224.15975-all:java5',
            'com.android.support:support-annotations:20.0.0'
    )
    compile(group: 'junit', name: 'junit', version: '4.11') {
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }

    debugCompile(
            project(path: ':company_core_library', configuration: 'debug')
    )
    debugCompile(group: 'junit', name: 'junit', version: '4.11') {
        exclude group: 'org.hamcrest', module: 'hamcrest-core'
    }

    releaseCompile(
            'com.company.mobile.core.android:Company_Core_Library:0.9.02:release@aar'
    )
}

android {
    compileSdkVersion 'Google Inc.:Google APIs:19'
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.company.mobile.myapp"
        versionCode 206
        versionName '2.3.0'
        minSdkVersion 16
        targetSdkVersion 19

        testApplicationId "com.company.mobile.myapp"
        testInstrumentationRunner "android.test.InstrumentationTestRunner"
    }

    signingConfigs {
        release {
            storeFile file('./keystores/company-android.keystore')
            storePassword(System.getenv('STORE_PASSWORD'))
            keyAlias(System.getenv('KEY_ALIAS'))
            keyPassword(System.getenv('KEY_PASSWORD'))
        }
    }

    lintOptions {
        checkReleaseBuilds false
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_7
        targetCompatibility JavaVersion.VERSION_1_7
    }

    buildTypes {
        release {
            signingConfig signingConfigs.release
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), './proguard/proguard-myApp.txt'
        }
    }
}

artifacts {
    archives file: destFile, name: 'myApp_Android', type: 'apk'
}

uploadArchives {
    repositories {
        mavenDeployer {
            pom.groupId = 'com.company.mobile.myapp.android'
            pom.version = android.defaultConfig.versionName + '.' + android.defaultConfig.versionCode

            repository(url: nexusReleases) {
                authentication(userName: repoUser, password: repoPassword)
            }
        }
    }
}

task release(dependsOn: [assembleRelease, uploadArchives]) {}

0 个答案:

没有答案