build.grade代码没有将versionCode更新为2

时间:2018-03-02 05:34:45

标签: android android-gradle

我的main或launcher模块的以下build.gradle代码没有将versionCode更新为2.当我尝试在Google Play中更新apk时,该网站告诉我上传的apk仍然是版本1.任何人都知道问题是什么是什么?我确实下载并修改了一些现有代码,所以我不知道所有的构建脚本。我不打算自动增加版本代码。在第24行我编码versionCode 2。

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}

apply plugin: 'com.android.application'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
         //Keep old ITEC package name as application Id for Play Store compatibility
//        applicationId 'at.aau.itec.android.mediaplayerdemo'
//        applicationId "com.gregmarsh.AndroidVideoCapture.VideoMetronome"
        applicationId "com.gregmarsh.AndroidVideoCapture.WCSDanceOnTimePro"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 2
        versionName '1.1'
//        versionCode 3
//        versionName "1.2"

//        //applicationId "com.exercise.com.exercise.AndroidVideoCapture.AndroidVideoCapture"
//        applicationId "com.gregmarsh.AndroidVideoCapture.VideoMetronome"
//        minSdkVersion 16
//        targetSdkVersion 22
//        // versionCode 1 Name "1.0" 10/28/2015 Initial release
//        // versionCode 2 Name "1.1" 1/4/2016 Recorded video listed in gallery
//        // versionCode 3 Name "1.2" 4/3/2016 Flash & beat sync adjusted, recording stops on phone call.
//        versionCode 3
//        versionName "1.2"

        buildConfigField "boolean", "CRASHLYTICS_CONFIGURED", "${isChrashlyticsConfigured()}"
    }

    signingConfigs {
        debug   // configured in signingconfig.gradle
        release // configured in signingconfig.gradle
    }

    buildTypes {
        debug {
            applicationIdSuffix ".debug"
            versionNameSuffix "-debug"
        }
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            signingConfig signingConfigs.release
        }
    }

    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            if (variant.name == android.buildTypes.release.name) {
                def file = output.outputFile
                def fileName = file.name.replace(".apk", "-" + defaultConfig.versionCode + "-" + defaultConfig.versionName + ".apk")
                output.outputFile = new File(file.parent, fileName)
            }
        }
    }

    lintOptions {
        // Lint fix for Okio: https://github.com/square/okio/issues/58
        warning 'InvalidPackage'
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':MediaPlayer')
    compile project(':MediaPlayer-DASH')
    compile('com.crashlytics.sdk.android:crashlytics:2.5.6@aar') {
        transitive = true;
    }
    compile 'com.android.support:appcompat-v7:22.2.1'
}

ext.isLibrary = false
apply from: "../gitversioning.gradle"
apply from: "signingconfig.gradle"

if (isChrashlyticsConfigured()) {
    apply plugin: 'io.fabric'
}

def isChrashlyticsConfigured() {
    return file("fabric.properties").exists()
}

0 个答案:

没有答案