3

I used to generate a signed apk from Android Studio and everything was working well until I updated Android Studio to 3.3. It generates an apk but after I try to install it, it says: App Not Installed!

My Trial was by:

  1. Click on build
  2. Generate Signed Apk
  3. Choose APK and click Next
  4. Insert the Key Store Path, Key Store Password, Key Alias, Key Password
  5. Click Next
  6. Choose Release Variant
  7. Click Finish

The Apk is generated but it's not signed! What is the problem ?

This is after trying to upload to beta

Here is my app build.gradle

buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    useLibrary 'org.apache.http.legacy'
    compileSdkVersion 27
    defaultConfig {
        applicationId "com.twobreathe.soft2breathe"
        minSdkVersion 23
        targetSdkVersion 27
        versionCode 9
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        externalNativeBuild {
            cmake {
                cppFlags ""
            }
        }
        vectorDrawables {
            useSupportLibrary true
        }
        resConfigs "en", "ja"
    }
    signingConfigs {
        release {
            keyAlias "[my key alias]"
            keyPassword "[my key password]"
            storeFile file("[path to the keystore file]")
            storePassword "[my store password]"
        }
    }

    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            shrinkResources true
            pseudoLocalesEnabled false
        }

        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            debuggable true
        }


    }
    externalNativeBuild {
        cmake {
            path "src/main/cpp/fluidsynth/android/CMakeLists.txt"
        }
    }
    lintOptions {
        checkReleaseBuilds false
        abortOnError false
    }
    dataBinding {
        enabled true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildToolsVersion '28.0.3'
    productFlavors {
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.github.parse-community.Parse-SDK-Android:parse:1.18.4'
    implementation 'com.jjoe64:graphview:4.2.2'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    testImplementation 'junit:junit:4.12'
    implementation 'com.orhanobut:hawk:2.0.1'
    implementation 'xyz.sahildave:arclayout:1.0.0'
    implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    implementation 'com.github.GrenderG:Toasty:1.3.0'
    implementation 'com.kyleduo.switchbutton:library:2.0.0'
    implementation 'com.github.franmontiel:LocaleChanger:0.9.2'
    implementation 'cn.aigestudio.wheelpicker:WheelPicker:1.1.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
}
Khalid Taha
  • 2,727
  • 2
  • 24
  • 40
  • are you sure that it is not signed? Probably you just have the same version of APK already installed? (e.g. you forgot to increase versionCode)? – Vladyslav Matviienko Jan 28 '19 at 09:49
  • Android Studio told me that it's not signed when trying to install a release apk, also when trying to upload the apk to crashlytics, it says that this apk is not signed and can't be uploaded. – Khalid Taha Jan 28 '19 at 09:51
  • Please share your app.gradle file for clear idea where you are getting stuck – Deep Patel Jan 28 '19 at 10:28
  • I was facing same issue, android studio 3.3 was using different keystore with the one I was selecting. It seems a bug. What I did was move the keystore to other location and tried generating the apk. At first It gives error that file not found meaning it was fetching keystore from same location (maybe cache), so I restart the android studio and in second time it generated correct apk when I select the actual keystore. – Firu Jan 28 '19 at 10:33
  • please share your gradle file for clear idea and solution – Deep Patel Jan 31 '19 at 12:36
  • @DeepPatel I did update my question I attached the gradle file. – Khalid Taha Jan 31 '19 at 12:39
  • @KhalidTaha Does disabling debugging in your release build fix the issue? Fabric may just be displaying a slightly incorrect error. – Jake Lee Jan 31 '19 at 12:42
  • @KhalidTaha : Please check my answer and follow the steps and try once. – Deep Patel Jan 31 '19 at 12:45
  • 1
    If I'm not mistaken, it looks like your release buildType doesn't specify a signingConfig to use during the build. – Harvtronix Feb 02 '19 at 05:23
  • Try this Turn off the Instant Run and then clean the project and try again to rebuild project and generate sign apk – Amjad Khan Feb 05 '19 at 07:07

7 Answers7

5

After updating to 3.3, many problems are occuring related to signing an APK. Sometime it doesn't sign the apk and sometime it says the key is not private.

Well i also faced this problem after upgrading to android studio 3.3 and i resolved in 3 steps. But firstly make sure you backup your whole project.

  1. In Android Studio goto File > Project Structure and untick from "use embedded JDK" then click OK
  2. Goto Computer Settings (system settings) (win + pause key) then go to Advanced system settings>Environment variables. if JAVA_HOME not present then add it and set path to your installed JDK.
    As i couldn't find a direct approach to modify jdk path in my project that is upgraded in some way to android studio 3.3 settings, i did following(for the last step) BUT MAKE SURE YOU MAKE BACKUP BEFORE THIS.
  3. To make sure where i am guiding come to project view, I deleted ".grade", ".idea", "capture", "gradle" folders from the root and "build", "release", "lib" folder from "app" leaving "src" as it is. Deleted root.iml and did not delete app.iml file Then rebuild the project and then created the Signed package.

It went successful after 2 try. To be very honest i did the last step twice by restoring files from backup. As deleting these folders i messed up 1 time.

Vanshaj Daga
  • 1,924
  • 9
  • 17
2

Not strictly related, but I ended up in this questions when searching for a fix to my problem. In my case I forgot to remove 'debuggable true' for one of my non-debug built-types. When I was generating the bundle the google play store wouldn't complain about it just said that it wasn't signed. But when I tried uploading an apk it showed the true error.

1

From your Gradle its visible that you have not configured your Signing Config with it.

Please check image below:

enter image description here

Step 1:

Go to your project settings > select your module (Let's say "app") > go to signing > enter proper information and keystore.jks file

Step 2:

Go to Build Types > select Release type > assign signing config as you created on step 1. > after that your gradle will have config as there in image.

Step 3:

Try generating signed APK.

It will be success!!!

Happy Coding..

Deep Patel
  • 2,258
  • 2
  • 12
  • 26
  • 1
    He said he entered these in step 4, they do not have to be defined in the gradle files. – Jake Lee Jan 31 '19 at 12:46
  • He has entered these in step 4 but still if there is no mention in gradle file, it will show error like this. I recently had faced such issue, so that I asked for gradle to make sure he is facing the same or not. – Deep Patel Jan 31 '19 at 12:49
  • I removed them recently, it was not working even if they are existing. – Khalid Taha Jan 31 '19 at 12:54
  • I did add them now and it's not working also. sorry to say that but I'm stuck in this issue from 3 days. – Khalid Taha Jan 31 '19 at 12:55
  • Is there any clever way to avoid committing the store password and key password to Git version control while still committing build.gradle? – OscarVanL Jan 14 '21 at 01:37
0

Double check both of the values on the final dialog, labelled by "Signature Versions". For more information please check the following link: https://developer.android.com/about/versions/nougat/android-7.0#apk_signature_v2

Anyway this question seems duplicate as the following: android studio: release apk is not signed

Mohammed
  • 126
  • 7
  • I did. but the generated apk is not signed. – Khalid Taha Jan 28 '19 at 09:52
  • Make sure the Key-Alias are not different. Are you able to sign your APK with the same Key and Alias with the previous Android Studio now? If so, double check your Build-Tools. – Mohammed Jan 28 '19 at 09:54
  • Actually, I'm sure that your APK is not signed when you raised your question, so the screenshot doesn't provide any further information. – Mohammed Jan 28 '19 at 09:58
  • Anyhow, your key-alias could be wrong, and then just check your build-tools and try signing your APK using Android Studio 3.2 to see if the problem exists. – Mohammed Jan 28 '19 at 09:59
  • When the key-alias is wrong, the apk will not be generated at all. – Khalid Taha Jan 28 '19 at 10:02
  • check out my updated answer and that similar question to yours. – Mohammed Jan 28 '19 at 10:02
  • @KhalidTaha it's not about being wrong, a key alias must include an organisation name, also you might add another one to your key accidentally. – Mohammed Jan 28 '19 at 10:03
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/187481/discussion-between-khalid-taha-and-mohammed). – Khalid Taha Jan 29 '19 at 10:05
0

friend when you go for build the signed apk now in android studio 3.3 , you will 2 option for build the signed apk. 1. Android App Bundle 2.APK

i will suggest to use option 2

select option 2 and Click on Next button now studio ask for your password details now fill all details and select Remember password checkbox for feature and now next . now again studio ask for debug and release build confirmation now here select release and select 2 checkbox at bottom and then continue

hope your signed apk will be generate .

Imran khan
  • 79
  • 1
  • 12
0

When generating an APK, make sure both the signature types are checked, otherwise Fabric (and other places) may not recognise it as signed.

Additionally you probably want to remove debuggable true from your release config, as debuggable builds can't be uploaded to Google Play. There's a chance this is also causing an issue.

signing options

Jake Lee
  • 5,837
  • 7
  • 39
  • 73
0

Try to sign it using command-line tools. I may help you to identify the problem. (https://developer.android.com/studio/build/building-cmdline).

In my case, it was JAVA_HOME problem (as in @Vanshaj Daga answer).

Mark Kahn
  • 950
  • 9
  • 8