[Q] Problems in editing framework - General Questions and Answers

I'm recently trying to edit my framework with this mod
http://forum.xda-developers.com/showthread.php?t=1916094
Well actually the steps in that thread are very simple, but since I'm trying to apply that to my Xperia Ray so it must have slightly different steps
What I want to ask :
- In framework/res, I found drawable-.........( mdpi,hdmpi,ldpi,etc.). If I'm going to replace the .9png's picture in there, should I make the picture as same as the original picture dimension? I'm using Dev-Drawable app in the Play Store ( it makes picture to drawable- hdpi,mdpi,etc. ), the result of using it is it gives me the mdpi version of the picture but with different dimesion from the original picture.
- I found errors and it says that I have errors in the /res/values/public.xml
I found this :
Code:
Don't do that! :) I think I should explain the purpose of public.xml file in the project wiki, because many people are confused. Note that you don't need this file when you build an apk from sources and apktool building mechanisms are very similar, so guess what: you could remove this file from decoded application and apktool will rebuild it without any problems. I had a reason why to generate public.xml - it's a feature, not a bug! ;)
Well, the reason is: there may be references to resources in the application code. If resources ids will change after build, then code will reference different resources than in original apk. public.xml file gives us sureness that resources will get same ids after build - it's the only one reason to use this file. And you want to manually modify these ids ;)
Adding or removing new resources is somewhat tricky. Yeah, I should write about that in the wiki.
You could remove any line from public.xml (even making a "hole" in the ids) at any moment, but you must be sure, that resource isn't referenced in the code.
There is never much sense in modifying ids in public.xml, because then modified lines lose their purpose.
If you want to add new resources, e.g. drawables and use them in the XML files you don't have to change anything in the public.xml file.
If you want to add new resources and use them in your code, then you have to add them into public.xml, because you need to reference them somehow. Or you could use Resources.getIdentifier() method, but this is ugly.
And now the most tricky part: if you want to remove some resources, you have to remove info about them from public.xml as well. So first you have to be sure that they aren't referenced in the code. But there is also this "hole" problem, so:
If these resources are at the end of ids stack, then there is no problem.
If resources are near the end of ids stack and you are sure, that all resources after them aren't referenced in the code as well, then you could just remove them all. Actually you have did virtually the same, cause after modifying ids you made these lines totally useless, you broke them, so you could just remove them.
If you want to remove some resources, but add same or greater quantity of new ones (of the same type), then there is no problem - new resources will automatically fill in "holes" in ids. You don't have to add them to public.xml .
If none of above conditions are met, then you have holes and you have to fill them by something. But you don't have to add "useless .pngs" - just add:
Code:
<item type="drawable" name="DUMMY1" />
<item type="drawable" name="DUMMY2" />
<item type="drawable" name="DUMMY3" />
...
Like above, you don't have to add these resources to the public.xml .
And because I'm a newbie I don't really get what that mean. So I just delete the files that I'm going to replace and I can re-compile the framework, but I got bootloop, LOL.
I confused about :
1."You could remove any line from public.xml (even making a "hole" in the ids) at any moment, but you must be sure, that resource isn't referenced in the code."
What are the "holes" and " referenced in the code" mean?
2. Because I want to add .png's picture to the drawable-mdpi folder, Do I need to add dummies to the public.xml ?
3. I'm using the tricky signing method ( open archive in the original framework, copy meta-inf & android manifest and replace those files to the modded framework). Is this cause me an error?
Help me mateee:crying:

anyone???

Related

Framework Recompiling

Basically I have two frameworks, frameworkA.jar and frameworkB.jar. I have decompiled both of these with baksmali. FrameworkB has some requests frameworkA doesn't, and some .smali output files are also absent from A that B has. My question is: can I make some sort of twisted merge of these?

.java/.smali help (small donation)

This can be moved to development if needed.
^prob some Android exp needed as well, but if you're here reading this I assume you have some.^
I am interested in adding an extended power menu, among other things (CRT anim ON if possible, and maybe a few other small ones.)
While I am reading my intro to Java Programming. I understand Basic programming, Java is what I need to learn. I am also studying .dex in hopes of one day being able to at least edit it.
If anyone would like to help , I have managed to decompile .dex into .jar and from .jar got all the .classes, etc. and then decompiled to .java, which is so much more readable than .smali. ( as it should be)
I have followed the few guides I could find for extended power menu, trying a few different things as I understand all devices are different. flashed and booted, but power button does nothing.
From what I understand it is actually possible to compile .java to .smali to .dex
from what I can gather this involes adding a mReboot:I options to reboot or reboot recovery. Then adding the array to the power menu, then adding the drawable ids and string ids (which I know how to make with apktool).
I saw one thread stating an entry in build.prop ro.mot.deep.sleep.enabled=true was also required.
PM me or reply if interested. I can upload .java files.
--just trying to get some fresh "development options going"
my next book will liekly be the : 6-in-1 building an android app, which I have done with the google App Inventor. It was fun.
*small donation can be made*

[Q] To which language does the following code belong to ?

Hey Guys,
Recently I was planning to learn to code android apps, so I decompiled an app I wanted to modify & was going through the source code. All of the .smali files were un-encrypted. I would like to know if this code is Objective-C or Java.
I tried to add the code snippets & also tried to pastie it but apparently the posts doesn't seem to accept foreign links so I'll try to post it in the comments.
File Names: h, h$a
Also, I wanted to know what do these file names represent & what does the "dollar" sign stand for in the file names.
Thanks in Advance,
Netguy
Update: I tried posting it via comments but it wasn't possible. Let me know how can I share the code over here. Thanks.
Smali is disassembled Dalvik virtual machine byte code.
The source of it is Java, although you can't easily reconstruct the original source.
MyClass.smali is the class file for MyClass
MyClass$SubClass.smali is the class file for the nested subclass SubClass
MyClass$1.smali is the class file for an anonymous nested subclass.
ab.smali and ab$bd.smali are obfuscated file names.
Some companies rename everything using automatic tools to hide the intent.
Yes, you can write in smali if you like.
Usually such use is limited to small changes in an existing program.
Thanks a lot for the information Renate NST. While digging through some of the smali files, I found some URLs related to the google ads. So will changing the URL to something else disable the ads or will it just result in malfunctioning of the app ? Thanks a lot once again.

how to against apk-tool&modify apktool,protect my app?

code.google.com/p/android-apktool/wiki/KnownIssues
The author' wrote:
Some APKs won't decompile
I've found that some APKs don't conform to regular Android standards. They were probably built using a modified aapt, which makes decompiling near impossible. These APKs are called "Magic" apks and probably won't be supported.
can i protect my app?
I'm interseted in " modified aapt",but i have no idea about it,who can help me?
thank you
thinkinbunny said:
code.google.com/p/android-apktool/wiki/KnownIssues
The author' wrote:
Some APKs won't decompile
I've found that some APKs don't conform to regular Android standards. They were probably built using a modified aapt, which makes decompiling near impossible. These APKs are called "Magic" apks and probably won't be supported.
can i protect my app?
I'm interseted in " modified aapt",but i have no idea about it,who can help me?
thank you
Click to expand...
Click to collapse
You can try 'Anti Decompiler(Android)Trial' on google play .
https://play.google.com/store/apps/details?id=com.tth.AntilDecompilerTrial
*** Main function of 'Anti decomplier (Android) Trial' App:
- Obfuscate class names, function names, filed names, files name in your source code(Proguard doesn't support to change file names) to make them harder to read.
- Add fake code to your source code. The decompiler tools will get a lot of errors when trying to reverse your original code from the exported apk files.
...+Note Trial: ' Add fake code' is not available on Trial version ---​- Hide all const values (string, character)
...+ Note Trial: ' Hide const values' is not available on Trial version ---​
Isn't proguard/dexguard not what your are searching for?

Recompiling with additional resources and activities

Hello All,
I have an application that I want to add some features to in the form of an additional activity. I have decompiled it with APK tool and attempted to add my own smali files (from the decompiled 2nd app that I developed). I immediately run into problems with the dependencies of my app being different than those of the original app. For example, my app uses the google Easy Permissions lib to ask for permissions. What is the right strategy to help de-conflict the res/values/*.xml files between two apps that both have their own resources? Are there any tools that can assist in this? What about layout and drawable resources?
I started writing a python script to merge public.xml and the others, re-map the ID's for those resources, and then search the smali files to change the values there. That seems error-prone, and I am not even sure if that is the right thing to do.
I had a second thought that perhaps aapt2 compilation of resources could perhaps be modified to give me a different package ID for the app I created and control source to (such as 0x80... instea of 0x7f...) but I am not sure exactly how to go about that, or if that would even work either
Any advice or tools I should be looking at?

Categories

Resources