android studio: release apk is not signed

前端 未结 7 1981
误落风尘
误落风尘 2021-02-04 02:07

* I have rephrased the post since originally posted *

When I try to run a just-built release apk, I get an error \"the apk for your currently selected v

相关标签:
7条回答
  • 2021-02-04 02:36

    First, Create a keystore file if there isn't one.

    1. Click Build from the dropdown menu
    2. Select Generate Signed APK
    3. Click Next
    4. Click Create New Keystore
    5. Fill out the form for keystore path, alias, password for keystore and alias, at least one field in the certificate area.
    6. Click OK
    7. A keystore file will be created in the specified keystore path.

    Second update the app build gradle file to someting like this one to include the signing config.

    android {
        signingConfigs {
            config {
                keyAlias 'mykeyalias'
                keyPassword 'android'
                storeFile file('/Users/yourname/path/to/the/android/project/folder/android_project_folder_name/app/debug.keystore')
                storePassword 'android'
            }
        }
        buildTypes {
            debug {
                applicationIdSuffix = ".debug"
                versionNameSuffix "-debug"
            }
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
                signingConfig signingConfigs.config
            }
        }
    }
    

    Third, build and run the app, done.

    0 讨论(0)
提交回复
热议问题