I'm using Android Studio,But zipalign it's not working for me while I package App via 'gradlew packageRelease'.I've verify the signature is ok by jarsigner.Here is my build.gradle.It's there any mistake?
android {
compileSdkVersion 17
buildToolsVersion "17.0.0"
defaultConfig {
minSdkVersion 8
targetSdkVersion 17
}
signingConfigs {
myConfig{
storeFile file("my.keystore")
storePassword "password"
keyAlias "alias"
keyPassword "password"
}
}
buildTypes{
release {
signingConfig signingConfigs.myConfig
runProguard true
proguardFile "proguard.cfg"
}
}
}
Check that Android Studio hasn't removed the ZipAlign file from the tools folder - it does "helpful" things like that when you change build versions (and got me when I upgraded then had to downgrade). If it has, you may be able to find it in an older version on your file-system.
zipalign is in ADT/sdk/build-tools/android4.4W Copy android4.4W folder and paste it in yourproject/platforms/android/build/outputs/apk
Now, copy yourkey.keystore and your project.apk and paste them into android4.4W full path yourproject/platforms/android/build/outputs/apk/android4.4W
then, $ zipalign -v 4 project.apk wowdone.apk. Thats all, hope this answer will help you.
Related
Android Studio signs an APK only when I go Build/Build Bundles Apks/Build APK. When the run button to automatically run it on the emulator is clicked the application is not signed. I have verified this by inspecting the application with adb pull from the emulator.
The following is the build gradle I have:
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
signingConfigs {
config {
keyAlias 'androiddebugkey'
keyPassword 'android'
storeFile file('/home/pc/.android/debug.keystore')
storePassword 'android'
}
}
defaultConfig {
applicationId "com.example.app"
minSdkVersion 21
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
custom {
signingConfig signingConfigs.config
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable true
}
}
}
I am choosing from the build variants the custom one I have created.
I havent touched this app for a while now but a similar project I had was working properly several months ago. Is there some update or something else that is causing this behavior? Am I missing something?
Android Version 3.6.1
Java Version = java-8-openjdk
I know the config is correct as the Build APK actually signs the APK
I know that the APK installed on the emulator when the button run is clicked does not contain the signature as i have inspected the META-INF directory of the apk. But i have also verified it by trying to print the signature programmatically.
According to Android user guide the run button should have the same result as the Build APK!
What could be the issue of the above and how to solve it?
I spent a considerable amount of time trying to solve this and I hope to save some time from anyone else facing this.
Go to Run/Edit Configurations
In the tab General in section Installation Options
In Deploy choose APK from app bundle
I have the following lines in my "project module" build.gradle (i.e. in /ProjectName/ProjectName/build.gradle):
android {
signingConfigs {
release {
keyAlias "mykeyalias"
keyPassword "mykeypassword"
storeFile file("/Users/MyUsername/Documents/AndroidStudio/android_keystore")
storePassword "mykeystorepassword"
}
}
compileSdkVersion 28
buildToolsVersion '28.0.2'
defaultConfig {
applicationId "com.example.mypackagename"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
signingConfig signingConfigs.release
}
...
Still, when I click Build->Generate signed APK..., I still have to enter everything manually. This used to work before, not sure when it broke. I have double- and triple checked the path to the keystore file.
Any ideas what could be wrong?
Because it's working as designed, i-e whenever you select to generate signed apk from Build->Generate Signed APK that wizard will always ask you to enter keystore information regardless of any configs being mentioned in gradle files ( although you can mark checkbox to remember that info for later use.)
If you don't want to mention keystore infomation while generating build, switch to release variant and just select Build->Build APK(s). It will generate release apk with the signing configs you have mentioned in your build.gradle file.
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
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.
I'm struggling with coming to terms with Andoid Studio after years working with Eclipse. I've imported an existing Eclipse simple project into AStudio 1.1.0 and altough it builds an APK
Directory of
C:\dev\projects\AndroidStudio\DiddyOsmdroid\TinyOsmdroid\build\out
puts\apk
25/02/2015 17:02 176,517 TinyOsmdroid-debug-unaligned.apk
25/02/2015 17:02 176,518 TinyOsmdroid-debug.apk
It doesn't deploy to a tablet connected via USB. (It did the first time I tried it, but not now) I've edited the run configurations to try both 'USB' and 'choose'. I try to deploy and run by double clicking assembleDebug as suggested in the docs. The device is visible in the Android window, in that Log lines are shown.
My gradle file looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 7
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "osmdemo.demo"
minSdkVersion 3
targetSdkVersion 3
}
signingConfigs {
release {
storeFile file("c:/users/me/some.keystore")
storePassword "xxxxxxxxxxx"
keyAlias "some_alias"
keyPassword "yyyyyy"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
signingConfig signingConfigs.release
}
}
}
dependencies {
compile files('libs/osmdroid-android-4.1.jar')
compile files('libs/slf4j-android-1.5.8.jar')
}
I'd be grateful to get any suggestions.
Gradle wont excute the app on the emulator/device. It will only build and install. You have to run an adb command to run the app. This is essentially what the Run button on Android Studio does for you.