Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installation failed with Android Studio, APK not signed

Tags:

android

gradle

Recently change to Android Studio from Eclipse and I have also changed the JDK from java-open-jdk to jdk1.7.0_45.

Now I'm trying to run my first app and I get this message:

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

Edit:

When I'm running from Android Studio I get the error displayed above. When I'm running it from the command line I don't get an error (well the app is running and I get an error but nothing to do with gradle).

I got the code from here

You can check build.gradle here at google repo

UPDATE 2:

I added this code

signingConfigs {
    release {
        storeFile file("john.keystore")
        storePassword "john"
        keyAlias "johnkeystore"
        keyPassword "john"
    }
}

just above the buildTypes code block in the build.gradle file. File john.keystore is on the root of my Project. I'm running gradlew assembleRelease and I'm getting a xxx-release-unsigned.apk.

like image 802
mt0s Avatar asked Oct 26 '13 22:10

mt0s


1 Answers

If you indeed runing build with gradle you need to configure signingConfigs. Android can configure your debug signingConfig automatically. You can make release signingConfig in a next manner:

android {

    signingConfigs {

        release {

            storeFile file('android.keystore')
            storePassword "pwd"
            keyAlias "alias"
            keyPassword "pwd"
        }
    }

    buildTypes {

       release {

           signingConfig signingConfigs.release
       }
    }
}

Check manual on this topic here: http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Signing-Configurations

If you still have issues, please update question with your build.gradle. Most likely issue is laying here. I'm using JDK 1.7 and gradle builds are working fine.

like image 78
Sergii Pechenizkyi Avatar answered Oct 05 '22 20:10

Sergii Pechenizkyi