Home > Mobile >  How to fix gradle: No signature
How to fix gradle: No signature

Time:10-18

I have an android project causing a no signature of method, after some research this seems to come from

android {
    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    compileSdkVersion 30
    buildToolsVersion '31.0.0'
    defaultConfig {
        applicationId 'ch.workouttracker'
        minSdkVersion 24
        targetSdkVersion 30
        versionCode 0.901
        versionName '0.9.0.1'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        resConfigs "de" // And any other languages you support
    }

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

    packagingOptions{
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/LICENSE-FIREBASE.txt'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/DEPENDENCIES'

    }
    defaultConfig {
        vectorDrawables.useSupportLibrary = true

    }
    productFlavors {
    }
    compileOptions {
        sourceCompatibility VERSION_11
        targetCompatibility VERSION_11
    }
}

What is wrong or missinhg in this configuration? I guess it most be something with the versions, as i changed them

CodePudding user response:

I think that problem is with your VersionCode inside that Gradle file. You have this:

    versionCode 0.901
    versionName '0.9.0.1'

Thing is that versionCode can only be a positive INTEGER and not a number with decimal places. This comes from documentation

versionCode — A positive integer used as an internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName setting, below. The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.

So just change this to 1. You can change your versionName, but every future release will have 1 on versionCode. So versionCode will be 2 and versionName '0.9.0.2' etc.

  • Related