I need to generate an unsigned, release APK (where someone else will then sign it and release it to the store- with the someone else handling the keys and everything else). My problem is that Android Studio throws an error whenever I try to build:
app-flavorUnsigned-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog.
I've tried several, previous methods:
- Failed at creating an Artifact (can't find any menus with "Artifacts" anywhere, although for editing configurations I found the option to choose a custom Artifact) [Probably best bet]
- Creating an empty signing config
- Creating a custom flavor
- Using the terminal to run
gradle assemble
orgradle assembleRelease
(which fail due to one of my important module libraries trying to be built)
Here is my current [app's] build.gradle:
apply plugin: 'com.android.application'
android {
signingConfigs {
unsigned {
storePassword = ""
keyAlias = ""
keyPassword = ""
}
}
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "hiddenForClientPrivacy"
minSdkVersion 13
targetSdkVersion 20
versionCode 1
versionName "1.0"
signingConfig signingConfigs.unsigned
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.unsigned
}
unsignedBuild {
debuggable false
versionNameSuffix '-unsigned'
signingConfig signingConfigs.unsigned
}
debug {
}
}
productFlavors {
flavorUnsigned {
versionCode = 1;
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.0.0'
compile project(':SlidingMenu')
compile 'com.android.support:support-v13:20.0.0'
compile 'com.github.castorflex.verticalviewpager:library:19.0.1'
}
Thank you for any and all help.
Post-Help Edit: As the marked accepted answer shows, I had to clear out the release block. Furthermore, I was clicking on the "Run" button- which should appropriately show an error as I can't run an unsigned release apk on an emulator or device. The accepted answer describes everything.
In the release
build type, don't specify a signingConfig
at all, and your build won't be signed. Release builds don't pick up the default signing config that debug builds get, so it should work for those.
There's a discussion on the adt-dev mailing list about it.
Bear in mind that to build from Android Studio, you'll need to go to the Gradle tasks window and choose the assembleRelease
task; normal builds via "Make Project" don't actually build the final APK.
Actually you can build an unsigned .APK just by building it:
To generate it, on the left side of the Android Studio, there is a Build Variants menu (maybe written vertically). Click it.
The Build Variants window tab has appeared, click debug and change it by release.
Rebuild your project application > Build > Rebuild Project.
Then click Run, a new window has appeared, click Run > Continue anyway > Choose the device you want to run with > OK.
The application won't work on your device but the release build version, of your .apk, will be generated into the same directory as your debug ones:
- C:\ANDROID_PROJECT_DIRECTORY\app\build\outputs\apk\
You can note that the name is app-release-unsigned.apk and it was exactly what we wanted to have.
More information on this tutorial website.
来源:https://stackoverflow.com/questions/27321979/generating-unsigned-release-apk-with-android-studio