1

added the errorTo release my application, I generated Signed APK ( Im using Android Studio). Signed APK was generated successfully. For key store path, I just created a folder in c>user>folder>name.keystore . I added an alias and password and successfully generated Signed APK. However, when I try to run my application on the emulator, I get the following error:

app-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog.

Is there a step i missed? I did some google search and found that developers edit gradle file too. However,I could not perform the step mostly because they were unclear. Here is what my build.gradle looks like: apply plugin: 'com.android.application'

android {
compileSdkVersion 20
buildToolsVersion "20.0.0"

defaultConfig {
    applicationId "com.app.shreyabisht.aethorr"
    minSdkVersion 15
    targetSdkVersion 20
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        runProguard false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:support-v4:20.0.+"
}

EDIT: I changed the build Variable to "release" and ran the " generate Signed APK" wizard again. The wizard ran successfully but I still get the same error when I run my application. Please suggest

shrbisht
  • 676
  • 3
  • 9
  • 23

2 Answers2

1

Did you check your build variant? Make sure it's set to debug if you want to run it on the emulator, and change it to release if you want to generate an apk.

Faced the problem myself and solved it this way.

yash.cr7
  • 70
  • 2
  • 8
0

You are using the wrong APK. Use the APK file at the root of your project folder for example:

app -> app.apk

Do not use the APK inside build -> outputs

If this doesn't resolve your problem (the build script might affect this, see http://developer.android.com/sdk/installing/studio-build.html) you can generate the signed APK and presuming you are using Android Studio (not sure about eclipse), once it is finished it should present you with a success dialog. This dialog should have an option for something like "Show In Folder". Select this option to view the signed APK you have just built in its relevant location.

Chris
  • 4,593
  • 1
  • 33
  • 37
  • In my androistudioproject>project>app>app-release.apk. Is this the apk that i should be using? @chris – shrbisht Dec 02 '14 at 10:04
  • I have added info to my answer. Let me know if you make any progress or have any problems. Have you tried the app-release.apk? It should work, the error you got was because you were using an unsigned apk – Chris Dec 02 '14 at 11:19
  • I have a few questions. 1. As you suggested, I wish to change the apk that I am signing. How can I do that ? 2. I think the problem is that i signed the wrong APK, now after I change the APK , I will have to go to build> Generate Signed APK again, right? 3. In the document you referenced, I came across this " signingConfigs { release { storeFile file("myreleasekey.keystore") storePassword "password" keyAlias "MyReleaseKey" keyPassword "password" } }" do i need to make these changes too after I have generated the signed APK? – shrbisht Dec 02 '14 at 12:57
  • Also, when I try to generate Signed APK, it asks me for a key store. I then go to create a key store path. Now what Im doing here is just putting a location/path . So my androidprojects are in a folder in C>user>androidprojects . Inside this folder,I have 3 projects that I have build. I select the project I am working on and app > and place the file "mykey.keystore" in there? I had generated this key in C>users>mykeyfolder. Should I go to generate APK and do the whole process again for the correct location (c>user>androidproject>project>app) or can i paste the keystore file here? – shrbisht Dec 02 '14 at 13:05
  • The good news is that you do not need all the complexity that is stated in the doc that I referenced, I merely included it as reference in case you find it useful. your gradle script is fine as is and dont need any other info. When you want to sign your app, you simply go build>generate signed APK as you have correctly stated. This apk should then be in app root folder as per my original post. hope that helps! – Chris Dec 02 '14 at 13:07
  • as for the keystore, you can use the one key to sign all your apps. Where you keep it on your pc is up to you and wont make a difference. you can simply select "Choose existing" if you dont want to create a new one for each project and then point to its location. just remember that once it is signed and published to the app store you need to keep this key safe as any future updates HAVE to be signed with the same key. – Chris Dec 02 '14 at 13:12
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66033/discussion-between-chris-and-shrbisht). – Chris Dec 02 '14 at 13:13
  • Thanks. So, Keystore path is good. The initial problem remains>> the error I get when I try to run the app. I understand now that Im using the wrong apk ( it says so in the error message) and uve kindly enlightened me that there is another apk on which I should be working. How do I change from this apk to the one thats in my app/ – shrbisht Dec 02 '14 at 13:30