I am trying to build a signed apk for Android platform using cordova.
I have already created unsigned apk using cordova --release android.
But i am unable to sign usejarsigner and zipalign.
kindly help.
I have already solved my problem.
I am explaining its steps for the people who are still stuck in it:
Create a unsigned apk.
Run this command cordova --release android after getting to the location of the project.
You can find the unsigned apk in
project_name\platforms\android\build\outputs\apk\android-release-unsigned.apk
Copy this apk and keystore tool in one folder.
Navigate to the folder and sign it using jarsigner present in java.
Run this command,
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystorename <Unsigned APK file> <Keystore Alias name>
After this you will be prompt to enter password of keystore.
Go to location of zipalign.
(it is present in Android\SDK\build-tools\version)
Run this command
zipalign -v 4 "location of signed apk" "location of aligned apk"
Related
I got 'App not installed as package appears to be invalid' message when trying to install my signed release app manually on Android 12. However, it can be installed in my other phones which are Android 9 and Android 6.
I use jarsigner to sign my apk :
$ jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore my-release-key.keystore <app-release-unsigned.apk's path> alias_name
And use zipalign to optimize :
$ zipalign -v 4 <path-to-same-apk-file> HelloWorld.apk
I've change my phone setting so that able to install unknown apk and tested with app-debug.apk and it works just fine. For more information, my app is written by using quasar framework and built by using cordova.
On Android 12, you have to use V2 signing scheme to sign your APK. Unfortunately, jarsigner is only v1 signing scheme.
In short, use apksigner to sign your APK in place or jarsigner, or if you use Android Studio, don't forget to check the "V2 signing" check box or define the signingConfig enabling v2 signing.
I've an app created using react native. I am trying to install the app on my device.But showing this error "app not installed -package appears to be corrupted".
What would be the reason? I've tried the following method to build apk.
gradlew assembleRelease.
FOLLOW THESE INSTRUCTIONS ....IT WORKED FOR ME
Prerequisite - You must have a keystore file, If you don't have then Open cmd run keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 follow instructions and you are done.You will have a keystore file. Now follow these steps.
1 .On windows cd android and then run gradlew assembleRelease
2 .Find APK at this location android/app/build/outputs/apk/release/app-release-unsigned.apk
3 .Copy this APK to bin folder of jdk installation directory ( for me directory was C:\Program Files\Java\jdk1.8.0_181\bin ) [ Basically in this step we are trying to go to the same directory as jarsigner]
4 .Also Copy your keystore file to this ( C:\Program Files\Java\jdk1.8.0_181\bin ) directory.
5 .Now Open cmd in Administrator mode and run cd C:\Program Files\Java\jdk1.8.0_181\bin
6 .Now run jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore
<<your keystore file name >> <<your apk file name>> alias_name
Here goes your apk , now find your signed apk here cd C:\Program Files\Java\jdk1.8.0_181\bin . Run it, Now it should install.
For me the reason that my phone already had a version of the app installed on it.
Once I remove the app - reinstall the apk it went smoothly.
This will help: - on Latest android studio
Go to Build-> Build Apk(s).
After creating apk you will see a dialog as below.
Click on locate and install it on your phone
I generated a apk file by running
meteor build ~/output-dir --server=myapp.meteor.com
,
then got release-unsigned.apk in the folder output-dir, it looks good.
I copy this apk file to my Android phone and tried to install it, after install guide, it shows message App not installed.
I have installed some apk files built by java on my phone before, it works, so is there something I need handle when I install apk file built by meteor?
As the documentation states, you can't install unsigned applications on your Android phone:
Android requires that all apps be digitally signed with a certificate
before they can be installed.
As far as I can tell, you have the following two options to run your app:
Use an emulator to run your unsigned app or
sign your app.
To sign your app, you can use the steps, described in the Meteor guide for submitting Android apps to the Play Store:
Generate a private key using the keytool (skip this step, in case you already have a private key generated):
keytool -genkey -alias your-app-name -keyalg RSA -keysize 2048 -validity 10000
Sign your app using the jarsigner tool:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 unaligned.apk your-app-name
After that, you should be able to install and run your application on your Android phone.
I'am trying to build the final release version of my app that using phonegap 3.0 and a few plugins. I have followed this answer on SO to link my keystore file to the app however I am not sure this is working.
Everything runs locally when I use phonegap run android.
Into myapp/platforms/android I have placed ant.properties
key.store=/Users/XXXXX/Desktop/keystore/my-release-key.keystore
key.alias=FishAppKey //I wasn't sure as it is suggested this can be whatever.
When I build my app instead of placing the .apk files into platforms/android/bin they are put into platforms/android/ant-build?
When I move into platforms/android and run ant release I get Build failed ...tools/ant/build.xml:698:null returned 1
Really I am trying to figure out how to go from phonegap run android to a apk file I can upload to google play.
As answer to your comment, you use jarsigner and pass the full path to your keystore in the -keystore argument. So let's say your keystore is on the desktop and named yourkeystore.keystore,
On Windows you would :
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore %userprofile%\Desktop\yourkeystore.keystore yourappname-release-unsigned.apk youraliasforthekeystore
On linux (and probably OSX also):
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore $HOME/Desktop/yourkeystore.keystore yourappname-release-unsigned.apk youraliasforthekeystore
And of course you can replace yourappname-release-unsigned.apk with the full path of your apk in case it's not in the current directory.
I have an apk file that I built using Adobe Phonegap Build. As described in this question, I have to modify the apk generated by Adobe Phonegap Build before uploading it to the Google Developer Console.
I can successfully edit the file, repack the apk, and "zipalign" it. However, I am stuck on signing it. Instructions I have come across on the web assume either that one is using Eclipse, or that one is on Windows. I am on Linux, I don't use Eclipse, and I am at the command line.
I understand that to sign my app I need to have signing keys on hand, but beyond that I am unclear on what commands I need and what the parameters are.
I was able to get the zipalign command from the Android SDK and run it as a standalone at the command line. I'm hoping that there is a similar way I can run a program at the command line to sign my app.
Is there a command I can use to sign my modified apk on the command line in Linux?
For this you use standard Java SE tools: jarsigner and keytool.
From Android documentation on signing:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
Remember that you should first sign and then align.