can't install the rebuild app after signed using jarsign - android

After I got a signed result I tried to install the .apk file, what failed (output)
I deployed the .apk file
apktool d x.apk
then made some chagnes and rebuild the .apk using
apktool b x.app
I've download root.crt and class3.crt and updated the ca-certificate
created the ca-certificate on my name and use the ca-certificate to signed the .apk
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my_release_key.keystore /root/home/Desktop/x/dist/x.apk john_release_key
I have installed jdk and jre version 1.8.0_121
But the .apk file wasn't installed.
how to go through the problem?

Related

App not installed package appears to be corrupted

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

Generated signed Android APK (Cordova)

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"

Publishing / releasing android app using phonegap

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.

Can't recompile working APK with APKtool

I decompiled an APK using APKTool 2.0 Beta 9 and then rebuilt all without doing changes to the sources.
Then I rebuilt the APK using this command:
java -jar apktool.jar build myfolder myapk.apk
But I cannot install the generated APK file on my phone. It tells me:
Application not installed.
Am I missing something ?
I even didn't change the code.
Your new recompiled apk is not signed and according to the rules, you cannot install unsigned apk.
One good thing which I like is that you can self sign the apk file.
You will have to use "Keytool" for generating your own certificate.
Here is the command :
keytool –genkey –v -keystore [nameofkeystore] –alias [your_keyalias] –keyalg RSA –keysize 2048 –validity [numberofdays]
This will ask you few things, just fill it appropriately.
Once the certificate is generated, use "jarsigner" for signing your apk.
jarsigner –verbose –sigalg MD5withRSA –digestalg SHA1 –keystore [name of your keystore] [your .apk file] [your keyalias]
Now try installing your new apk file and everything should work fine.
EDIT - I am using keytool and jarsigner commands directly as I have set their paths in PATH variable. In your case, you will have to traverse to "bin" folder of the jdk directory.
/bin/
You need to resign the regenerated APK file using jarsigner:
$ jarsigner -verbose -keystore my-release-key.keystore HelloWorld.apk alias_name

no manifest. jar is unsigned. (signatures missing or not parsable)

When I sign my android app using keytool, it gives above mentioned error.
no manifest. jar is unsigned. (signatures missing or not parsable)
I have created keystore everything. What would be the reason? Any manifest error?
I just received this same issue myself and it occurred when I tried to run
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore
from outside of the directory of my ionic project. When I ran it from the root of the ionic project, it worked. Then I moved the signed apk to a different directory to run zipalign and publish to the Play store.

Categories

Resources