简体   繁体   中英

Android studio not generating unsinged apk

From my terminal if i run "gradle assemble" its only generating following apks. Any one please tell me how do i get default unsigned apk from android studio. I tried creating separate buildType for unsigned with empty keyStore but no use .

 - MyApp-debug-unaligned.apk
 - MyApp-debug.apk
 - MyApp-release-unaligned.apk
 - MyApp- release.apk

To generate an unsigned apk do the following:

define a signingConfig with empty configuations like this:

signingConfigs{
unsigned{
    storePassword = ""
    keyAlias = ""
    keyPassword = ""
}
}

define in the buildTypes for your release Version with the unsigned Configuration:

buildTypes{
release{
    signingConfig signingConfigs.unsigned
}
}

I get this from the adt-dev group, where Xavier Ducrohet write:

The current behavior is to check that the signing config is fully configured(*) and if it is, it generates a signed APK, otherwise an unsigned APK.

(*) fully configured right now means the value for store, alias and passwords are present, but does not include that the keystore is present. UPDATE 2013-12-19

As withoutclass mentioned this doesn't work with the gradle plugin version 0.6.3.

Anyway it's possible to generate an unsigned APK with gradle: just let the signingConfig entry of a flavor or buildType empty. It should look like this:

productFlavors{
// with this config you should get a "MyProject-flavorUnsigned-release-     unsigned.apk"
flavorUnsigned{
    versionCode = 9
    packageName defaultPkgName
}
}

buildTypes{
// with this config you should get a "MyProject-release-unsigned.apk"
release{
    packageNameSuffix '.release'
}
}

Answer here: Build Unsigned APK with Gradle

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