(2) You have to install Android Studio and decompile tools on your ChromeOS machine (see here How to run Android Emulator on ChromeOS)
(3) Here is the walkthrough on how to decompile apk and change the resource file and repack and sign the apk file again. Assume you don't have the source code project file. The original demo apk can be download from here. TouchCalculator_1.0-debug.apk
(4) The problem of this TouchCalculator app has two problems on the interface: a) The memory text on the left should be smaller in size b) The key (on the right) with a comma is wrong and it should be a dot for input decimal point. Without the source project file, and in order to modify it, you have to decompile it and study the code and repack it to apk file to run.
(5) Assume, you have the ChromeOS machine and installed software and also setup the decompile tools as in Steps (1) and (2). And In Linux Terminal execute these steps:
mkdir ~/DecompileProjects
cd ~/DecompileProjects
# Then copy the download apk file to this Linux folder DecompileProjects
# Use apktool to decode the apk
apktool decode TouchCalculator_1.0-debug.apk -o TouchCalculator
# After studying the xml files in the res/layout folder
# modify the file: TouchCalculator/res/layout/activity_main.xml
# and change from 25.0sp to a smaller textSize of 12.0sp
<TextView android:textSize="25.0sp" android:textColor="@color/lightyellow" android:gravity="right" android:id="@id/txtMemory"
#to
<TextView android:textSize="12.0sp" android:textColor="@color/lightyellow" android:gravity="right" android:id="@id/txtMemory"
# modify the file: TouchCalculator/smali_classes3/com/pragmatouch/calculator/KeypadButton.smali
# line 453 and change the button label from "," to "•"
const-string v3, ","
# to
const-string v3, "\u2022"
# Use apktool to build the apk after modification of the resource files
apktool build TouchCalculator -o TouchCalculator_1.01.apk
# generate a keystore with SHA256RSA (if not yet generated) and remember the storepassword
keytool -genkey -v -keystore my-release-key256.keystore -alias mykey256 -sigalg SHA256withRSA -keyalg RSA -keysize 2048 -validity 10000 -deststoretype pkcs12
# sign the apk with self-signed certificate and enter the storepassword
jarsigner -verbose -sigalg SHA256withRSA -keystore my-release-key256.keystore TouchCalculator_1.01.apk mykey256
# verify the signature
jarsigner -verify -verbose -certs -keystore my-release-key256.keystore TouchCalculator_1.01.apk
# zipalign the apk
zipalign -v 4 TouchCalculator_1.01.apk TouchCalculator_1.01-aligned.apk
(6) Install the TouchCalculator_1.01-aligned.apk on your ChromeOS (with developer mode on) machine or your Android device (With Unknown Sources on) for testing. For ChromeOS, please uninstall the previous apk version before installation of the new one.
(7) This is just a proof of concept that using apktool can decompile then modify and repack again to an apk file. To further modify the java / smali code in the decompile source, just stay tune for my next article.
No comments:
Post a Comment