Hello XDA-Members,
I want to add some function to my system music player app. So I decompiled the classes.dex with dex2jar, copied the source code and add the code for my functions. Now my problem is that I do not know how to recompile the app. I can't compile it with Eclipse because it uses some system namespaces (in Eclipse it is an error so I can't compile) How can I recompile the app? I only have the *.java files.
Or can't I use the java files and have to edit the smali files? Of course that's much harder...
Greetings Cilenco
Do you mean this music player? https://github.com/android/platform_packages_apps_music or the google play music one? If you mean the first one, try to edit the original source as it's provided by google and if you don't manage to compile it, send it to me and I'll give it a shot At the moment, I'm building PA so my linux system is busy, but if it's done I'll try to get your files compiled
If the second is the case, one problem is that google play music is not open source (afaik) and java files sometimes aren't decompiled right. Anyway, if you sent me the java files I could try to compile them as well
Sorry that I didn't named the app. I have a custom ROM and it is the music app from Sony Ericsson. Here is the apk:
http://goo.gl/GwdqYU
David:D said:
If you don't manage to compile it, send it to me and I'll give it a shot
Click to expand...
Click to collapse
What would be your way to compile the source files? Is there a way to compile the java files with Eclipse although the app uses system resources and libraries? Of course I can get all resources, the manifest and so on from apktool. I mean if you can get it work I want to learn it too. I think this is a very exciting piece of coding / reverse engineering. I'm able to decompile system apps, change their resources and so on but I do not know how to compile them from java source.
I'm building some ROMs on my PC so if the app uses some system resources and libraries, they should exist in this build environment I would basically try to put your files as an additional package in my build environment.
Ah okay I believe I understand: To build an system apk from java code I have to build the whole ROM again? Is the flashable zip enough to compile the apk? Probably not, right? I use a custom ROM from the forum here so I think I don't get the source. Or can I use the source from the sony developer site?
Is there any tutorial or guide how I can do this? Maybe I want to do this with more apps so it would be great if I can do it for my own and do not have to ask you all the time
p.s maybe we should write PNs then we don't spam the forum and we can write on German
Ok, I had a look at the apk and it seems like it's not correctly decompiled. I could easily import it to eclipse but the problem is, that some types aren't named correctly. That caused about 3000 errors No system files are missing, it's just not possible to completely decompile it. Maybe some parts of it are obfuscated (one problem was, that there was a com.scalado.a package and a com.scalado.a type etc.)
At least, I wasn't able to completely decompile it... I used dex2jar to convert it to a jar file, then I decompiled the class files using jd-gui and got the resources + androidmanifest.xml from apkool. How did you decompile it?
Probably, you'll have to edit the smali code...
Or maybe it's possible to just compile the files you need. Maybe it's enough to place the jar-file in the classpath so you don't have to decompile all dependencies. What files did you edit?
Hi,
Could anyone help me with my problem?
I'd be eternally thankfull
See: http://forum.xda-developers.com/showthread.php?p=48976088#post48976088
Related
Hi all,
I'd like to modify some .xml files in the Gingerbread Theme that are in the resources.arsc file. I'm using Apk Manager 4.9 and I'm unable to compile twframework-res and framework-res: a lot of errors appears and resources.arsc isn't rebuild. It seems that it's a problem of dependencies. What file(s) I need ? Is there a way ?
I have a lot of errors like this :
"......\public.xml:172: error: Public symbol drawable/ic_menu_account_list declared here is not defined."
I tried with all the 38 themes and it's the same thing.
Note: When i use apk manager with an app it works and resources.arsc is rebuild.
Thanks in advance
clarkkov said:
You should discuss this with the app developer, this is obviously app specific issue - and who is most likely to know this app the best(?). I think that framework.apk(s) depend on more .apk(s) inside the OS, i.e. they are not independent like the 3rd party apps.
Click to expand...
Click to collapse
Yes. It's strange because when I use apk manager with a stock framework apk (JPM for example) there are no errors and resources.arsc is rebuild. So there is no dependencies with the OS...
And all the modded themes are uncompilable ...
thx !
I found the reason :
The framework-res.apk contains corrupted .9.png's images files ...
And every theme posted around there were modified with the sames .9.png's corrupted files ! Someone forgot to use the tools to mod this king of files or forgot to compile them ...
So, to solve this and to be able to compile all the framework-res.apk you have to get back the non corrupted .9.png's files from stock ROM.
I think the same problem is also present in twframework-res.apk; I will see later.
cheers.
Well, I was going to put an app up on the market for a seminar , [and yes, i did use that Google app Builder], so when i tried to upload it, it told me that some value in the AndroidManifest.xml had to be a 32-bit integer.
So, I opened up that apk, viewed the manifest.xml file, but it just looks like a load of gibberish to me -__-
Now, I'm a bit new to all of this, considering that 11th grade's keeping me a wee bit occupied, so I guess I'll need some help with this.
[And note: Umm. Do not flame me for coming up with this, I'm not blaming google's app builder, or anything like that, anyway]
I've come across a couple of things like apktool, but each time i run it, it tells me that there's a file in jre7 that cannot be opened, apparently. Touche :|
It's an old question, so I guess you don't care too much about the answer by now, but to help others with a similar query, there are 2 ways to read the AndroidManifest file if you have the apk file.
1) If you extract the apk to a PC, you can use the apktool or similar to get a text version of the AndroidManifest.xml file
2) Alternatively if you have the apk already installed on an Android device you can use something like App Detective (https://play.google.com/store/apps/details?id=com.zmarties.detective) to view the AndroidManifest.xml directly on the device, even for paid apps that you can't extract from the device. (Full disclosure, I wrote App Detective).
I used dex2jar to decompile classes.dex , and used jdgui to convert those files into java files to edit, now I don't know how to recompile back, I'm not even sure it will work properly, or at all, but worth a try, I was trying to mod the vanilla Messaging app and remove all the attachment options for videos, pictures etc. because it's a waste of space, any help?
Use baksmil n smil tool ita simple.....
don't forgot hit thanx....
Probably might not work. The java files you get aren't quite the right ones. They will give you an idea of what to edit in the smali though.
Seeing as it is the stock messaging app, you would be better to download the source of the app from AOSP, edit that and compile. As said above, dex2jar does not give perfect Java code, so even if you did recompile it, you might not get a working app.
Or you could use baksmali to decompile the app to .smali format, and then use smali to recompile after editing the .smali files (not as easy to edit as Java source files).
The Smali Files are the machine language file type thing isn't it?, I've learnt the basics at Uni (using Spim), and understand what each thing does, but as it isn't directly coded, there isn't enough comments, for me to do anything with, I need to have some kind of info about what this does and what that does.
And about AOSP, I've tried downloading the source and It should be all downloaded and I've tried compiling it for my device (Sony Ericsson Xperia Ray (ST18i, Urushi) but it always comes up with errors, so I have put that stuff aside and gone back to attempting to mod some apps (First time, newbie), but I don't know where the Messaging App would be and how to change it. Sony Ericsson have Source Code for their Stock rom right?, I have tried getting hold of that, but have no idea how to read the file, and edit it, so it's much like AOSP. How to read files and how to edit and compile them?.
I own a BB Playbook tablet for about a year now (bought it during the when it was about 200$ because I needed a 7'', the hardware was specs were nice at the time and the company promised Android app support). Regardless of the sanity of my decision the device saves me about 2 hours per day (I use it mainly to read pdf and build an xls database).
I've converted many apk to bar in order to sideload them to my device (not all of these work). Recently I tried Firefox on my Xperia mobile and was quite pleased with the ABP plugin So I tried to convert the apk but both the apk2bar and the Blackberry Graphical Aid Tool complain that the version number is too long...
Anyone knows how to shorten it? In what file is it located? Or anyone up for the task.
Keep in mind I'm not a dev.
Thanks in advance
android:versionName is what you need to change.
Thanks for the reply.
Tried the apps from your sig. I managed to edit AndroidManifest.xml. Recompiling (after the changes) doesn't seem to work (the result apk is much smaller... many files/folders from the original FF apk were not in the project folder or compiled apk).
Tried unpacking + zip + sign but this last step is failing. Wanam APK suite keeps giving an error message. My box runs Win7 x64 and at first I only had Java RE x86 7.10... it didn't find Java in my machine and stated signing would not work; after I installed the x64 it gives no preemptive messgae and I progress further but the signing process fails
frmariam said:
Thanks for the reply.
Tried the apps from your sig. I managed to edit AndroidManifest.xml. Recompiling (after the changes) doesn't seem to work (the result apk is much smaller... many files/folders from the original FF apk were not in the project folder or compiled apk).
Click to expand...
Click to collapse
Hi.
Look at the files in the apk before decompiling it and you'll see that all those files and folders aren't there to begin with. All those files and folders are from the decompiled resources.arsc so it's normal for them not to be there when recompiled, and when you add the resources.arsc, manifest and meta folder from the original apk to the recompiled apk, it will become larger.
I noticed yesterday I had put an old apktool in the folder but have corrected it now so download and try again.
I was attempting to do the same so I decompiled and edited the android:versionName and the android:versionCode . After doing that, recompiling and resigning I was able to convert using apktobar and load to the playbook with no issues......except the app opens to an all white page and nothing beyond that will work! Just to be clear I was attempting to convert Firefox as well. Hope someone has some helpful hints that could fix it!
Is there any universal framework-res.apk that can be used trough apktool, to retrieve xml files? because I am confused, I don't want to install my app on any mobile device!! (just to play around with code) and everywhere people write about ROMs and getting the framework from my device, in order to get my apk to compile with apktool? WHAT?! believe me, i am doing my research but I just cant seem to find a connection between the needed framework.res, and some randomly downloaded camera.apk?
How am I supposed to find appropriate framework for any downloaded .apk from internet? is it possible? I have tried with obviously non appropriate framework-res, it gives me lots of errors, after -apktool d example.apkk. Again, I don't have intention of installing it on any device, yet. as I said before, I would like to get code, to learn from it and to play with it, xml is the issue now, because of this framework-res stuff!! While java non 100% code I have!
Thank you for your time