Installation failed since the APK was either not signed - android

I just upgraded my Android Studio from 1.5 to 2.2, and now when running my App I get the error:
Installation failed since the APK was either not signed, or signed
incorrectly. If this is a Gradle-based project, then make sure the
signing configuration is specified in the Gradle build script.
I already googled for it, and nothing worked for me, my gradle file is:
...
android {
signingConfigs {
myapp_signed {
keyAlias 'mkey'
keyPassword 'pwd'
storeFile file('.../_keystore.jks')
storePassword 'pwd'
}
}
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId '...'
minSdkVersion 14
targetSdkVersion 22
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.myapp_signed
}
}
productFlavors {
}
}
...
Does anybody know how to solve this? Right before I got this error, I got another error, which was saying:
Warning:Gradle version 2.10 is required. Current version is 2.2. If
using the gradle wrapper, try editing the distributionUrl in
C:\Users\blahblah\myproject\gradle\wrapper\gradle-wrapper.properties
to gradle-2.10-all.zip
which I solved like this "Gradle Version 2.10 is required." Error
EDIT:
Even if I switch build variants back to debug, uninstall the app and try it again I get the same error.

For me the solution was, to update all the libraries I used and update to Android 23.
Maybe this helps somebody.

By default, Android Studio 2.2 and the Android Plugin for Gradle 2.2 sign your app with Signature Scheme v2. add v2SigningEnabled false to signingConfigs may solve your problem.
signingConfigs {
release {
storeFile file("myreleasekey.keystore")
storePassword "password"
keyAlias "MyReleaseKey"
keyPassword "password"
v2SigningEnabled false
}
}
ref. https://developer.android.com/preview/api-overview.html#apk_signature_v2

For reference, my signing configs look like this - not my real passwords :
signingConfigs {
release {
storeFile file("keystore/release.jks")
keyAlias "release"
storePassword "storepass"
keyPassword "keypass
}
debug {
storeFile file("keystore/debug.jks")
keyAlias "androiddebugkey"
storePassword "android"
keyPassword "android"
}
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
signingConfig signingConfigs.release
}
debug {
minifyEnabled true
zipAlignEnabled true
signingConfig signingConfigs.debug
}
}

Did you try to generate a new keystore to use?
In my case, my old keystore file is not working anymore after I upgrade from gradle build tools 1.5.0 to 2.1.0
It surprise me when I try it out...

Apparently the issue is bug us with downgrading gradle to version 2.1.0
classpath 'com.android.tools.build:gradle:2.1.0'

if you still get this error even in debug mode then just Clean your project and Run again. That worked out for me
P.S: I am using Android 2.2 Beta

Related

How can I sign testing apk in Android Studio?

I am developing an app in such an android device that requires each app to be signed with a specific key, even the testing apk.
I know how to sign an app by configuring build.gradle. But signing testing app (Instrumentation test) seems no such configing, am I missing something ?
try this in build.gradle
signingConfigs {
release {
keyPassword 'your pw'
storeFile file('your keystore file path')
storePassword 'your pw'
keyAlias 'your alias'
}
}
buildTypes {
release {
signingConfig signingConfigs.release
}
debug {
minifyEnabled false
signingConfig signingConfigs.release
}
}
Thanks for NateZh and TWL.
Yes, the answer is to add flowing lines to build.gradle:
signingConfigs {
debug {
keyPassword 'your pw'
storeFile file('your keystore file path')
storePassword 'your pw'
keyAlias 'your alias'
}
}
But, there are more to be take care of:
When using signingConfigs.debug, this tells gradle it's debug key, no need to specific buildTypes.debug.signingConfig again
SigingConfigs.debug also take effect when building instrumentation test
In multi-modules project, if you want to test a module, you should include signingConfigs.debug in the module's build.gradle.
For example, my project looks like:
app
-build.gradle
libs
-src/androidTest/java/com/my/MyTest.java
-build.gradle
Adding signingConfigs.debug to app has no effect when I want to run libs' AndroidDebugTest. Instead, adding signingConfigs.debug to libs' build.gradle do the work.
Hope it's helpful to others.

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
}
}

INSTALL_PARSE_FAILED_NO_CERTIFICATES with OWN .apk

Since I updated my Android Studio, I cant install my App anymore, neither in the debug nor in the release mode.
I always get the error:
pkg: /data/local/tmp/com.myappdomain.mypp
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Installation failed since the APK was either not signed, or signed incorrectly.
If this is a Gradle-based project, then make sure the signing configuration is specified in the Gradle build script.
Error while Installing APK
From what I googled, this just happens when trying to install unsigned third party .apk
This is my own App though, signed with Android Studio
Gradle looks like this:
android {
signingConfigs {
release {
storeFile file("...")
keyAlias "..."
storePassword "..."
keyPassword "..."
}
}
buildTypes {
release {
minifyEnabled true
zipAlignEnabled true
signingConfig signingConfigs.release
}
}
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId '...'
minSdkVersion 14
targetSdkVersion 22
}
productFlavors {
}
}
I solved it by updating the target SDK to 23 and updating all my used libraries. Maybe it helps you too.

signingConfig.storeFile does not exist when I try to run the project

I downloaded a project from GitHub and opened it by Android Studio. All required build tools and Android support repositories were automatically downloaded through Android Studio.
https://github.com/DrKLO/Telegram
Now that I try to run the project, I get an error in Massages.
Error:A problem was found with the configuration of task ':TMessagesProj:packageDebug'.
> File 'G:\AndroidDev\AndroidStudioProjects\Telegram-master\TMessagesProj\config\release.keystore' specified for property 'signingConfig.storeFile' does not exist.
I found some other threads on Stack Exchange:
Gradle signing app with packageRelease “specified for property 'signingConfig.storeFile' does not exist”
Android specified for property 'signingConfig.storeFile' does not exist
and I created the keystores as they suggested, but I'm still getting that error when I click the run button. They seem to be different from mine.
I also generated the signed APK and when I tried to install it on a device, the program crashed and stopped and I guess it might be caused by the mentioned problem.
I'm sure it should work correctly because it's the official source of Telegram messenger. https://github.com/DrKLO/Telegram
In case you need the file build.gradle:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:support-v4:23.1.+'
compile 'com.google.android.gms:play-services:3.2.+'
compile 'net.hockeyapp.android:HockeySDK:3.6.+'
compile 'com.googlecode.mp4parser:isoparser:1.0.+'
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.2'
useLibrary 'org.apache.http.legacy'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
signingConfigs {
debug {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
release {
storeFile file("config/release.keystore")
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
debug {
debuggable true
jniDebuggable true
signingConfig signingConfigs.debug
applicationIdSuffix ".beta"
}
release {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
}
foss {
debuggable false
jniDebuggable false
signingConfig signingConfigs.release
}
}
sourceSets.main {
jniLibs.srcDir 'libs'
jni.srcDirs = [] //disable automatic ndk-build call
}
sourceSets.debug {
manifest.srcFile 'config/debug/AndroidManifest.xml'
}
sourceSets.release {
manifest.srcFile 'config/release/AndroidManifest.xml'
}
sourceSets.foss {
manifest.srcFile 'config/foss/AndroidManifest.xml'
}
defaultConfig {
minSdkVersion 8
targetSdkVersion 23
versionCode 695
versionName "3.3.2"
}
}
your problem is: the Android Studio is searching for a key file that you told it should be there... but isn't.
Where you told Android Studio the file would be there?
storeFile file("config/release.keystore")
How to create this missing file?
https://developer.android.com/studio/publish/app-signing.html
if you already have the keystore created check if it's on the right place, generally I use a folder called 'keystore' instead of 'config', much more intuitive when you browse searching for it ;)
storeFile rootProject.file("keystore/release.keystore")
1) check if storeFile exists at the path G:\AndroidDev\AndroidStudioProjects\Telegram-master\TMessagesProj\config\release‌​.keystore
2) if not - rename / move your keystore file there or change the path to your keystore file location.
It should work now. If you have a build problem while concerning native code try this topic
Android Telegram App --> java.lang.UnsatisfiedLinkError: No implementation found for void
To generate the key-store, got to Build > Generate Signed APK and click on New Key Store, now rename the generated file to release.keystore and move it to TMessagesProj/config.
Android Studio generates .jks files. Just rename it from release.jks to release.keystore. The build will then succeed.

Error building Android app in release mode, in Android Studio

I'm trying to sign my android app in release mode, in Android Studio.
I followed this official guide. So I have created the keystore and a private key. Then I tried to Generate the Signed APK, from Build -> Generate Signed API Key. But the build fails, with the following error:
:app:packageRelease FAILED
Error:A problem was found with the configuration of task ':app:packageRelease'.
> File 'C:\Documents\myapp\android.jks' specified for property 'signingConfig.storeFile' does not exist.
I have also checked the build.gradle configuration. And I have found this:
signingConfigs {
releaseConfig {
keyAlias 'xxxxxxxxxx'
keyPassword 'xxxxxxxxx'
storeFile file('C:\Documents\myapp\android.jks')
storePassword 'xxxxxxxxx'
}
}
but in the same gradle file I have this:
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.releaseConfig
}
}
What's wrong?
Replace \ by \\:
storeFile file('C:\\Documents\\myapp\\android.jks')
I have solved the problem, simply moving the keystore inside the base path of my android project.
Place the keystore file in app folder of that project, and replace with following
storeFile file('android.jks')

Categories

Resources