I need to test InAppBilling with my debuggable apk. I tried to sign my debug.apk and upload it, unfortunately it doesn´t work. This is what i have done:
Generate Keystore:
keytool -genkey -v -keystore debug.keystore -alias debug_app -keyalg RSA -validity 10000
Sign APK:
jarsigner -verbose -keystore debug.keystore app-debug.apk debug_app
(Actually i never know to use aligned or unaligend)
Then i ZipAlign it:
zipalign -f -v 4 SomeName.apk app-debug.apk
Now when i do this and install it via:
adb install SomeName.apk
I get a Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Any ideas? The next step would be to put the signed app-debug.apk to the play Store and test it via Alpha/Beta-Test. I am using ReactNative to build my Android App.
Is that debug.keystore the auto-generated debug keystore?
If it is, you can't. You have to generate a keystore that is not a debug one to be able to upload it.
If you have one that is not a debug one, check Signing Your App Manually section here.
Related
I'm trying to test google in app purchase system.
If I download from the app from google play, in app purchase works.
However if I run the app directly from android studio, I can't because of error code 5 or 0.
I think its because when running through android studio on test device its not signed. how do i do that ?
You need to sign it manually with your production keystore:
jarsigner -sigalg MD5withRSA -digestalg SHA1 -keystore "PATH" -storepass KEYSTORE_FILE app-unsigned.apk ALIAS_NAME
Then you maybe need to zipalign:
zipalign "-v" "4" "PATH TO SIGNED APK" out.apk
I'm trying to deploy an android apk created by Cordova but I'm wrong. Here is my process :
1)Build the release apk : cordova build android --release
2)Generate a keystore : keytool -genkey -v -keystore my-release-key.keystore -alias com.MyCompany.AppsName -keyalg RSA -keysize 2048 -validity 10000
I create password named MyPass, and write all information in the form (name, country,...)
3)Signed the Apps : jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore android-release-unsigned.apk com.MyCompany.AppsName
4)Checked for signing : jarsigner -verify -verbose -certs android-release-unsigned.apk
I get this output :
"jar verified.
Warning:
This jar contains entries whose certificate chain is not validated.
This jar contains signatures that does not include a timestamp. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2043-12-07) or after any future revocation date."
5)Zip the Apk : "c:\pathtosdk\zipalign.exe" -v 4 android-release-unsigned.apk com.MyCompany.AppsName.apk
6)And then i copy the Apk on a android device.
But when I try to install the Apps, the device ask me to allow unknown sources... like it's not signed.
Is anyone who know where i'm wrong ?
Thanks in advance
Your apk is probably signed and perfectly fine. the reason it asks to allow unknown sources because by default it does not allows to install .apk files from other sources than google play store. Security issues
https://support.google.com/nexus/answer/2812853?hl=en
That's the message you will receive if your not downloading the app from the play store which is true for you case. That doesn't have anything to do with the app being signed.
Try to install a derived a apk. First release your app in Alpha Release of play store. Then download the derived apk from alpha release. I think that will help.
When changing files in an extracted APK, I re-zip it, change the extension to .apk, and install like this:
$ adb install CustomAPK.apk
2831 KB/s (41896599 bytes in 14.450s)
pkg: /data/local/tmp/CustomAPK.apk
Failure [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION]
What is this from?
Generate a key and sign the apk: Android Developer Website
Signing Your App Manually
You do not need Android Studio to sign your app. You can sign your app from the command line using standard tools from the Android SDK and the JDK. To sign an app in release mode from the command line:
Generate a private key using keytool. For example:
$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
This example prompts you for passwords for the keystore and key, and to provide the Distinguished Name fields for your key. It then generates the keystore as a file called my-release-key.keystore. The keystore contains a single key, valid for 10000 days. The alias is a name that you will use later when signing your app.
Compile your app in release mode to obtain an unsigned APK.
Sign your app with your private key using jarsigner:
$ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore my-release-key.keystore my_application.apk alias_name
This example prompts you for passwords for the keystore and key. It then modifies the APK in-place to sign it. Note that you can sign an APK multiple times with different keys.
Verify that your APK is signed. For example:
$ jarsigner -verify -verbose -certs my_application.apk
Align the final APK package using zipalign.
$ zipalign -v 4 your_project_name-unaligned.apk your_project_name.apk
zipalign ensures that all uncompressed data starts with a particular byte alignment relative to the start of the file, which reduces the amount of RAM consumed by an app.
INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION
for this Uninstall APP and click run button to fix this issue
Build the App, and then Run
solved mine
I get error in eclipse when i try to export the project to apk so I could not solve it
the message that appear is
keytool error: java.lang.Exception: Key pair not generated, alias
<.......> already exists
so can any one to help
Did you generate the key and use it? Its straight forward. You must have a key to sign the application. You can generate the apk only after that.
How are your signing the Application? Heres a good step by step to digitally signing you application. How to sign an android apk file
For this simply regenerate you certificate again follow these steps.
1)keytool -genkey -v -keystore mycertificate.keystore -alias mykey -keyalg
RSA -keysize 2048 -validity 1000
2) jarsigner -verbose -keystore mycertificate.keystore D:\app.apk mykey
3) jarsigner -verify app.apk
If it will have done then shows a message "successfully verified"
4) zipalign -v 4 D:\app.apk D:\signedapp.apk
it will generate new certificate. enjoy
I developed a Android App and could sign it with the Eclipse Plugin, but i wanted to sign it manually with jarsigner and zipalign, so that i can choose the algorithm and the keysize by my self.
I created a Keystore with this command:
keytool -genkey -v -keystore keystore_name -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
My first issue is that i cant enter the Keystore with the Eclipse Plugin. It says:
Keystore was tampered with, or password was incorrect
So i went on with the jarsigner like this:
jarsigner -verbose -keystore keystore_name my_application.apk alias_name
and it works fine.
finally i run the tool zipaling:
zipalign -v 4 inputfile.apk outputfile.apk
I could publish my app in the market without any trouble. But when a friend downloaded my app, he gets the error: Package file was not signed correctly
Furthermore I can't install my app signed manually. But the version, signed with the Eclipse plugin works fine.
The big problem now I have is, that I can't upload the new apk file do the market, because it says that it is signed with an other certificate.
What can I do ?
Not sure if this will help but I came across a similar issue before. After trying a few things I used jarsigner like this and it has been working fine:
jarsigner -verbose -digestalg SHA1 -sigalg MD5withRSA -keystore %path to key store here% -signedjar %the name you want for your signed apk here% %the apk you want to sign here% your.keystore
EDIT:
Just noticed your question was about what to do with the app on the market place. I'm no help there. Sorry.
Verify the keytool you are using:
which keytool
check if it is set to openjdk... Android supports only Sun/Oracle Java as the keytool.