Working With .pkm and .atc Files - Android Software/Hacking General [Developers Only]

Hello XDA,
Today I'm going to show you how to work with/convert the .pkm and .atc image files that are included in system apks on recent devices. It's been about a month since I've looked into these formats, so if anybody has since come up with any better/alternative methods, please share them here.
Let's begin...
.pkm
.pkm files are actually a type of ETC1_RGB8 textures. The reason manufacturers are starting to use them, is because they are fully supported by Android, and with the OpenGL ES platform that Android runs, they offer significant overhead savings vs conventional image formats. A lot of people (devs included) probably haven't realized it, but there is actually a tool that comes bundled with the Android SDK for creating .pkm textures. It's called etc1tool, and is a command line utility. Etc1tool is capable itself of converting .pkm files to .png, but unfortunately all the ones I've come across in pre-existing apks are not able to be converted this way. That would be too easy, right? So, here's what we do instead:
-First, you're going to need to download and install Mali GPU Texture Compression Tool from HERE.
-Once you've got it all set up, open it up, go to File > Open, and open up a .pkm file (or several, as it can do batch processing).
-Now, click on the .pkm file you just opened, in the left-hand pane to select it. You should see the image.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
-Next, click on the yellow icon towards the upper right of the screen.
-In the window that pops up, copy the settings I have here. You can change the directory (it's only going to store a temp file anyway), but everything else must match.
-Click OK, let it do its' thing, and you should see a screen similar to this:
-Now, you're going to click on your image(s) in the left-hand pane to select them again, then click on the blue save icon towards the upper right.
-Save them to whatever directory, and with whatever extension you'd like (most likely .png). Now, the standard ETC1 format doesn't handle alpha values, and the existing .pkms seem to have been encoded using some proprietary method that preserves the alpha channel. When you save your image from Mali, it will not save the alpha values, despite the preview having them. As a result, your .png will have a black background, similar to this:
From here, though, you at least have a standard .png image, which you can then open with Photoshop or Gimp and easily remove the black background.
-If for some reason you'd like to create your own .pkm file(s) from existing images, navigate in command prompt to the your Android SDK > Tools directory, then use the following:
Code:
etc1tool pathtoinputfile.png --encode -o pathtooutputfile.pkm
.atc
.atc files aren't going to be as common as .pkm, as they are a proprietary format and can only be used on device with a Qualcomm Adreno chipset. Just like .pkm files, they offer significant gains in overhead performance compared to standard image formats, but they are a pain when you're trying to theme an app that's full of them. Let's begin...
-Start off by downloading the ASTC Evaluation Codec found HERE. This one is going to be a zip, rather than an installable program, so download it and extract it wherever you wish. Once extracted, find the location of 'astcenc' (the folder names are odd, and differ depending on your OS).
-Once you've located it, open up command prompt, and navigate to that folder.
-Like etc1tool, the ASTC Codec is capable of converting directly to .png, but also like the .pkm files, it doesn't work in this case. You can try, but the result will be unusable, so don't waste your time. Instead, we're going to convert to .tga.
-So, in command prompt, use the following to decode the .atc to a more usable .tga:
Code:
astcenc -d pathtoinputfile.atc pathtooutputfile.tga
-Unlike .pkm files and Mali, this will preserve any existing transparency, but there's a catch (there's always a catch). The resulting .tga file will be upside down.
-Fortunately, this is nothing more than a minor inconvenience lol. So, once you have your .tga file, open it up in Photoshop or Gimp, flip it, and save as .png, and you should be all set.
-If for some reason you wanted to create a new .atc file, the codec can be used for that as well. I forget the command, and documentation is very hard to find, but if you use the following, you should be able to go from there:
Code:
astcenc -help
Be aware, that there is absolutely no need to recreate any of these special formats. You can simply delete the originals and replace them with .png files of the same name, and they'll work just fine in any apk, and then you won't have to worry about it in the future. Anyway, I hope some of you learned something and find this useful....
~morningstar

hi Morningstar , thanks a lot for this work
do you think it is possible to make an apk like qmg2png ?

Carotix said:
hi Morningstar , thanks a lot for this work
do you think it is possible to make an apk like qmg2png ?
Click to expand...
Click to collapse
Unfortunately, I don't believe so. At least I couldn't. Perhaps someone more knowledgeable might be able to do something like that.

I am not able to convert .atc extension files with your guide it creates a new .tga files but when i open it with Photoshop it gives me error "Could not complete your request because of a problem with the file-format module interface."

manikant_009 said:
I am not able to convert .atc extension files with your guide it creates a new .tga files but when i open it with Photoshop it gives me error "Could not complete your request because of a problem with the file-format module interface."
Click to expand...
Click to collapse
Interesting. I don't use PhotoShop personally, so I wasn't aware of the issue. What version of PS are you using? I'll see if I can figure out a solution. In the meantime, I guess I'd have to recommend Gimp, as it's what I generally use, and doesn't seem to have any issues opening the resulting .tga files.

Morningstar said:
Interesting. I don't use PhotoShop personally, so I wasn't aware of the issue. What version of PS are you using? I'll see if I can figure out a solution. In the meantime, I guess I'd have to recommend Gimp, as it's what I generally use, and doesn't seem to have any issues opening the resulting .tga files.
Click to expand...
Click to collapse
I Succeeded in Converting .atc files. What I did is just renamed all .atc files to .astc extension and then used Picconv 2.1 to covert it to .png files

manikant_009 said:
I Succeeded in Converting .atc files. What I did is just renamed all .atc files to .astc extension and then used Picconv 2.1 to covert it to .png files
Click to expand...
Click to collapse
Picconv, huh? Never heard of it, but I'll definitely check it out, because the current method is rather convoluted and annoying lol.

hey @Morningstar...i reworked my batch file i made that resizes a folder full of xxhdpi images to xhdpi and hdpi sizes to now also convert a folder full of atc images to tga, flip them, and convert them all to png images all in one step. maybe it'll help y'all out a little...ionno...maybe.
folder structure must be exactly as shown and explained in the setup.txt file.
Image Converter
EDIT: use V2 edition on page 2 of this thread as i made it to convert .wbp images too now (HERE)

mikeymopar said:
hey @Morningstar...i reworked my batch file i made that resizes a folder full of xxhdpi images to xhdpi and hdpi sizes to now also convert a folder full of atc images to tga, flip them, and convert them all to png images all in one step. maybe it'll help y'all out a little...ionno...maybe.
Click to expand...
Click to collapse
Great work Mikey.. Just tested. Full disclosure. ......... I'm lazy. I copied all images over. .9s,qmg, and atc. It ignored other formats, and hit every atc. Perfect!!!
Sent from my SM-N910P using XDA Free mobile app

kevinoliva113 said:
Great work Mikey.. Just tested. Full disclosure. ......... I'm lazy. I copied all images over. .9s,qmg, and atc. It ignored other formats, and hit every atc. Perfect!!!
Click to expand...
Click to collapse
big thx @kevinoliva113 for the feedback. i'm a bit out of the loop now (haven't dealt with atc before; still on kk with att) and by pure chance noticed someone mentioning how it was so time consuming converting atc images one at a time and yearning for a way to batch convert a bunch of them. so hopefully, at least for the time being, this meets the requirements for those that can use it

mikeymopar said:
hey @Morningstar...i reworked my batch file i made that resizes a folder full of xxhdpi images to xhdpi and hdpi sizes to now also convert a folder full of atc images to tga, flip them, and convert them all to png images all in one step. maybe it'll help y'all out a little...ionno...maybe.
folder structure must be exactly as shown and explained in the setup.txt file.
Image Converter
Click to expand...
Click to collapse
Wow, Mikey, excellent work! Fortunately, I haven't had to deal with too many .atc files, but I know some devices have a ton of them, and that'll be a great time saver.
Fantastic job!
[emoji106]

Morningstar said:
Wow, Mikey, excellent work! Fortunately, I haven't had to deal with too many .atc files, but I know some devices have a ton of them, and that'll be a great time saver.
Fantastic job!
Click to expand...
Click to collapse
i only expanded on your solution by adding it to my simple script. all credit goes to you - awesome work as usual...much respect

mikeymopar said:
i only expanded on your solution by adding it to my simple script. all credit goes to you - awesome work as usual...much respect
Click to expand...
Click to collapse
Ditto.
[emoji8]

New tool/script for batch conversion of .wbp files HERE.

Morningstar said:
New tool/script for batch conversion of .wbp files HERE.
Click to expand...
Click to collapse
nice. also added this new feature to my image converter (as long as you don't mind). now it BATCH resizes xxhdpi and converts .atc and .wbp images to png images
IMAGE RESIZERv2

mikeymopar said:
nice. also added this new feature to my image converter (as long as you don't mind). now it BATCH resizes xxhdpi and converts .atc and .wbp images to png images
IMAGE RESIZERv2
Click to expand...
Click to collapse
Nice work, Mikey! ...And you know I don't mind lol. Er....if you didn't notice already, there was a slight error in my script. When converting from .wbp to .png, it renamed the files like this: file_name.wbp.png. It doesn't affect recompiling or anything, but if you're OCD it'll drive you nuts. I just haven't gotten around to fixing it yet. Lol.
Excellent work. It's nice as hell to have everything in one easy to use package, rather than mucking about with a bunch of different programs and scripts and codecs
[emoji106]

I put a pkm into the "Original_Images_to_convert" folder ran the bat it said it was complete but where does it save it to?
---------- Post added at 03:32 PM ---------- Previous post was at 03:29 PM ----------
parkerj7uc said:
I put a pkm into the "Original_Images_to_convert" folder ran the bat it said it was complete but where does it save it to?
Click to expand...
Click to collapse
Ok I see that after doing it a folder appears as "Images_converted_to_png" but the folder is empty.

parkerj7uc said:
I put a pkm into the "Original_Images_to_convert" folder ran the bat it said it was complete but where does it save it to?
---------- Post added at 03:32 PM ---------- Previous post was at 03:29 PM ----------
Ok I see that after doing it a folder appears as "Images_converted_to_png" but the folder is empty.
Click to expand...
Click to collapse
Ummm....I don't think @mikeymopar's script does .pkm files?

Morningstar said:
Ummm....I don't think @mikeymopar's script does .pkm files?
Click to expand...
Click to collapse
Correct as far as i know theres no tool out yet for converting pkm image format

willowmaker420 said:
Correct as far as i know theres no tool out yet for converting pkm image format
Click to expand...
Click to collapse
Read the OP. I found a way of converting them, it's just somewhat clunky.

Related

[DEVS] Optimize all APKs automatically, Reduce memory footprint! [Now with Zipalign]

Update 9/28: Now contains the SDK 1.6 zipalign binary and routine to align each APK after optimization. This results in slightly larger file sizes but a smaller RAM footprint and faster performance. For more information about zipalign, see http://android-developers.blogspot.com/2009/09/zipalign-easy-optimization.html
Update 9/16: new zip defaults to mx5 zip compression, creates "original" and "optimized" folder for apks.
This is a very simple batch file that makes use of command line 7-zip and a special build of optipng (supporting recursive optimizing) to reduce the size of the PNGs in your APKs. This would reduce the overall memory footprint of your apps, and allow you to fit more on the phone's puny internal memory.
As for how much this helps, here's a test run on the latest JACxHeroSki:
Size of uncompressed folder of data/app_s before optimization: 57.3 MB
Size of uncompressed folder of data/app_s after optimization: 43.1 MB
To use it, simply copy all the APKs you want optimized into the batch files' directory and run "apkopt_all.bat" This will take a while but it's all automated! This will then create two folders, optimized and original.
To make the optimization process faster, reduce the "-o99" parameter in apkopt.bat - however, this will result in larger PNGs so best to leave it at o99 and wait. You can also tweak the compression level of the ZIP itself - I left it at "normal" (-mx5) because higher compression levels have reported problems with some APKs.
Once done, the APKs will not be signed but that should not be an issue if you're bundling the APK with a ROM or pushing it through adb.
Optimization has no negative effects, it just makes the PNGs smaller.
Windows only for now - the variant of optipng that this depends on only has a Windows binary available.
It definitely makes a difference!
This distribution includes 7-zip and a variant of optipng called roptipng. Sources can be found:
http://www.7-zip.org/
http://code.google.com/p/roptipng/
I apologize for my noobish Windows command line knowledge. Many devs (like Cyanogen) already seems to have been doing this long ago! His builds are so optimized you can't optimize them more. Any size difference will be due to different compression methods/levels on the ZIP.
sweet, will you do it so I can test it on jacheroskiv2.1 and 2.2? i have a mac w/ ubuntu. no windows!
Is this even necessary when pretty much every ROM uses app2sd?
And wouldn't zipping the png slow things down because the OS now needs to unzip before running?
dwang said:
Is this even necessary when pretty much every ROM uses app2sd?
And wouldn't zipping the png slow things down because the OS now needs to unzip before running?
Click to expand...
Click to collapse
not everyone needs to have hundreds of apps and therefore no need to run apps2sd.
ccyrowski said:
sweet, will you do it so I can test it on jacheroskiv2.1 and 2.2? i have a mac w/ ubuntu. no windows!
Click to expand...
Click to collapse
I'm in the process of making/uploading a pack of APKs of javheroski 2.1.
dwang said:
Is this even necessary when pretty much every ROM uses app2sd?
And wouldn't zipping the png slow things down because the OS now needs to unzip before running?
Click to expand...
Click to collapse
No, this isn't actually zipping the PNGs themselves - the only purpose 7-zip serves is to unpack and repack the APKs.
coolbho3000 said:
I'm in the process of making/uploading a pack of APKs of javheroski 2.1.
No, this isn't actually zipping the PNGs themselves - the only purpose 7-zip serves is to unpack and repack the APKs.
Click to expand...
Click to collapse
Oh cool... I can see the usefulness of having smaller pngs..
I have a similar script that I used for my build, but i used the regular optipng at -o7 for all files. This should help me cram more stuff on my rom, thanks bunches. I have a question, though, I've yet to test this, but is there any adverse effect from running 9-patched pngs through optipng? They're encoded with extra instructions for stretching and padding. In my build, I only ran regular pngs, but if I were able to run the whole thing... I have to try this but I'm at work... Oh, wait, I'm the boss!, I'll try this later today.
---edit---
Oh, cool, I guess I didn't read right. I was trying to modify the thing so that it would recursively optimize extracted pngs in windows folders, but I read the bats and it actually opens up the zips and does all this itself, great! I should have read the post more closely.
dwang said:
Is this even necessary when pretty much every ROM uses app2sd?
And wouldn't zipping the png slow things down because the OS now needs to unzip before running?
Click to expand...
Click to collapse
my builds run pretty quick... I was doing this manually app by app. Check the new version I release and ask again cuz I only got half through them.
uhm i cant seen to get this to work. download your zip and extracted it to a folder. four files in it. placed all my apks into this same folder. ran the batch file but it just opened up and closed and outputted a 1kb file called "and"
NguyenHuu said:
uhm i cant seen to get this to work. download your zip and extracted it to a folder. four files in it. placed all my apks into this same folder. ran the batch file but it just opened up and closed and outputted a 1kb file called "and"
Click to expand...
Click to collapse
Need to be on your c drive or local.
drieves1 said:
Need to be on your c drive or local.
Click to expand...
Click to collapse
ok got it thanks! it was on my secondary drive not C drive. i tried it on cyanogen's system apps and it went from 14.2MB to 13.7MB, not a huge improvement but an improvement nonetheless. this app has a lot of potential for hero roms that really need those extra MBs haha.
if only the batch file can be edited to automatically create duplicate apk instead of overwriting just in case forget to backup. happens sometimes haha. maybe signing can be added to the batch script as well for market apps that need to be resigned since you cant just push them through like you can with system apps that are apart of the rom, they need to be installed.
dont try this on your framework though >.<. I did and it wouldn't boot, seems compression was too aggressive (something about 2XXXXXX to 1XXXXX something, dont remember what it was, but I think bringing o-49 should probably fix it for framework)
UNCOMPRESS_DATA_MAX (XXXXXXX vs 1048576). Causes errors on APKs that are over compressed. Any idea what setting it could be to keep it under that threshold?
hrmm.... I saw what's going on.... For some reason, the script is also processing resources.arsc. This file has to be left alone or it causes problems. I used the script to optimize all pngs, then i extracted all apks, and then i used the optimized pngs and put them back on the regular apks and it worked perfectly, though the gain is much, much more modest, about ~300KB coming from my previous -o7 optimization, and I guess I can attribute that to the 9 patch pngs I hadn't processed the first time around. Am I wrong that resources.arsc should be left untouched? a 10 MB gain is just what I needed to make all of hero fit in death spl's /system (and light hero on a regular spl).
ok, i see, the problem is the re-compression of the apk. I think it's not using the same zip format, so when dalvik tries to expand it causes a problem. roptipng should still save me A LOT of time though...
I'm not home now but try making the -mx9 parameter for 7-zip in apkopt.bat lower as well.
cool stuff, thanks man!
First, thanks for doing this. I have a suggestion. I think you should create an "original" folder and an "optimized" folder (or whatever names you like). So that you can drop the files into the original folder rather than copying them into the same directory. It would just be cleaner that way. Also, you could keep the orginal files in that folder and put the new ones into the optimized folder so people don't need to back them up. They would have both the original and optimized files when the process is finished.
Uploaded a new one with that. Thanks
Have you investigated into why some apks don't work after being compressed? or am I the only one having problems? Some apps compress at best compression and still work, but other apps have to be compressed less in order to work. I tried compressing the whole batch, and then trying to see which ones failed and then try compressing again with a lower setting, etc etc, but it's hard to do for services and non-launcher apps because you don't notice they don't work until you need them. I've seen other people use these scripts and produce working roms, so it might be something different with my setup (win7 64)

Optimizing apks

Doing a bit of this lately specifically on rosie. My res folder is like 36 KB (952.5 total) less than the rosie found in the gutted Rom thread (988.3). However my total apk is 1.2 mb while the gutted is only 1. Sup with that?
Are you sure mine is 1 MB? I double checked and I was only able to get mine down to 1.2MB.
Pic! Http://twitter.com/theresthatguy/status/6906940286
Edit: not talking about yours but the one posted in the attachment of rosiesmall3.zip sorry for confusion. Hope you can still help me.
I got mine down to roughly 930-ish k if i remember correctly and I can pare it down even more I just got tired of changing all of the images around. It takes forever. Also make sure you use the highest compression setting for zip files in 7-zip
obelisk79 said:
I got mine down to roughly 930-ish k if i remember correctly and I can pare it down even more I just got tired of changing all of the images around. It takes forever. Also make sure you use the highest compression setting for zip files in 7-zip
Click to expand...
Click to collapse
what programs are are you using on the pngs and also jpegs? Thanks for the 7-zip tip.
A good app for pngs is optipng. Im on linux and that's what I use. For jpegs I usually change the quality to be pretty low because for the most part it is not noticeable. Also remember to find an app that will remove all of the exif data and so forth on jpgs.
gimp and pngout
I changed the jpgs to white
google the best commandline options for pngout I have them written down at home but I'm 300+ miles away from home right now, and I don't have a laptop.
I've considered trying to convert the jpgs to png and changing the xml files to recognize them, but I have too many projects on my plate already. I imagine it should be doable.
obelisk79 said:
gimp and pngout
I changed the jpgs to white
google the best commandline options for pngout I have them written down at home but I'm 300+ miles away from home right now, and I don't have a laptop.
I've considered trying to convert the jpgs to png and changing the xml files to recognize them, but I have too many projects on my plate already. I imagine it should be doable.
Click to expand...
Click to collapse
one last thing: I'm using ubuntu box with no internet. I downloaded the p7zip and I believe I installed it correctly. Cd into the extracted contents did sudo make install command but having trouble finding documentation on actually creating a zip file. I keep finding how make 7z archives.
use wine and 7-zip for win? I dual boot so I actually do that kind of work in windows. I use linux for most everything else.

APK Batch Rename Tool (for Windows and Linux)

Hi guys!
This is a quick tool I jotted together for myself in the past couple days and found it very useful. So I decided to clean it up and share it. Hope you will like it! Do comment and ask!
APK Batch Rename Tool
* for Windows and Linux for now.
APK Batch Rename Tool recursively crawls input folder and all of its subfolders looking for Android Package files (.apk's). It reads Label and Version info from apk's found and creates a copy for each apk under the output folder but using the Label and Version info acquired.
For example a com.example.hw.apk will make Hello World! 1.21.apk provided that the label inside the package was set to Hello World! and version is 1.21.
The old and the new apk files are 100% the same in terms of content and are unchanged. Only the new copies are given new filenames. Input files are left completely intact.
Why?
Have you ever wondered what are your 1500+ apk files with wierd names nested to different wierd folders on your harddrive? Have you ever wanted to find an app but you were unable to because it had some undescriptive javaish name that made no sense reflected no version and your apps were swept across a hundred junk folders anyway? Then APK Batch Rename is the tool for you! And me!
APK Batch Rename will set a human readable name for all your Android apps, and drop such a copy into a folder. You will finally be able to browse them, sort them alphabetically and be able to pick from versions available.
How?
1. Copy all your apk files (or folders with apk files in them) into the input folder. You may copy folders of any depth. APK Batch Rename Tool will recurse all subfolders of the input folder anyway.
2. Hit or click ApkBatchRename.bat . (For Linux users it's: apkbatchrename, or on a terminal enter: ./apkbatchrename ) Wait until it finishes the job.
3. Find your freshly named files in the output folder.
Simple as that!
Have fun! & Comment!
phsorx
great work, just like reading mp3 tag then rename to "song - artist.mp3"
thanks!
Cool. I use to do it manually. Time saver app.
Thanks.
This is awesome! Thank you very much, situation you described in first post is just like mine, I find your tool very useful!
Folks,
Let me join you crediting phsorx's job, that app is just great!
Thanks and congrats!
Very cool, Works well. Always wanted to do this but was too lazy to try aapt.
I just checked:
aapt said:
badging Print the label and icon for the app declared in APK.
Click to expand...
Click to collapse
Code:
> aapt d badging Talk.apk
[B]package: name='com.google.android.talk' [/B]versionCode='130' [B]versionName[/B]='1.3'
sdkVersion:'8'
targetSdkVersion:'8'
uses-permission: **truncated***
application: [B]label='Talk'[/B] icon='res/drawable-hdpi/ic_launcher_google_talk.png'
uses-feature:'android.hardware.touchscreen'
main
other-activities
search
other-receivers
supports-screens: 'small' 'normal' 'large'
locales: '--_--' 'es' 'es_US'
densities: '160' '240'
I'll definitely use your script but with a small change to show the package name as well as its valuable for when you need to uninstall the package.
i.e label_packagename(version).apk -> Talk_com.google.android.talk(1.3).apk
Attached a slightly modified batch file and screenshot
For single file one-off renames (right-click->open with->rename single) you can use the script here.
De jo! Honfitars. Hajra Magyarok!
Customizable naming planned in future version
britoso said:
Very cool, Works well. Always wanted to do this but was too lazy to try appt.
i.e label_packagename(version).apk -> Talk_com.google.android.talk(1.3).apk
Click to expand...
Click to collapse
Hi Britoso,
Yeah! That's a neat way to do it too!
Eventually I want to make naming and spacing fully customizable! Including what attributes to pick (name, label, versionName) to constitute the filename, and what separators (_,-,(,),space) should go where.
In the howto.txt I have a little road-map for the project. Will add customizable naming too.
Will keep you guys posted.
EOF
phsorx
Ps: Anyone who has another naming suggestion drop a post! I'd be interested.
great job...bravo..
thanks
Very nice tool, thanks for sharing this .
Using it with britoso's edited script.
Edit: I would appreciate it if a log of the conversion would be saved in a \logs\ subfolder, so I can check which files were not converted properly and see if I have to do those manually.
Handy ! Thanks...
deleted
For one-off renames you can use the below batch file.
1) create the below batch file in the same folder as apkrename.bat (its attached too)
Name: rename-single.bat (change this if you want)
content:
Code:
cd "C:\change_me\ApkRename\"
apkrename.bat %1 %~dp1
Change the path(change_me) as needed.
2)Associate it with apks by right clicking on the apk and choosing "choose default program", browse and select the batch file "rename-single.bat".
Uncheck "make this the default operation"
Screenshot and batch file attached. Enjoy.
update:
-12/8 uploaded a new version that fixed a bug involving long path names with spaces.
Also added a check for success and then delete the original apk. (backup your apks just in case).
Remember to set the path to the ApkRename folder in rename_single.bat once before using it.
Really gd job )
APK Batch Rename Tool for Linux is on the way
luvgirl12345 said:
would like a linux version...
Click to expand...
Click to collapse
Hi luvgirl12345,
The Linux port is on the way & will be posted here soon!
Actually, the Windows release is running on win32 ports of a few common Linux tools. And that's so, because I am lazy. Having Linux's much better support for shell scripting plus the same tool set always at hand, porting is a breeze.
Ciao,
phsorx
Sounds very useful, thank you!
Looks nice for massive apk renaming.
Found a similar tool called APKInfo some month ago which i am using for single apk files for a while now.
But finally something for batch renaming.
Thanks
your the man!, works like a charm. Thanks!
Any plans for making an Android version of this to run on our devices?
Future plans for an on-phone version of the APK Rename Tool
del4 said:
Any plans for making an Android version of this to run on our devices?
Click to expand...
Click to collapse
Yes! Certainly. Its in the plans.
But firstly there are a few things to be fixed on the desktop version first. See road map section of the howto.txt file in the archive. The most burning issue is the so called overwrite issue that I want to be sorted out next. Say you have two copies of the same app (same name, label, versionName) but one of them has a patch against it (because its been modded by a reverser) than one of the copies will overwrite the other (ApkRename 1.10).
Secondly on a mobile device's SD card there is usually less space than on a desktop's hard drive. This implies that APK Renamer will actually have to rename the files in place instead of creating a copy of each in a separate folder. Or at least it will need to figure out the empty space left on the device, and if its not enough to hold the copies, it should offer in-place renaming instead. Not a lot of logic to add but still...
Having all the outstanding questions be figured out on the desktop still, will allow me to implement a more established version for the phone right from start. But hold still its not going to take very long
Bests,
phsorx

APK Edit v0.4, allows you to edit your apk file

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download​
Buy me a beer​
The download is based on old source code, I don't have that source anymore due to a hard-disk failure.
I'm rebuilding the application as a open source project.
Source code C# version (Windows)
Source code Java version (Windows / Mac OS / Linux)
With this little program you can simply change icons of your android application.
It even lets you change the applications name.
But wait mike..... there's more.....
It even lets you edit the text used in applications.
Sounds to good to be true...
Well... to be honest.... it is.
But I've come a long way from that initial question to the final answer.
My conclusion so far, it works for most of my applications.
It probably will work on most of yours as well.
(Caution: when overwriting an existing application you will loose your associated data!!!)
Special thanks goes out to:
Brut.all for creating Apktool, the backbone of this little project.
Requirements:
Java & .Net Framework 3.5 (Why build on one platform if you can build on two? I know, I know....)
For installing system apps - S-OFF
Nice to know:
Clicking on the [Icons:] tag in the General tab will open a browser window and search for icons in "Google images".
Donations will be "forwarded" to fellow developers like Brutt.all and others, reinforcing the greatness of today's world.
How the magic works:
When opening an APK file it first tries to decompile it using APK Tool (with the version selected in the settings tab)
If decompile failed, because of a missing framework file, it tries to find this file on your phone.
Most of the times it will find what its looking for, pull it off your phone and tries to recompile the whole thing again.
If somehow it cannot find the required framework file, it will provide you a list of possible files on your phone. You can then choose the correct file yourself.
Assuming this process finishes without any problem you now can edit the apk file.
When you press Apply it will recompile the apk and then sign the newly compiled file.
- System APK files (APK files that needed an additional framework file) will get a copy of the original signature.
- Other APK files will get a brand new signature.
When you Click the phone animation it will push the APK to your phone
- System APK files will be pushed to /system/app (ADB PUSH)
- Other APK files will be installed the normal way (ADB INSTALL)
If install failed due to some signature failure it will do some additional fancy tricks and try it again.
Upcoming features:
New option in settings tab -> Only allow one instance of APK Edit to open at once.
New option in settings tab -> Add/remove APK file association to registry.
New option on startup -> Option to open up a "Phone Explorer", lets you edit APK files directly from phone.
Known issues:
CarHomeGoogle.apk - Doesn't save changes
Quickoffice.apk - Doesn't show up after installing
Version history:
Code:
[I]0.4e - Minor update[/I]
Added: Some more debug logging on startup of the application.
Fixed: Version number in settings tab now shows correct version.
[I]0.4d - Minor update[/I]
Fixed: Fixed startup crash if some APK properties are empty (like screensize/densities/locales), like in Settings.apk.
Fixed: A little bug in the fancy install mechanism, mainly experienced when installing system apk's
[I]0.4c - Minor update[/I]
Fixed: Compatibility issue with Windows XP, causing program to crash on startup.
[I]0.4b - Minor update[/I]
Fixed: Error extracting signature.
Changed: Extended logging.
[I]0.4a - Minor update[/I]
Changed: Logging is enabled by default.
Added: Some debug messages for when opening of apk goes wrong.
[I]0.4 - Major rewrite[/I]
Did a major rewrite of the code.
Added: Option to choose APK tool version
Added: Logging feature
Added: Auto retrieve required dependency files from phone if needed (for editing system apps)
Added: Details panel, shows information about the package.
Added: Restore original file link, for when thing's get really messed up.
Added: Donate button, for those who wanna celebrate with me.
Fixed: Some annoying issues ([URL="http://code.google.com/p/android-apktool/issues/detail?id=100"]APKtool Issue 100[/URL]) / ([URL="http://stackoverflow.com/questions/4709291/android-no-resource-identifier-found-for-xlargescreens"]XLargeScreens bug[/URL])
Removed: QR Code installation support
Removed: AdbWireless installation support
[I]0.3 - Update[/I]
Added: Language support.
Added: Installation method (USB Cable).
[I]0.2 - Minor update[/I]
Added: Save confirmation dialog (as req by [URL="http://forum.xda-developers.com/member.php?u=2987317"]droidzone[/URL])
Changed: Recreated the loading animation so that it theme's better with the rest of the application.
[I]0.1 - Initial release[/I]
For the record... only use on you're own apk files, otherwise it's not that legal I think.
Looks nice..
I got an error on one apk though..There seems to be an unhandled exception when the filename contains special characters..
Other than that, the program looks and works awesome..Will comment in detail after I decompile something major..
Thanks//
One question:
The program shows smali files below the main prog, and on selecting the folder it opens in explorer. Would changing the smali be updated in the main prog on clicking Apply? Also a dialog to say that the file has been saved with changes, would be nice.
Tnx for the input, will look into the filename handling!
In the background it recompiles the whole thing, so changes to the smali code should be included in the application if you press apply.
About that dialog.... it's being grown in its incubator now..
Think it will hatch tomorrow
Anoniem100 said:
Tnx for the input, will look into the filename handling!
In the background it recompiles the whole thing, so changes to the smali code should be included in the application if you press apply.
About that dialog.... it's being grown in its incubator now..
Think it will hatch tomorrow
Click to expand...
Click to collapse
Excellent! Thanks again, will pop in later to get the revisions
droidzone, tried out some weird combinations for the filenames but couldn't simulate your problem. Could you give an example?
When i try to open it, Windows 7 says it has stop working???
Anoniem100 said:
droidzone, tried out some weird combinations for the filenames but couldn't simulate your problem. Could you give an example?
Click to expand...
Click to collapse
I can do better.
My filename is Sample of Filename★(1.1).apk
Maybe the★ character is doing it
I've attached screenshots of the error.(Exception1.jpg)
Error Handle: The directory name C:\Users\Kpcc\AppData\Local\Temp\Sample of Filename?(1.1) is invalid.
I'm also attaching a text file with the actual error code given in the exception>Details. ( exception error text.txt)
The blanked out part is my actual username. Just an alphanumeric. Let it be Kpcc.
Edit: Got one more exception. This occured after inputting the ip of my phone in adb wireless and pressing enter. (Exception2.jpg, Exception2.txt)
max63094 said:
When i try to open it, Windows 7 says it has stop working???
Click to expand...
Click to collapse
Maybe a missing .NET framework? The filename handle is the only error I'm getting in Win 7 Ultimate 64bit. And the filename I used is of course not "normal"..
By the way, a few more items on my wishlist:
1. Advanced Search (and replace?) for strings, with ability to use F3 for finding the next instance
2. Sorting the strings/variables in alphabetical and order of occurence, and another coloumn in the content tab with the name of the smali file in which the string appears.
3. Ability to Save As, without modding the source file.
4. Adb push via cable
5. Listing all the smalis in a tab, and ability to manual edit each one individually (Opening up Notepad would be fine. Maybe a Shell "Start file.txt"?)
Just a few wishes which would make it a powerful tool..
@max63094 Hmmm, what could go wrong... think droidzone is onto somthing with his comment about .net framework.
I used the .Net Framework 3.5 to create the whole thing.
You can download this for free at Microsoft
@droidzone, tnx again for the input and will work on the file issue, nice wishlist btw!!
Stuff I get exited about
I'm afraid I can't promise you all the requested features, have to check the required ammount of effort for some of them.
Have to balance my time, you know how it is whahaha
Sorting alphabetical shouldn't be that big a problem, as for the save as and adb push via cable.
Will work on those first!
Anoniem100 said:
@max63094 Hmmm, what could go wrong... think droidzone is onto somthing with his comment about .net framework.
I used the .Net Framework 3.5 to create the whole thing.
You can download this for free at Microsoft
@droidzone, tnx again for the input and will work on the file issue, nice wishlist btw!!
Stuff I get exited about
I'm afraid I can't promise you all the requested features, have to check the required ammount of effort for some of them.
Have to balance my time, you know how it is whahaha
Sorting alphabetical shouldn't be that big a problem, as for the save as and adb push via cable.
Will work on those first!
Click to expand...
Click to collapse
Of course..I know how even the tiniest of things can go wrong in an effort which involves file i/o..I'm rather amazed that your Version 0.2 is so finished! A month ago, I was working on a Gui File Explorer for Android, with Adb and Fastboot commands..However time didnt allow me to complete it..
Have you used apk manager? That's what I use when it comes to decompiling apks. Of course once it decompiles, all the rest of functions has to be done by hand. If you havent, check it out. It's the only other program which comes close to a gui. That uses batch commands of course.
@droidzone, Yeah, time sucks! ever finished a beta?
Funny you mention apk manager.
I'm fairly new to the android scene, but i bumped into apk manager yesterday.
Looks very promising, thinking of replacing the backbone with the crazy work of our dear friend Daneshm90.
Read some interesting stuff about the compression size in correlation to compatibility it could provide.
Maybe a little slider in the settings tab, giving you a simple tweaking mechanism.
Something like:
Big size (compatible) -------------------- Small size (less compatible)
Anyhow.... my brain is making overtime here ;-)
hmm .. just took an app .. changed the icon and the title .. and uploaded it back to the phone.
App doesn't appear anymore.
What might have gone wrong?
Not even a beta. It exists as several separate modules, which have to be joined together. Work stopped when I had to give my phone for service.
Via T3 phone of the year 2010 - HTC Desire
daniello8 said:
hmm .. just took an app .. changed the icon and the title .. and uploaded it back to the phone.
App doesn't appear anymore.
What might have gone wrong?
Click to expand...
Click to collapse
Euhm... I renamed the title once and couldn't find it in its original place.
The app drawer will place icons alphabetical.
But maybe that was just me being stupid (this really happened whaha) and your app really vanished....
Is it just one app that has this behaviour?
droidzone said:
Not even a beta. It exists as several separate modules, which have to be joined together. Work stopped when I had to give my phone for service.
Via T3 phone of the year 2010 - HTC Desire
Click to expand...
Click to collapse
To be continued...
Anoniem100 said:
Euhm... I renamed the title once and couldn't find it in its original place.
The app drawer will place icons alphabetical.
But maybe that was just me being stupid (this really happened whaha) and your app really vanished....
Is it just one app that has this behaviour?
Click to expand...
Click to collapse
I only need a new icon for this one app .. so I didn't try others. Sorting is not the problem. I was hoping that someone gets a deja vu.
@daniello8, what method did u use for installing?
Anoniem100 said:
@daniello8, what method did u use for installing?
Click to expand...
Click to collapse
adb push <appname> /data/app
Edit: Just tried with astro .. but install fails :-(
Edit2: The app icon displays correctly though *fwiw*
daniello8 said:
adb push <appname> /data/app
Edit: Just tried with astro .. but install fails :-(
Click to expand...
Click to collapse
O oh... anyone...
Hmm... probably has to do something with compression levels...

[Q] I really need some help dealing with image files...

So basically what I am doing is fixing some of this application's code(and I assure that the developer of this app allowed free modification). Currently, this app shows pl_starthere.png for certain time, and apparently is stated as an bitmap file. But I wanted to put animated gif file instead of it.
So I changed the animated file's name into pl_starthere.gif, deleted the original png file, and fixed the file name in the smali file into that gif file. However, it showed me stationary image.
The point is, how can I make it animated? I could probably copy and paste the whole code onto this thread if necessary, but I thought this may be enough for code gurus at xda(and really hope it actually is).
Well, thanks for reading. I would really appreciate any kind of help.
I'm still new to Android myself but from my experience with Windows I know that the program being used to display the image has to be coded to be able to display animated images otherwise it treats them as static. Which means code would have to be added to the app for that.

Categories

Resources