can not install apk after generate signed apk in Android studio - android

I want to publish my app to google play. So I follow this link.
I created a keystore, and built app-release.apk successfully. But when I install APK to my device, it take error:
~/Android/Sdk/platform-tools$ ./adb install ~/Downloads/libraries/LolliPin/app/app-release.apk
[100%] /data/local/tmp/app-release.apk
pkg: /data/local/tmp/app-release.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
When upload to Developer Console, the site say app has not signed.
I try again using manual steps: jarsigned --> zipalign --> apksigner but it is not run.
Please tell me the solution. Many thanks!
UPDATE: when I verified the apk (created by android studio --> generate apk signed) by apksigned, it show error:
~/Android/Sdk/build-tools/25.0.2$ ./apksigner verify /home/haitt22/test/app-release.apk
DOES NOT VERIFY
ERROR: No JAR signatures
UPDATE 2: when i signed it using apksigner in build-tool, log:
/apksigner sign --ks /home/haitt22/test/test.jks /home/ubuntu/test/app-release-aligned.apk
Keystore password for signer #1:
Exception in thread "main" java.lang.IllegalAccessError: class com.android.apksig.internal.apk.v1.V1SchemeSigner (in unnamed module #0x646d64ab) cannot access class sun.security.x509.AlgorithmId (in module java.base) because module java.base does not export sun.security.x509 to unnamed module #0x646d64ab
at com.android.apksig.internal.apk.v1.V1SchemeSigner.getSupportedAlgorithmId(V1SchemeSigner.java:625)
at com.android.apksig.internal.apk.v1.V1SchemeSigner.<clinit>(V1SchemeSigner.java:541)
at com.android.apksig.DefaultApkSignerEngine.<init>(DefaultApkSignerEngine.java:149)
at com.android.apksig.DefaultApkSignerEngine.<init>(DefaultApkSignerEngine.java:52)
at com.android.apksig.DefaultApkSignerEngine$Builder.build(DefaultApkSignerEngine.java:902)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:259)
at com.android.apksig.ApkSigner.sign(ApkSigner.java:178)
at com.android.apksigner.ApkSignerTool.sign(ApkSignerTool.java:277)
at com.android.apksigner.ApkSignerTool.main(ApkSignerTool.java:89)

You need to make sure that, both Jar signature and APK signature are checked:

Use OpenJDK 8. Java 9 is causing this problem

Related

Unable to install the .apk generated from .aab due to signing issues

I have installed Android Studio Dolphin | 2021.3.1 for Mac (~993 MiB) recently. I have created .aab file from Build -> Generate Signed Bundle / APK. While generating .aab I have given all the required details like keystore file path, alias and password. After generating .aab I tired to generate .apk from .aab by using following command,
sudo bundletool build-apks --bundle=<.aab location> --output=<.apk location>
Then I encountered with following warning,
WARNING: The APKs won't be signed and thus not installable unless you
also pass a keystore via the flag --ks. See the command help for more
information.
Now, If I am unable to install the generated .apk file due to signing issues.
May I know the reason behind this warning though I have given all the required details while generating .aab?
It's a requirement of the Android platform that all APKs must be signed to be installed on a device, so your requirement of "installing unsigned APKs" is simply not possible.
Solutions to get apk from aab

Unity unable to publish to Play Console - Invalid app signature

Here is what I get after waiting for the upload. I'm using latest Unity (2017.3.0f3) with JDK 8 (because 9 wasn't even building). Now the project builds but I can't deploy it to the console nor can I to the Emulator.
Note, I did assign my keystore file and I did write the passwords. I'm not uploading a development build, I double checked that. For the build I was using the old .25 tools (inside the sdk folder I replaced the existing ones). I did that so that I can get a build.
I looked for the error message of course, but couldn't find anything useful.
Might be your app signing step failed while producing final apk.
As mentioned here, try resigning your apk with below sample commands
apksigner sign --ks my-release-key.jks --out my-app-release.apk my-app-unsigned-aligned.apk
and validate same using
apksigner verify my-app-release.apk

Ionic apk signing error

Currently trying to sign my apk which has been built with ionic v2 following the exact procedure advised by ionic in their docs: http://ionicframework.com/docs/v1/guide/publishing.html
But for some reason, I am getting this error when uploading to the play console:
You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: ERROR: JAR_SIG_NO_SIGNATURES: No JAR signatures
Was surprised to find very little mention of this error (and none in relation to ionic) on google. What is most bizarre is that I was signing apps no problem a few months ago but only encountering this recently. Can anyone help?
It appears that the APK you're uploading does not contain any JAR signature files. Typically, these are META-INF/MANIFEST.MF, META-INF/<key alias>.SF and META-INF/<key alias>.RSA.
Try producing a signed APK using apksigner (https://developer.android.com/studio/command-line/apksigner.html) which is the endorsed tool for creating signed APKs:
zipalign -v -p 4 HelloWorld-release-unsigned.apk HelloWorld.apk
apksigner sign --ks my-release-key.keystore HelloWorld.apk
I was able to solve my product by modifying the following line in the config.xml file:
<widget id="io.ionic.starter" ...
to
<widget id="br.com.pedcare" ...

Unable to upgrade to a Dynatrace enabled apk

I have used the auto-instrumentor command on my Android apk file.
auto-instrumentor.cmd apk <apk file> prop <APK-Instr.properties>
It generated three new files:
unsigned
signed
final
Now I am able to use my app when I do a fresh install.
But if I try to upgrade an earlier build to this Dynatrace enabled version, it always gives me a message
App Not Installed.
If you are not using the original certificates to sign the apk you will not be able to install the instrumented app over the already existing once. The only option you have is to uninstall the original app and install the instrumented app.
If you have the original certificates you need to take the following steps:
take the unsigned apk and instrument the apk
sign the apk
zip align the apk
For more information please take a look at the Android Auto-Instrumentation documentation

You uploaded an APK that is not zip aligned error

I have just finished and signed the apk through android studio,
then I have did an apk protect through apkprotect.com
when I am trying to upload the apk to play store I got this error " You uploaded an APK that is not zip aligned. You will need to run a zip align tool on your APK and upload it again. "
if I upload the original apk I got no errors,
I have tried to add zipalign true in the build.gradle but nothing happened
I have tried also disable and enable proguard .
You can run zipalign manually in command line:
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
Note that zipalign is located inside ${sdk.dir}\tools
For more details visit zipalign
[Update]
Also, If you need to sign it you can run:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore YOURKEYSTORE unsigned.apk alias_name
(jarsigner is located inside java JDK_HOME/bin)
I got the same "You uploaded an APK that is not zip aligned... blah, blah" error when by mistake I tried to upload a DEBUG version of my .apk file to Google Play. It's a bit misleading error because the real problem is that you cannot distribute a debug version which additionally is not signed with your Google Android Developer key. (You can only upload an .apk compiled as release version, and it must be signed, which happens in the same step, at least if you're using Eclipse).
Make sure you distribute an .apk file which is your Signed Release version, as described here:
http://developer.android.com/tools/publishing/app-signing.html#releasecompile
This question and its answers are old; so we expect things to change. As of today, the zipalign tool is in the ANDROID_HOME directory under build-tools/[version]/ so my path is currently:
/android-sdk/build-tools/22.0.0/zipalign
Using the zipalign tool is not necessarily the answer here though, what you actually need to do is sign your apk.
Steps if using Xamarin for VS2017:
Build project
Right click and Archive project
Use Ad Hoc distribution channel
Sign your APK with your Signing Identity and Save As to produce an APK that is ZIP aligned.
Your APK can be uploaded to Google Play.
I was using Cordova, uploaded a signed APK but still got this error.
The ziptool is what helped me, it's located at ~AndroidSDK\build-tools\24.0.0\zipalign.exe
So for example :
"~\AndroidSDK\build-tools\24.0.0\zipalign.exe" -f -v 4 android-release-signed.apk android-release-signed-zipaligned.apk
I was using Cordova and the command line getting this error. I opened the project in Android Studio and used Android Studio to build the signed apk and the error went away.
When using the Cordova node.js CLI without going through Android Studio, it is necessary to update the PATH environmental variable to include the android build tools:
%ANDROID_HOME%\build-tools\29.0.2
Obviously the version number will change over time. Remember to close any CLI windows and re-open them to recognize the newly added path.

Categories

Resources