How to assemble apk from disassembled .smali file? - android

Using SmaliBaksmali, I disassembled an apk to .smali files and made some code changes.
baksmali disassemble app.apk -o app
How to assemble these .smali file to apk file?

1.
build the apk using this command with apktool:
apktool.jar -f b <app-location> -o <output.apk>
2.
Then sign the apk, you can use uber-signer:
uber-apk-signer.jar --debug -a <output.apk> --overwrite --allowResign
3.
Install on device via adb:
adb -d install <output.apk>

Related

Unzip files in phone from ADB terminal

I am trying to unzip files in my android (11) phone with ADB from the terminal (Ubuntu 20.04). I need to run a script from my Ubuntu laptop to unzip files on my phone.
I have already tried Busybox from this suggestion. With this app, I can unzip files after accessing the shell. I mean -
$ adb shell
a60q:/ $ cd /sdcard/
a60q:/sdcard $ unzip data.zip
Archive: data.zip
inflating: Screenshot from 2020-11-30 16-45-46 (7th copy).png
inflating: Screenshot from 2020-11-30 16-45-46 (10th copy).png
But when I try to use the direct command, it shows an error.
$ adb shell unzip /sdcard/data.zip
unzip: couldn't create file Screenshot from 2020-11-30 16-45-46 (7th copy).png: Read-only file system
Archive: /sdcard/data.zip
Rooting phone isn't an option. My questions are -
What can I do here to unzip from the terminal?
Is there any tool to make compressed zip files (in Android) from the terminal?
In order to successfully invoke the unzip command from the terminal you should explicitly specify the folder where the zip's content will be extracted, for instance:
adb shell unzip /sdcard/data.zip -d /sdcard
By invoking unzip --help you will get more information on the other parameters available as well.

Upload generated .apk into Diawi using script

Is it possible to avoid manually uploading the .apk file into Diawi by using some scripts?
I saw that there is a plugin for Jenkins that uploads the .apk after CI and I was wondering if it is possible to do the same locally by using the command line.
After browsing in the Diawi documentation I found some guidance here. But I had issues with the HTTP 2 version and I had to force curl to use HTTP 1.1 instead. You can open the terminal of the Android Studio a just write the scripts. With the gradlew assembleRelease a .apk file will be generated, and after that, the curl command will upload it to your Diawi profile.
This is the command for Mac users:
./gradlew assembleRelease && curl -v --http1.1 https://upload.diawi.com/ -F token='<your_DIAWI_token>' -F file=#/<path_to_your_apk>/myapp-release.apk -F find_by_udid=0 -F callback_emails='<your_mail>'
This is for Windows users:
gradlew assembleRelease && curl -v --http1.1 https://upload.diawi.com/ -F token="<your_DIAWI_token>" -F file=#/<path_to_your_apk>/myapp-release.apk -F find_by_udid=0 -F callback_emails="<your_mail>"

Download and moving .apk with bash

I made a script to clean a ROM and install specific apps but when I look in the folder Mac is not seeing my .apk as unix exec file how can i fix this
here is part of the script:
getapex='curl -s -o ApexLauncher.apk apex.anddoes.com/Download.aspx'
$getapex
mv ApexLauncher.apk $currentdir/system/app/
hope you guys can help....
If it's not seeing the .apk file as a "unix exec file" as you say, then maybe you need to give it execution permission with:
chmod +x ApexLauncher.apk

Titanium CLI not accepting the .keystore file provided

I am trying to make android build, target set to build for dist-playstore from Titanium CLI. I am using this command
titanium build -p android -b -d /Users/ajeetpratap005/Documents/Titanium_Studio_Workspace/androidTest
-f -L androidTest -A /Users/ajeetpratap005/android-sdks
-K /Users/ajeetpratap005/android-test.keystore
-T dist-playstore -O /Users/ajeetpratap005/Documents/Titanium_Studio_Workspace/androidTest/dist
It builds successfully but I am not able to get my build in the output folder. when I checked the build which is getting generated in the build/android/bin folder, it is signed with the default keystore file which is present in the
<titanium mobile SDK location>/3.0.0.G.A/android/dev_keystore
How do I make titanium CLI to take my .keystore file and dump the production build to the output folder mention in the command..
Please refer to this document
https://wiki.appcelerator.org/display/guides/Packaging+for+the+Android+Market
There are instructions on the android developer site for generating the certificate key file here: http://developer.android.com/guide/publishing/app-signing.html#cert
See this video for more clarity http://vimeo.com/10278960

Asset access error in APK made by using shell script

I wrote the shell script to build APK to automate build process. It's like below.
rm -rf obj
rm -rf gen
rm -rf bin
rm -f build.xml
rm -f local.properties
rm -f proguard-project.txt
ndk-build
android update project --path ./
ant release
jarsigner -verbose -keystore path/keystore -storepass password -signedjar bin/myApp-release-signed.apk bin/myApp-release-unsigned.apk alias
Currently, I got the APK successfully. But I found sometimes app is crashed when it try to access special asset like texture image. LogCat shows the log like below.
04-10 12:46:25.080: E/szipinf(2255): Error reading asset data
04-10 12:46:25.080: E/szipinf(2255): Unable to access asset data: -1
Eclipse can build APK well. I tried to find the way to fox APK's issue. But I cannot find.
Currently, I'm using android-12 and ndk-r6b. Also I'm working on Machintosh. Is there any special guide to fix such a thing?

Categories

Resources