Generating unsigned apk in Android Studio 2.1.1 - android

I'm trying to generate unsigned apk in AS 2.1.1. I had it working on 1.5.1 but right now I can't get it right.
Approaches tried:
signingConfigs {
unsigned {
keyAlias ''
keyPassword ''
storePassword ''
}
...
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.unsigned
debuggable false
}
...
}
Also another approach with not specifiying the signingConfig at all.
None of these work and both return with error.
Error:Execution failed for task ':app:validateUnsignedSigning'.
Keystore file not set for signing config unsigned
Generation is done by starting "assemble" task on whole project. Executing assemble task from the main module tasks tree produces the same result.
Build tools: buildToolsVersion '23.0.1'
Gradle: 'com.android.tools.build:gradle:2.0.0'
What am I missing?

To create unsigned apk set null as signingConfig:
buildTypes {
release {
signingConfig null
...
}
}

Related

Android docs and release key resulted in failure?

I can't seem to figure this out and adding --stacktrace was not much help. My build of android works fine until I modify this code
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
to have the following code(notice I add 1 line to buildTypes and a whole section above it (it is all in the typical android section)
signingConfigs {
release {
storeFile 'release.jks'
keyAlias 'myAlias'
keyPassword 'password'
storePassword 'password'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
I have tried signingConfigs and signingConfig both. using --stacktrace yields the caused by as
Caused by: groovy.lang.MissingMethodException: No signature of method: build_esgol9ch92dhm9du29nglcr2r.android() is applicable for argument types: (build_esgol9ch92dhm9du29nglcr2r$_run_closure2) values: [build_esgol9ch92dhm9du29nglcr2r$_run_closure2#96ce4db]
If I remove all contents of release section, it is interesting that I get the correct error ONLY when using signingConfigs (so I suspect signingConfigs is correct even though posts were correcting others on use singular over plural)...
* What went wrong:
Execution failed for task ':kds-android-studio:packageRelease'.
> A failure occurred while executing com.android.build.gradle.tasks.PackageAndroidArtifact$IncrementalSplitterRunnable
SigningConfig "release" is missing required property "storeFile".
As soon as I add another property it all fails with the very cryptic error.
Any ideas? or any ideas how to debug further?
Replace storeFile "file.jks" to storeFile file("file.jks")

React Native :app:validateSigningRelease FAILED

I'm trying to build my react native app using gradlew bundleRelease
But I get
Execution failed for task ':app:validateSigningRelease'.
Keystore file not set for signing config release
I've generated my-upload-key.keystore file, and edited ./android/gradle.properties
android.useAndroidX=true
android.enableJetifier=true
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=*****
MYAPP_RELEASE_KEY_PASSWORD=*****
And edited ./android/app/build.gradle
signingConfigs {
release {
if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
storeFile file(MYAPP_UPLOAD_STORE_FILE)
storePassword MYAPP_UPLOAD_STORE_PASSWORD
keyAlias MYAPP_UPLOAD_KEY_ALIAS
keyPassword MYAPP_UPLOAD_KEY_PASSWORD
}
}
}
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
But it isn't working. I'm using react-native 0.60
Your project variable refer to 'MYAPP_UPLOAD_STORE_FILE' but your gradle properties are named similar to MYAPP_RELEASE_STORE_FILE. Make sure the names match (UPLOAD vs RELEASE)

Generating Signed APK from Android Source Code without Android Studio

I have bought an android app source code from codecanyon. I want to generate android apk for distribution without android studio. Any alternative?
Reason:
I have some problem installing android studio in my pc which makes it impossible to use android studio.
You should specify signingConfigs and buildTypes in build.gradle's android block. For example:
android {
defaultConfig {
...
}
signingConfigs {
config {
keyAlias '...'
keyPassword '...'
storeFile file('../key.jks')
storePassword '...'
}
}
buildTypes {
debug {
useProguard false
minifyEnabled false
debuggable true
applicationIdSuffix '.debug'
}
release {
signingConfig signingConfigs.config
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
useProguard true
minifyEnabled true
debuggable false
shrinkResources true
}
}
}
Then from terminal or command prompt in root path of your project, run the following commands:
// To generate debug apk
gradlew assembleDebug
// To generate release apk
gradlew assembleRelease
yes you can do it in command line. see the tutorial from official site with this link

Android Studio keep asking for signing configuration though I already have for the release build APK

I have in my build.gradle:
android {
signingConfigs {
debug {
storeFile file("debug.keystore")
}
release {
try {
storeFile file("mykey.keystore")
storePassword "store_password"
keyAlias "myapp"
keyPassword "key_passowrd"
)
}
catch (ignored) {
throw new InvalidUserDataException("Something wrong")
}
}
}
buildTypes {
debug {
debuggable true
minifyEnabled false
versionNameSuffix '-DEBUG'
}
release {
debuggable false
minifyEnabled true
versionNameSuffix '-RELEASE'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
In build variant, I choose "release". Then, I run my app on connected device, however, Android Studio keep popping up dialog saying:
But I do have signing configuration...
In build output, I don't see that app-release.apk either :
Why I get the error then? My Android Studio version is 3.0.1
You forgot to provide a link to your signingConfigs:
buildTypes {
release {
signingConfig signingConfigs.release
...
}
debug {
signingConfig signingConfigs.debug
...
}
}
You forgot to specify which signing config should be used for build type
debug {
signingConfig signingConfigs.debug
}
Also signing config names should not (but may!) match build type names (eg you may define alpha and beta signing configs and use them as
debug {
signingConfig signingConfigs.alpha
}
By default gradle (android plugin) provides 'system' debug signing config so you may just skip it but it will be available (currently your build script overrides 'system' signing config

Android studio- adding signing configurations to gradle

I am very new to the android world and I was trying to just get to run a simple hello world app on my phone.
when I tried this I learnt that the APK generated by an android studio is an unsigned one. So to sign this I have gone through the process of creating a Key store and then a private Key, its alias and I was successful in signing the APK and installing on my phone and running it too.
Then I went through this link for adding signing configurations to the gradle to automatically sign the release with the newly created key store file.
I have followed the steps n the above link properly and did not miss anything but still when I finish my signing configurations I have an error saying
Gradle project sync failed.Basic functionality(eg. editing, debugging)
will not work properly.
Error:(19, 0) Could not find property 'config' on SigningConfig
container.
I was taken by a surprise! and now I am not able to sign my APKs manually too.
Now when I try to sign manually, it says the gradle is not in sync
I guess this file will be of help to help me solve this error. build.gradle of the project. I am trying to understand is what is mentioned here is same as the one I configured through the Android Studio UI while making the signing configurations.
apply plugin: 'com.android.application'
android {
signingConfigs {
release {
storeFile file("<path>\\firstKeystore.jks")
storePassword "******"
keyAlias "usual password"
keyPassword "******"
}
}
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId 'com.tech.vasanth.newsfeed'
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
debuggable false
jniDebugBuild false
renderscriptDebugBuild false
zipAlign true
}
debug {
signingConfig signingConfigs.config
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
There is a mistake in the buildTypes.release block. The signing config should be:
signingConfig signingConfigs.release
Note, that this is how you named the configuration in the signingConfigs block above.
Also leave out the signing config in the buildTypes.debug block (or, if you really want to have it, set it like above).
I have been using below configurations for Debug/Release.
signingConfigs {
release {
keyAlias 'keyAlias'
keyPassword 'keyPassword'
storePassword 'storePassword'
storeFile file("${rootDir}/keystores/app.keystore")
}
debug {
storeFile file("${rootDir}/keystores/debug.keystore")
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
While defining a release module:
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'other-rules.pro'
signingConfig signingConfigs.release
}
debug {
signingConfig signingConfigs.debug
}
}
Note: Here rootDir is your project root directory. Please store your keystore in mentioned directory.
structure of get a release is like this :
signingConfigs {
release {
storeFile file("release.keystore")
storePassword "******"
keyAlias "******"
keyPassword "******"
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
}

Categories

Resources