简体   繁体   中英

why run the app directly in Android Studio,the result apk is unsigned

I have configured the signature in the buildType code block, but when I run the app directly in Android Studio, the obtained apk is still unsigned, and I cannot get the signature information in the apk. enter image description here My build.gradle:

signingConfigs {
    debug {
        storeFile file('G:\\source\\AndroidSamples\\DiyView\\hwj.jks')
        storePassword '123456'
        keyAlias 'key0'
        keyPassword '123456'
    }
    release {
        storeFile file('G:\\source\\AndroidSamples\\DiyView\\hwj.jks')
        storePassword '123456'
        keyAlias 'key0'
        keyPassword '123456'
    }
}
buildTypes {
    release {
        minifyEnabled false
        signingConfig signingConfigs.release
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
    debug {
        minifyEnabled false
        signingConfig signingConfigs.debug
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}

apksigner verify -v.\app-debug.apk DOES NOT VERIFY ERROR: Missing META-INF/MANIFEST.MF

Change the build variant to release.

Simplest way is:

  • double tap left shift key.
  • Write variants.
  • Click on build variants
  • Select release from the dropdown.

At this point, click on Play button again.

Android Studio will install a signed apk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM