I have generated signed apk from Android Studio, it contains ndk and compiled as .so in lib folder inside the apk.
Because of a problem I am facing here:
Checksum value of classes.dex keep changing with Dexguard for every build
I want to replace the .so without re-building the classes.dex in the signed apk. However, after unzipping the apk and re-pack it. It cannot be installed, although I have signed the re-packed apk again using "jarsigner -verbose -keystore".
Any hints for how can I do that? Thanks.
Did you run zipalign after signing?
zipalign -v 4 your_project_name-signed.apk your_project_name-aligned.apk
See the final step in http://developer.android.com/tools/publishing/app-signing.html#signing-manually
Related
I need to export an APK to CD for my university coursework.
First of all I've done my whole project folder, and after coming into some problem trying to export a signed apk, I noticed it was in my project bin folder anyway.
Is there anything wrong with this apk? Is it runnable on other devices?
no difference, the apk should install and run on other devices.
Your apk may be signed with default keystore for debug build, or your own keystore depending on how you configured.
Just for testing, you can use apk in bin folder. But to submit to playstore and all you need a signed apk. Try with another keystore or remove build automatically option while generating apk.
Yes you can run APK of bin folder in any of the device for testing purpose . But if you want to Upload your APP to Palystore then you have to Export it(signed with release keystore) in this case APK of bin folder will not work .
Hope this info will be helpfil for you.
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.
Lately, whenever I try to export a signed apk for my app using the Export Wizard in Eclipse, ADT is excluding a bunch of classes from the signed apk.
I can build and debug the app without any problems, and the unsigned apk has no problems running on my Android device, but if If I install the signed apk, the app immediately crashes after opening, giving me a java.lang.ClassNotFoundException.
I unzipped the apk and then used dex2jar to convert the classes.dex file into a jar file.
unzip my_app.apk
./d2j-dex2jar.sh classes.dex
Examining the contents of the jar file (I used JD-GUI) revealed that it is, indeed, missing a bunch of classes. But why are they missing? Eclipse didn't give me any errors during the export... How can I create a signed apk that will work?
When you export a signed application, the build system runs ProGuard. This will eliminate all classes, methods, and fields that ProGuard thinks are not being used. Take a look at your proguard-project.txt file for notes on how to modify the ProGuard settings to keep things that it might otherwise discard.
If you post details about the removed classes (specifically, how they are used in your code), we can provide specific guidance on what settings to change.
For now, I've got around the issue by avoiding the Export Wizard in Eclipse and manually signing/aligning instead (instructions on android.com).
Steps for those who don't like reading long instructions:
Export an unsigned apk (right-click on you project and select Android Tools > Export Unsigned Application Package)
Sign the application using jarsigner:
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore
/path/to/same/keystore/used/by/export/wizard.keystore my_app.apk
key_alias
(key_alias is the same alias prompted for by the Export Wizard)
Align the package:
zipalign -v 4 your_project_name-unaligned.apk
your_project_name-aligned.apk
I'm still curious to know what's wrong with the Export Wizard and how I can get that working again.
Are you using ProGuard? If so, try disabling it and exporting the signed app again.
Maybe your ProGuard config is broken.
I've created a script that does some final packaging on an APK file, using the output from two different build processes to create a final APK that has the content from one build inserted into the APK from the other build.
If the input APK has been signed, I un-sign it by deleting the META-INF folder in the APK (and then go on to the rest of the script). The problem is that if the input APK was both signed and "zipalign"ed, the output APK has some corrupted files in it, which is bad.
Does "zipalign"ing prevent future changes to the APK?
If nothing else works, you can unzip the APK, delete the META-INF folder, then re-zip the rest.
Can anyone tell me how to zipalign my .apk file with using eclipse. I have made my .apk file by giving command like,
Right Click on Project Folder
Click on "Android Tools" option from menu.
Click on "Export Signed Application Package..." and my .apk generated in given application alias.
Now want to do zipalign for this above generated .apk file. Does any tool require to do so OR anything that can solve my problem.
If you did what you described above then Eclipse has already zipaligned your apk for you. You can't zipalign an already zipaligned package
I think this will help you
D:\android-sdk\android-sdk\tools>zipalign -f -v 4 "C:\Users\name\Desktop\project_name\projectname_signed.apk" "C:\Users\name\Desktop\project_name\projectname__zipaligned.apk"
Using the steps given, Eclipse will do zipalign for you.
This is a very tricky part and initially i was also ran in to strange problems . Before uploading to android market you must do the following steps.
Create a Certificate
Signing your application apk
Finally Zip align the signed apk
Check this site: How to sign Android project apk
Eclipse zipalign APKs when you export them by default.
zipalign is basically a tool available in tools directory of your android sdk.
In case you are not using eclipse to build, you can use this tool directly to zipalign your apk.
zipalign [-f] [-v] <alignment> infile.apk outfile.apk
The alignment is an integer that defines the byte-alignment boundaries. This must always be 4 (which provides 32-bit alignment) or else it effectively does nothing.
For more detail, check this link
http://developer.android.com/tools/help/zipalign.html
If you to signed and zip aligned your APK file, so that you could redistribute your file and upload it play store. Then follow these simple steps
Open Eclipse
File--> Export
Browse-->Select your project
Next-->Next
So, after all of that you will get an APK which will be signed and zip aligned.
Eclipse zipalign apk automatically. When you export the project, eclipse must be generating signed apk to a different destination. Check properly where it prompts when you generate a signed apk
Eclipse automatically zipaligns your .apk file if you did what you described above.