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.
Related
So i'm about to publish my apps new version to android store, there was an old version of it in play store but i make a completely different project from it so i didn't use the folders which contains the project on itself.
Because of that my private key is not in my new version right now. When i looked the documentation of ionic it says that :
Now, we need to sign the unsigned APK and run an alignment utility on
it to optimize it and prepare it for the app store. If you already
have a signing key, skip these steps and use that one instead.
Actually "If you already have a signing key, skip these steps and use that one instead." part is not clear enough for me.
I have the .keystore file from old version but I'm little bit lost right now.
What does this "skip those steps and use that one instead" means? What am I supposed to do right now?
Where should I place that .keystore file?
Am I done after placing the .keystore file or should I do something
else?
What is that code($ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore HelloWorld-release-unsigned.apk alias_name) for? Should I use it?
What is that alias_name part?
Should I do something else?
I would appreciate a help, I'm totally lost right now
The procedure is the same as when you first time published app (build the release app file - signing the APK file - optimize the APK). This time you do not have to create keystore file because you already have one. You'll reuse the same keystore for the entire life of the app, so you need to keep it for as long as you plan to support the app.
1.) If you already have keystore file you do not have to do new one.
2.) Put android-release-unsigned.apk and keystore in same folder. First rename android-release-unsigned.apk to example MyApp.apk
3.) You need to sign your app with that file.
4.) Yes, you should. In step 2 after you put MyApp.apk and MyApp.keystore in same folder.
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore MyApp.keystore MyApp.apk MyApp
5.) This is the name of your application.
6.) And then just optimize the app. $ zipalign -v 4 MyApp.apk MyAppNew.apk
I used the Dynatrace auto-instrumentor command on my Android apk file
auto-instrumentor.cmd apk <apk file> prop <APK-Instr.properties>
and then signed it with my keystore.
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mykeystore.keystore myApp.apk aliasname
Finally I zip align it using the below command:
zipalign -f -v 4 AppFile.apk AppFile2.apk
But when I try to install the file, I get a parsing error:
There is a problem parsing the package.
Note: I have been able to successfully verify the jar using the below command:
jarsigner -verify -keystore mystore.keystore AppFile.apk
But still get the parsing error!
Try using changing the hash algorithms and retrying. You may use either SHA2 or SHA256 as a start.
Note that SHA1 is being deprecated by browsers.
It's possible that your APK was signed with a debug key when it was first built. Running jarsigner again could be signing it a second time.
Take a look at this question and my answer here to see if this is the problem.
I build an app for android and I already export it to apk, can I change its version code if it's already exported? How can I do that?
I lost the backup code and I only have the update one and need to get back at first one, the only thing I can do is to increase version code from the apk backup and then my app will upgrade (while actually downgrade) automatically
You need to open apktool.yml
from there you can modify the version code
Yes, use [this link][1] it explains many things over there. I will copy paste it:
Tools:
apktool — tool for reverse engineering Android apk files. In this case we are using to extract files from apk and rebuild.
keytool — Java tool for creating keys/certs, that comes with the JDK.
jarsigner Java tool for signing JAR/APK files, that comes with the JDK.
zipalign — archive alignment tool, that comes with the Android SDK.
Instructions:
apktool d my_application.apk
Change versionCode in apktool.yml.
apktool b my_application
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application/dist/my_application.apk alias_name
jarsigner -verify -verbose -certs my_application/dist/my_application.apk
zipalign -v 4 my_application/dist/my_application.apk my_application/dist/my_application-aligned.apk
But to be honest, i still couldn't manage it, Google Play Store says "ERROR: MIN_SIG_SCHEME_FOR_TARGET_SDK_NOT_MET: Target SDK version 30 requires a minimum of signature scheme v2; the APK is not signed with this or a later signature scheme", so i don't guarrantee you that it will work but you can give it a try.
[1]: https://medium.com/#sandeepcirusanagunla/decompile-and-recompile-an-android-apk-using-apktool-3d84c2055a82
you can do the followings
decompile the apk
update the versioncode in manifest
again recompile the apk
you can use apktool
It's simple:
You need to,
Download the apk (Under release management on google play
console and go to Artifact Library)
Decompile the apk
Update the versioncode in manifest
Recompile the apk
I compiled successful project HTML5 to Android by Cordova, it produced some files as HelloWorld-debug.apk, HelloWorld-debug-unaligned.apk ...
Really I don't know meaning of debug, unaligned, I want upload file apk to Android market, this files met enough requirements of Google?
the -debug apk is you app unsigned with debug info. It can be installed on your device. (need to allow installation of unknown apps)
If you want to have a release app you need to run
platforms\android\cordova\build.bat --release
(replace \ with / and remove .bat for unix based computers)
and then to sign the app :
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore pathtoyourkeystorefile.keystore platforms\android\bin\yourapp-release-unsigned.apk nameofthekeyinkeystore
replace pathtoyourkeystorefile.keystore with the path to your previously created keystore file, yourapp with the name of your app and nameofthekeyinkeystore with the name of your key in the keystore
and then your file will still be named -release-unsigned.apk so you can rename it to -release-signed.apk or just .apk and it will be ready to be uploaded to the store.
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.