Unity3d Android APK file post-processing (DLL encryption) - android

My game is developed by Unity3d, I need to encrypt the DLL in APK.I add the following steps in build pipeline:
unzip the APK file
encrypt the managed dlls and replace with modified libmono.so (same Unity version, same ABI)
zip & jarsigner & zipalign
jarsigner -verbose -keystore debug.keystore -signedjar "%1"_unaligned.apk "%1".apk %alias%
zipalign -f 4 "%1"_unaligned.apk "%1"_release.apk
The resulting APK can install, but dies immediately after startup, no useful logcat, any helps?

Related

How to write md5 signature apk to upload on xiaomi store

I just wanted to upload my app on xiaomi app store and steps to create a signature build is not clear on develop dashboard there.
I googled but couldn't fine anything useful, can someone please help me to find any doc or steps I need to follow in order to create a xiaomi app store compatible apk file.
Following are the steps to get the signature from MI dev website.
1.jarsigner signature method
You can use the jarsigner tool that comes with the JDK to complete the signing. The command format of the jarsigner tool is as follows:
jarsigner -verbose -keystore [path to your private key] -signedjar [path to file after signing] [path to unsigned file] [name of your certificate]
#jarsigner parameter description: The keystore parameter specifies the absolute path of your private key, for example: c:\mykeystore -signedjar The parameter specifies the absolute path where the signed apk file is stored, such as c:\signed.apk [unsigned file path] Specify the absolute path of the apk file to be signed, which is the one you downloaded from us. For example, c:\unsigned.apk [your certificate name] refers to the certificate name you set when you created the key.
Signing methods for Linux and Mac OS X platforms
Open the Terminal program and enter the decompressed directory of verification.zip downloaded from Xiaomi Developer Station, such as cd ~/Downloads/verification Use jarsigner to sign the command example:
jarsigner -verbose -keystore~/Workspace/mykeystore -signedjar ./signed.apk ./unsigned.apk xiaomi
Windows platform signature method
Open the "Command Prompt" program and enter the decompressed directory of verification.zip downloaded from the Xiaomi developer station, for example, cd C:\Downloads\verification
Example of signing command using jarsigner:
jarsigner -verbose -keystoreC:\Downloads\verification\mykeystore -signedjar signed.apk unsigned.apk xiaomi
The acquisition of the above signature methods should be completed with the assistance of R&D personnel.

what could I do with HelloWorld-debug.apk file?

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.

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

Is there a command I can use to sign my modified apk on the command line in Linux?

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.

ANdroid - Run APK file after edited using apktool get error : [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

I have an APK file name : Splash.apk.
First i decode it using apktool
apk d Splash.apk
Then i edit Manifest, XML. Finally I export project to APK file name : EditedSpash.apk.
apk b Splash
When i run EditedSpash.apk on emulator. I got error. Do you explain it for me ?
adb install EditedSplash.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
you should sign to apk before install.
1)keytool -genkey -keystore (name).keystore -validity 10000 -alias (name) -keyalg rsa
2)answer some question (ex:name, company...
3)after make keystore file,you combine apk and ketstore
if these file are located same directory
jarsigner -keystore (name).keystore -verbose LunarLander.apk (name)
apk size increase 2kb+;
after this install apk to avd
Please specify how are you generating the apk file becausw to generate the apk file we need to generate it using certifiate it may be debug certificate or the release certificate if the generated apk dont have any of them will through the error so generate the apk using eclipse it will automatically generate the apk file using debug certificate.

Categories

Resources