[Q] Creating an ADW Theme 317 errors woo! - Android Themes

So .. I'm trying to create an ADW theme.. I've been following the rules that was set by the creator in his theme template (http://github.com/AnderWeb/ADW.Theme-Template)
I keep getting compiler errors though which most of them similar to this:
error: Error: No resource found that matches the given name (at 'drawable' with value '@drawable/box_launcher_top_normal').
the error seems to make sense since there is no box_launcher_top_normal in drawable..
but there is a .png file with that name in drawable-hdpi or something.. I don't get why it keeps doing this anyone care to lend a noobie help? I'm using eclipse btw.

selfless bump:
I seem to fix the 317 errors but these are still bugging me:
error: No resource identifier found for attribute 'installLocation' in package 'android'
error: Error: No resource found that matches the given name (at 'label' with value '@string/theme_title')
and
Java Exception Breakpoints
Unknown
Unknown

The installLocation error is because you are not building the package against Android 2.2.

that's interesting.. i have to use the 2.2 one despite i just want to make it for my eclair phone D: ? mm.. how about the other ones
here's the manifest that's giving me trouble.. only thing i changed were the ones indicated to be changed which is package name and versions
http://github.com/AnderWeb/ADW.Theme-Template/blob/master/AndroidManifest.xml

darkamikaze said:
that's interesting.. i have to use the 2.2 one despite i just want to make it for my eclair phone D: ? mm.. how about the other ones
here's the manifest that's giving me trouble.. only thing i changed were the ones indicated to be changed which is package name and versions
http://github.com/AnderWeb/ADW.Theme-Template/blob/master/AndroidManifest.xml
Click to expand...
Click to collapse
Don't worry, it will work fine (At least the build against 2.2 part).

woo fixed the others.. now these are left:
this next error is the same except for the methods involved are getItem(int), getCount(), getItemId(int) and getView(int)
Description Resource Path Location Type
The method getItem(int) of type main.IconsAdapter must override a superclass method main.java /com.darkamikaze.monster.theme/src/com/darkamikaze/monster/theme line 76 Java Problem
these are some lines involved in the error in main.java
@Override
public int getCount() {
return mThumbs.size();
}

darkamikaze said:
woo fixed the others.. now these are left:
this next error is the same except for the methods involved are getItem(int), getCount(), getItemId(int) and getView(int)
Description Resource Path Location Type
The method getItem(int) of type main.IconsAdapter must override a superclass method main.java /com.darkamikaze.monster.theme/src/com/darkamikaze/monster/theme line 76 Java Problem
these are some lines involved in the error in main.java
@Override
public int getCount() {
return mThumbs.size();
}
Click to expand...
Click to collapse
Have you resolved this? I'm getting these errors :|

Related

[GUIDE] T-mobile theme engine for the faint at heart (non-linux users)

Hi guys,
This is a guide I put together to make themes for the T-Mobile theme engine based mostly on what i've figured out by digging into haxzamatic's awesome template.
This does not require you to be on linux or whatever.
This is mainly a temporary guide till an Eclipse template for the engine is released, or for those who dont want to use eclipse, etc.
Requirements:
-You should know how to decompile/recompile/sign apk files.
-You should know some basic xml editing and theming.
-basic terminal commands
-You must install the framework for apktool, navigate to the folder containing framework-res.apk and execute -
apktool if framework-res.apk
GUIDE:
1. Get the compiled Templatebread from here: http://bit.ly/hdEWsf
2. Decompile it with apktool or whatever you use.
3. Open the AndroidManifest.xml
4. Change the names according to your theme. Here's my manifest for my NTSense theme:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:hasCode="false" android:versionCode="2" android:versionName="1.1" android:installLocation="internalOnly" package="com.nhnt11.theme.ntsense"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:pluto="http://www.w3.org/2001/pluto.html">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="9" />
<application android:label="@string/theme_name" android:icon="@drawable/icon">
<activity android:label="@string/theme_name" android:name="com.tmobile.theme.Foo" />
</application>
<theme pluto:themeId="NTSense" pluto:styleId="@style/NTSense" pluto:name="@string/theme_name" pluto:preview="\@drawable/preview" pluto:author="@string/author" pluto:copyright="@string/copyright" pluto:wallpaperImage="@drawable/wallpaper" pluto:styleName="@string/style_appearance_name" pluto:ringtoneName="Standard" pluto:ringtoneFileName="media/audio/ringtones/Standard.mp3" pluto:notificationRingtoneName="Subtle" pluto:notificationRingtoneFileName="media/audio/notifications/Subtle.mp3" />
</manifest>
Note that the template xml file has "pluto:name="\@string/theme_name" - you need to remove this backslash, its a typo. it should be just "@string/theme_name" Should not be needed using latest version of apktool.
More detail about stuff in the manifest in 2nd post.
5. Open /res/values/strings.xml. Edit to match your theme. Here's mine again:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="app_name">NTSense Theme</string>
<string name="theme_name">NTSense</string>
<string name="style_appearance_name">NTSense</string>
<string name="author">nhnt11</string>
<string name="copyright">nhnt11</string>
</resources>
6. Same for /res/values/styles.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<style name="NTSense" parent="@android:style/Theme" />
</resources>
NOTE: the name of your style must be the same as the pluto:styleID in the manifest!!!
7. Now, if you are making a theme from scratch, go ahead and just edit the images already in the hdpi folder. compile and sign. done. But, read on anyway because i explain how the theme engine works below.
If you want to port a theme, here's what to do:
First, go ahead and delete all the drawable folders. Now, copy your THEMED drawable folders into the directory. You now have to add the following to your theme:
/res/drawable-_dpi/preview.png (prefarably hdpi I guess) (I suggest that you DO NOT remove the backslash in the manifest as different locations of preview.png do not work on different screen sized devices. RETAIN the backslash!! Your theme will not have a preview, but this is a small trade off to get themes working if you're not on linux.)
/res/drawable/wallpaper.png (this can be in drawable-_dpi for different screen res. too)
/res/drawable-_dpi/icon.png.
More detail on those in the second post.
8. Now go to /res/xml - there are a ton of xml's here. Open redirections.xml.
Here, there are entries for specifying which XML redirects which app. Add entries like so:
<package-redirections android:name="<app package name here>"
android:minSdkVersion="7"
android:resource="@xml/your_xml_file(without '.xml' at the end)" />
You have now specified that you want resources in <app> to be redirected based on what's in your_xml_file. Where and what is this your_xml_file and how do you add/modify it? That's what the rest of the xml's in the res/xml folder are.
The rest of these xmls are the heart of the theme engine. How they work is, when android asks for an image or other resource, they come in and switch that resource for your themed one. So its sort of like a proxy server.
Each xml contains the redirections for an app.
For example, redirections to framework-res.apk are in android.xml, and SystemUI is in com_android_systemui.xml
Delete files corresponding to apps you have not themed (for consistency, you might also want to delete the corresponding entry in redirections.xml. If you don't know how, just leave it). You can also add apps by using the convention, <package name>.xml where dots in the package name are separated by underscores, ie. your_package_name.xml for your.package.name
Package names of apps can be found in their respective AndroidManifest.xml's after decompiling. See 2nd post for more detail.
To redirect files, for eg. title_bar_portrait.9.png, just add the item to the systemui xml like so:
Code:
<item name="drawable/title_bar_portrait">@drawable/title_bar_portrait</item>
Note: To make it easy to add hundreds of drawables, I've written a little xml generator - here
Here, the "name" part tells the theme engine WHAT you're replacing.
the part inside the item tag ("@drawable/title_..... in this case") tells it WHAT to replace it with.
In all android packages, the @ sign means that you are referring to a resource in the package. Also, you can refer to a general system-wide resource by using @android:<whatever>
for example, you can replace the above title_bar_portrait with statusbar_background thats already in the android framework like so:
Code:
<item name="drawable/title_bar_portrait">@android:drawable/statusbar_background</item>
After the @ symbol, you have to specify the type of resource. in this case, "drawable".
Note that because the @ symbol refers to something INSIDE your package, you SHOULD NOT use it in the item name="<blablabla>" part.
See Variables in the second post for more detail.
Back to the xmls.
Pretty much all images are ALREADY entered in the xml. Just do a find and replace and get rid of all the "frameworks_res_" and "com_android_systemui_"
for eg, it already has <item name="drawable/title_bar_portrait">@drawable/com_android_systemui_title_bar_portrait</item>, so you need to get rid of the "com_android_systemui_" part.
Actually the professional/clean way to do it would be to rename all of your files to include "package_to_which_it_belongs_" at the front of the filename for better organisation. if you have the time and patience, do it this way!!!!
9. Delete the /res/values/public.xml. Its useless and annoying while compiling. It will be regenerated while compiling.
10. Try to compile the apk. you will probably get errors, because although all the resources are listed in the android.xml (or whatever) you deleted the HDPI folder so many might be missing! it will print what is missing when you compile though, so just go ahead and delete those lines.
11. you can also re-map styles, colors, drawables, etc.. for eg. battery percentage, add this to android.xml after putting the required battery xml in res/drawable:
<item name="drawable/stat_sys_battery">@drawable/stat_sys_battery</item>
also for a color, just add it to /res/values/colors.xml and then in android.xml, add
<item name="color/[name of color]">@color/[name of your color]</item>
See variables in the second post for more info.
12. Sign your compiled apk, and install it! If all goes well you will be able to apply and see the changes after you reboot.
Hope this helped!
More detail
Stuff in the Manifest
The manifest contains several general properties of your app file.
The following are a few which are referenced here.
To change the ringtone: Just put your desired ringtones/notification sound in /assets/media/audio/<Ringtones/Notifications> To prevent your theme from changing the ringtones, delete the corresponding lines from AndroidManifest.xml. I'm sure you can figure out which lines to delete. Also, you can remove the /assets folder, unless you have some other asset in it. (in which case just delete the ringtone buried inside as mentioned above)
Your theme's wallpaper is set to /res/drawable/wallpaper.png. Again, remove the required line from AndroidManifest.xml to make sure you dont mess up your users'wallpapers.
Your theme's theme chooser preview is set to /res/drawable/preview.png. (NEW - I suggest that you DO NOT remove the backslash from the manifest! (see first post))
The icon of your theme's apk file is set to /res/drawable-_dpi/icon.png. You should have an icon for at least one screen-size (preferably hdpi), but its nice to have it for all three.
Variables
This is to help those who don't have dev experience. In android packages, wherever you see an "@" symbol, the part following it will refer to a variable. A variable is basically a name given to refer to a resource for convenient use.
Here are a few types of variables you should know about (note that the explanations may not apply to the theme chooser, but are general):
1. drawable
2. color
3. style
4. string
5. dimen
1. Drawables - Drawbles are, well, drawable. These are resources which android can draw. That includes your theme images, wallpaper, preview, and also stuff like the battery percentage xml's, progress bar xml's etc.
1. Colors - Colors are colors!! Duh! LOL . Anyway, in /res/values/colors.xml you will find an editable list of colors. Say you use green a lot in your theme. Instead of typing "#ff00ff00" everywhere, you can simply define a color called "green" here, by adding the following line:
Code:
<color name="green">#ff00ff00</color>
Now, you can substitute "@color/green" wherever you want to use green.
3. Styles - these are a little advanced. They allow you to define a set of attributes and apply the entire set to different components.
Here's an example style:
Code:
<style name="mytext" parent="@android:style/TextAppearance.Small">
<item name="android:textColor">#ffff0000</item>
</style>
Let's break this down -
First of all, we're naming this style "mytext".
We're saying that its parent is "@android:style/TextAppearance.Small".
This means, that it automatically inherits ALL the properties of the android system style, "TextAppearance.Small" which can be found in the styles.xml in framework-res/res/values.
Now, we're adding an item with the android attribute, "textColor". There are many attributes to choose from, you can look in the attrs.xml in framework-res/res/values. (Note that an attribute may not be applicable to every situation)
Next we're giving the text color a value - in this case, red.
Now, this style can be applied anywhere to get red text in the normal system font size for small text.
Here's an example of how to use styles: post 88.
4. Strings - Strings let you make references to text. Maybe you have your theme name everywhere, and its really long. Maybe your theme name is "supercalifragilisticexpialidocious". Well, you dont want to type that every time. So you can add the following to /res/values/strings.xml:
Code:
<string name="myname">supercalifragilisticexpialidocious</string>
Now, wherever you want to use the word "supercalifragilisticexpialidocious", just substitute it with "@string/myname". And it will use whatever you defined for "myname" there.
5. Dimensions - These store values for sizes and so on. For example, its an easy way to remember a custom text size that you need a lot. Add the following to "/res/values/dimens.xml" (this does not exist by default)
Code:
<dimen name="mysize">33.4sp</dimen>
This will allow you to use the font size 33.4 by substituting "@dimen/mysize" wherever you want. For sizes in pixels, use "____.__dip" instead of "sp".
Comments
Comments are useful little dev tools. Comments basically let a developer (but they're useful to themers too) make comments in the code. Basically, the syntax of a comment (more on that in just a bit) tells the compiler to ignore that line(s). A side effect is that you can "comment" parts of your code - which means that you are marking it as a comment - which are not used (or not yet ready to be used), before compiling and releasing, while retaining the old code for future reference.
How to make a comment in xml files:
Simply surround the code you want to comment with "<!-- ......... -->.
The "<!--" part tells the compiler where a comment starts, and "-->" tells it where the comment ends.
More stuff will come here as I think of it.
I received many error:
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_input_selected.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled_focused.9.png malformed.
Frame pixels must be either solid or transparent (not intermediate alphas).
Found at pixel #8 along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_disabled_focused.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_normal.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_normal.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_pressed.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_pressed.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_selected.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_timepicker_up_selected.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_medium.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_medium.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_medium.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_medium.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait_cust.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_portrait_cust.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_shadow.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_shadow.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_tall.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_title_bar_tall.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_tall.9.png malformed.
Must have one-pixel frame that is either transparent or white.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-land-hdpi\frameworks_res_title_bar_tall.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_toast_frame.9.png malformed.
No marked region found along edge.
Found along top edge.
ERROR: Failure processing PNG image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_toast_frame.9.png
ERROR: 9-patch image C:\Users\ADMIN\.\templatebread\res\drawable-hdpi\frameworks_res_zoom_plate.9.png malformed.
No marked region found along edge.
Found along top edge.
Look up nine-patch pngs. Theres plenty of information about them. You didn't properly edit the nine-patch images (ending with .9.png)
Sent from my HTC Wildfire using XDA App
If i replaced some pngs with other my prefer pngs, then resigned, everything was OK. But if i wanted to add new pngs, i got that errors!
Strange... you shouldn't be getting nine-patch errors if you simply added some extra pngs. are you SURE you're doing it right?
Did you add the pngs from an already compiled framework or did you decompile them? or did you make them from scratch?
What OS are you using to build your theme apks? Are you using Windows?
No i'm on a hackintosh setup, why?
I'm limited to Windows, and the t-mo engine requires a special aapt, which has not been compiled for Windows to my knowledge.
Yeah, I heard about that. But I'm using the normal non-t-mobile aapt that came bundled with apktool, and it works fine for me.
Edit: AFAIK, you only need the T-mo aapt the first time you compile, after that decompiling and recompiling with apktool works. Correct me if I'm wrong please.
Gah! I've been led astray. I've been talking with one of the developers to ask for features, and learn more about the engine. I just didn't bother trying to build a theme, because of what I learned about the aapt change.
FYI to all t-mobile engine themers:
There are currently 2 "skinning" implementations on the table before Google. T-mo's current implementation is not the favored one. Currently, the t-mo team is working on a new engine that will hopefully make Google happy (or happier).
Sony-Ericson is developing the other concept, but it is not ready for inclusion into AOSP either. While they have Google's attention, their approach is currently focused on OEM skinning. (i.e. no root = no skinning)
Confirming, I just recompiled my theme in windows using apktool. It compiles and applies fine. This guide is valid for all OSes.
By the way, Just wanted to mention that like i said in the first post, this is sort of a temporary workaround for theming. Not in any way the best way to do it, but it's clean (at least, almost) and it works, and is, in my opinion, far more convenient than modifying and releasing and reflashing system files all the time.
nhnt11 said:
<snip> it works, and is, in my opinion, far more convenient than modifying and releasing and reflashing system files all the time.
Click to expand...
Click to collapse
I completely agree there.
I went looking into the CM source. I think an uber-genius avoided the need to the custom aapt. Sweet!
Now to have some fun...
BTW, I'm looking to put together something so "we" can share parts of themes (i.e. pack up UI changes, icon sets, mods, etc. in separate zips). Then people could mix and match to one's liking. (Based off the concepts from apk manager 4.9, ZipThemer, and my own special sauce.)
Cool! Looking forward to what you come up with. I was actually thinking kind of the same thing, like, making a base theme, and then being able to have add on packs to override only a few things in the theme like icons, etc.
Sent from my HTC Wildfire using XDA App
I'm after simple and straightforward.
You unpack the apk you want to theme/skin in directory <package name>, make your changes, then delete all the unchanged files. ZIP up one more more of these package trees, and distribute.
To build a theme/skin of your very own, download the ZIPs you like, combine (resolve 'conflicts'), package, and voila.
The BIG advantage of my approach will be that you won't have to do squat with file names! The program will take care of that for you.
Hmmm, that would work, pretty straightforward way to share resources between theme devs.
But what I think would be cool is if we could make packages for users to apply ON TOP of an already applied theme. That would obviously need to be implemented in the theme engine though.
Sent from my HTC Wildfire using XDA App
nhnt11 said:
Hmmm, that would work, pretty straightforward way to share resources between theme devs.
But what I think would be cool is if we could make packages for users to apply ON TOP of an already applied theme. That would obviously need to be implemented in the theme engine though.
Click to expand...
Click to collapse
http://code.google.com/p/cyanogenmod/issues/detail?id=2812
The reason I got in touch with the t-mo dev was so I could toss in my 2 cents. He liked the idea, but he is concerned that, for a simple user, it could be too complicated and/or confusing. Adding support for multiple APKs to ThemeManager would not be difficult. It is that Theme Chooser needs a user friendly UI that can handle multiple APKs and overlaps/conflicts. (I have in my minds eye what one could/would look like. I'm just not going to be the one writing it.)
It can't be that hard, as you said, or even complicated for a user. Two menus - one with full themes, one with addons (maybe a special flag in the package indicating what it is). All addons override everything in the theme with what they have. And you can order applied addons to prioritize which gets the final say. That's it. Not too confusing IMO.
Sent from my HTC Wildfire using XDA App
nhnt11 said:
It can't be that hard, as you said, or even complicated for a user. Two menus - one with full themes, one with addons (maybe a special flag in the package indicating what it is). All addons override everything in the theme with what they have. And you can order applied addons to prioritize which gets the final say. That's it. Not too confusing IMO.
Click to expand...
Click to collapse
I didn't think 2 listings are needed. Good naming and descriptions would be extremely helpful, but not actually required.
Just 1 multi-select "list" (could be like the current chooser with a check box added). Then an ordering screen only if an overlap is detected.
I get this error in apktool. There is more to it but I didnt include it because it was so long and just repeats of beginning only to different files.
C:\Program Files\Android\android-sdk-windows\tools\com.fyb3roptik.theme.androidi
an\res\drawable\zzz_btn_application_selector.xml:4: error: Error: No resource fo
und that matches the given name (at 'drawable' with value '@drawable/pressed_app
lication_background_static').
C:\Program Files\Android\android-sdk-windows\tools\com.fyb3roptik.theme.androidi
an\res\drawable\zzz_btn_application_selector.xml:5: error: Error: No resource fo
und that matches the given name (at 'drawable' with value '@drawable/focused_app
lication_background_static').
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, -F, C:\DOCUME~1\Nate\LOCALS~1\Temp\APKT
OOL2146181265913808293.tmp, -x, -I, C:\Documents and Settings\Nate\apktool\frame
work\1.apk, -S, C:\Program Files\Android\android-sdk-windows\tools\com.fyb3ropti
k.theme.androidian\res, -M, C:\Program Files\Android\android-sdk-windows\tools\c
om.fyb3roptik.theme.androidian\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(Unknown Source)
at brut.androlib.Androlib.buildResourcesFull(Unknown Source)
at brut.androlib.Androlib.buildResources(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.androlib.Androlib.build(Unknown Source)
at brut.apktool.Main.cmdBuild(Unknown Source)
at brut.apktool.Main.main(Unknown Source)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, -F, C:\D
OCUME~1\Nate\LOCALS~1\Temp\APKTOOL2146181265913808293.tmp, -x, -I, C:\Documents
and Settings\Nate\apktool\framework\1.apk, -S, C:\Program Files\Android\android-
sdk-windows\tools\com.fyb3roptik.theme.androidian\res, -M, C:\Program Files\Andr
oid\android-sdk-windows\tools\com.fyb3roptik.theme.androidian\AndroidManifest.xm
l]
at brut.util.OS.exec(Unknown Source)
... 7 more
Can anyone help please? Thanks!

Xposed module with sqlite (without context

Hi,
I want to use sqlite in my xposed module but i don't have any activity or context to send the database constructor.
Is it possible to overcome this?
I tried to send null as a context, but i'm getting nullPointerException when i try to open the database.
Thanks,
Gidi
If you can't get a context from the method you're hooking, you could try the AndroidAppHelper.currentApplication method.
Code:
Context ctx = AndroidAppHelper.currentApplication();
Context myCtx = ctx.createPackageContext("com.developer.app");
pyler said:
Code:
Context ctx = AndroidAppHelper.currentApplication();
Context myCtx = ctx.createPackageContext("com.developer.app");
Click to expand...
Click to collapse
HI Guys,
I tried the AndroidAppHelper.currentApplication() option, but it returns NULL in my case...
shnapsi said:
HI Guys,
I tried the AndroidAppHelper.currentApplication() option, but it returns NULL in my case...
Click to expand...
Click to collapse
If you are editing a database using sqlite and the current process you are hooking as no context reference, you can use root to set the database file to readable, then have your own service running in the background with a file observer tracking changes to a file on the device. Inside xposed module you will write to the file with a command instructing the file observer what to do. Then your service will "hear" the command and execute the changes needed.
I plan on writing up a guide for this. Tomorrow
elesbb said:
If you are editing a database using sqlite and the current process you are hooking as no context reference, you can use root to set the database file to readable, then have your own service running in the background with a file observer tracking changes to a file on the device. Inside xposed module you will write to the file with a command instructing the file observer what to do. Then your service will "hear" the command and execute the changes needed.
I plan on writing up a guide for this. Tomorrow
Click to expand...
Click to collapse
Thanks, I'll be happy to read your guide and learn new stuff
Anyway, I read that it's possible to use Sqlite DB without using SQLiteOpenHelper, this way, i don't need context.
the problem is that when i do it i get exception:
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
this is my code:
database = SQLiteDatabase.openOrCreateDatabase(DB_NAME,null);
database.execSQL(CREATE_TABLE);
Thanks.
shnapsi said:
Thanks, I'll be happy to read your guide and learn new stuff
Anyway, I read that it's possible to use Sqlite DB without using SQLiteOpenHelper, this way, i don't need context.
the problem is that when i do it i get exception:
android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database
this is my code:
database = SQLiteDatabase.openOrCreateDatabase(DB_NAME,null);
database.execSQL(CREATE_TABLE);
Thanks.
Click to expand...
Click to collapse
You probably don't have the required permissions to read/write to that location.
GermainZ said:
You probably don't have the required permissions to read/write to that location.
Click to expand...
Click to collapse
Thanks GermainZ,
which permissions do i need?
I tried to do it this way too:
Code:
File db = new File("/data/data/com.example.mytest/databases/" + DB_NAME);
db.setReadable(true);
db.setWritable(true);
File path = new File("/data/data/com.example.mytest/databases/");
path.setReadable(true);
path.setWritable(true);
path.mkdirs();
database = SQLiteDatabase.openOrCreateDatabase(db,null);
Still same result...
Thanks!
shnapsi said:
Thanks GermainZ,
which permissions do i need?
I tried to do it this way too:
Code:
File db = new File("/data/data/com.example.mytest/databases/" + DB_NAME);
db.setReadable(true);
db.setWritable(true);
File path = new File("/data/data/com.example.mytest/databases/");
path.setReadable(true);
path.setWritable(true);
path.mkdirs();
database = SQLiteDatabase.openOrCreateDatabase(db,null);
Still same result...
Thanks!
Click to expand...
Click to collapse
Let's differentiate between two things: your module (normal code) and the hooked process (the Xposed code).
Remember that hooked code runs as the hooked process (that is, the app you're hooking — *not* your module), so you won't be able to write to your module's data directory.
I don't know if you can change that. Maybe you could create the database and use Context.MODE_WORLD_WRITABLE (from your module, when it firsts open), but I don't think you'll have any luck creating it from the hooked process directly.
GermainZ said:
Let's differentiate between two things: your module (normal code) and the hooked process (the Xposed code).
Remember that hooked code runs as the hooked process (that is, the app you're hooking — *not* your module), so you won't be able to write to your module's data directory.
I don't know if you can change that. Maybe you could create the database and use Context.MODE_WORLD_WRITABLE (from your module, when it firsts open), but I don't think you'll have any luck creating it from the hooked process directly.
Click to expand...
Click to collapse
So where is the best place to use AndroidAppHelper.currentApplication(); so it won't return null and i will be able to use it in my hooked method?
Hello gays, i read all post's . I've the same problem. I start develop a module for xposed for my thesis the goal of application is return fake data when some aplications want access features that they don't need. I all ready can save in sqlite database the restrictions that the user want to restrict, the package name of application and uid. Now i want to access to the database methods by the main class (with implements IXposedHookLoadPackage) and i allways getting nullPointerException when i try connect to database. Anyone can solve this problem?? I will attach my main class IdentitySpoofing and my DatabaseHelper Best Regards Joao Marques

[Q] Couldn't load private static inner class

I'm trying to load a class with classLoader.loadClass(). This class' package name is "com.android.inputmethod.keyboard.KeyboardView.KeyDrawParams".
It's definied as
Code:
private static class KeyDrawParams
The snippet of code that doesn't works is this
Code:
Class<?> mKeyDrawParams = lpparam.classLoader.loadClass("com.android.inputmethod.keyboard.KeyboardView$KeyDrawParams");
I've tried everything, but it still doesn't work. It seems that the classLoader doesn't find the class in the .dex file. I obtain this log in xposed
Code:
java.lang.ClassNotFoundException: Didn't find class "com.android.inputmethod.keyboard.KeyboardView$KeyDrawParams" on path: DexPathList[[zip file "/system/app/LatinIME.apk"],nativeLibraryDirectories=[/system/lib]]
Is there any problem with private static inner class? I've decompiled the apk of the keyboard with an online tool, because apktool doesn't work on my ubuntu... Do anyone know if there is an error in decompilation? (I don't find the usefulness of declaring a private static (inner) class....)
I decompiled it again. It has a completely different code-structure. I give you an advice: don't trust in online decompiling tool

Theming mediatek-res.apk

I have been interested in theming an MTK 6592 mediatek phone (Infinix Hot Note x551) I have owned for quite a while. Its currently running Stock Android 5.1 Lollipop.
I reached a point where I needed to decompile and recompile the mediatek-res.apk framework resource app.
I was using apktool version 2.1.1 and later on 2.2.0-a4270d-SNAPSHOT
I wanted to get rid of this notification item, every time you opened the Dialer, Contacts or Mms application. I found it annoying - asking every time to choose a default simcard, when I clearly wanted and is able to choose a line on calls, or outgoing SMSs.
Sorry, cant post image links yet!!
Click to expand...
Click to collapse
After a few weeks of on-of/trial and error research, I realized that these could be accomplished by editing the mediatek-res.apk located in /system/framework/mediatek-res.
It decompiled ok, but could not compile after editing(again, trial-error).
These were the compilation errors I was getting: A tonne of errors concerning all the resources and their Id's:
HTML:
W: /home/*****/Desktop/mtk/mediatek-res/res/layout/account_five.xml:6: error: Error: No resource found that matches the given name (at 'id' with value '@id/account_five_img').
I read up on this error and one post here on XDA (didnt save the link, sorry) and also over at github, said to edit the apktool.yml file and include the framework ID for the mediatek-res.apk (already installed via 'apktool if mediatek-res.apk'). Its framework ID was 8. So I added it.
HTML:
usesFramework:
ids:
- 1
to
HTML:
usesFramework:
ids:
- 1
- 8
On compilation, a ton of these new errors came up:
HTML:
W: /home/*****/Desktop/mtk/mediatek-res/res/values/styles.xml:3: error: Resource entry style/ImageSwitch is already defined in package com.mediatek.
Looked around furrther for quite sometime couldnt get a solution to this new errors. I continued on my trial and error ways and discovered that If edited the apktoo.yml file
HTML:
sharedLibrary: false
to
HTML:
sharedLibrary: true
and removed the mediatek-res framework ID from apktool.yml file, the errors were reduced to TWO!!
HTML:
W: /home/*****/Desktop/mtk/mediatek-res/res/values/public.xml:914: error: Public symbol ^attr-private/factor declared here is not defined.
HTML:
W: /home/*****/Desktop/mtk/mediatek-res/res/values/public.xml:915: error: Public symbol ^attr-private/scale declared here is not defined.
On investigating the error, I found out that indeed the two resources( ^attr-private/scale & ^attr-private/factor) were not defined in Ids.xml located in /res/values. I added the two to the bottom of the file,
HTML:
<item type="^attr-private" name="factor">false</item>
<item type="^attr-private" name="scale">false</item>
Also I renamed the file ^attr-privates.xml to ^attr-private.xml
On compilation, NO ERRORS!! and the app but pushed to system the phone ends up in endless bootloop.
I finally resolved the bootloop by replacing the resources.arsc in the compiled apk by the one from the original resources.arsc. They differ in size by a few kilobytes.
STEP BY STEP
1. Using APK Multi-Tools, use option
1. Extract APK
Click to expand...
Click to collapse
. Go to Projects folder and copy the resources.arsc file. This is the original file you shall place in the compiled app.
2. Compile as usual the modified mediatek-res app.
3. Go to '/Build/apk' folder and replace the resources.arsc therein with the one from setp 1.
4. Compile a second time.
5. Your apk will be able to boot and run ok now.
Because I am not very well versed with apktool and its inner workings, I don't know why this errors came up. I know this is a work-around, but for now it will have to do.
If this post saves you a few hours/days/weeks of research, hit thanks!!

Problem with Java

Hello. I'm new to the forum and to programming aswell. I'm trying to learn how to make an app so I started with a tutorial online, but I'm having a problem. I can't post a link but the tutorial is called "Make Your First Android App: Part 2/3 - Ray Wenderlich". On the section "Accessing Views From Within Java" when I add "android:text= @string/hello_world"" I get an error. On the bottom it says I should be using a @string but when I do the preview window displays the @string/" aswell. What's that about?
Second, I can't rename the string after changing hello_world to something else. Why is the tutorial even saying I should rename it? What will that do?
Lastly, in MainActivity.java above onCreate I have to insert a line of code. The tutorial doesn't explain why I need to do that. Where should the line go, the code is
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
wherever I insert the code and press Alt+Enter I mess up the whole thing...
Sorry that these questions are annoying and basic, I just really want to learn to make apps and I'm trying to figure things out alone.
Thanks.
P.S. one more thing, in "Buttons and Listeners" there is a part saying:
"Then there’s text, for which you need to add a line in strings.xml such as the following:
<string name="button">Update The TextView</string>"
when I do that I get an error in strings.xml
If you are having problems related to Java, the following tips should help you getting things working -
» Download and Install Java
» Use Java
» Test Java
» Remove Old Versions of Java
» Find Java.
basic issues
1) all strings you use needs to be defined in string.xml file, by doing so, you separate messages and names from code and it can be re used in your app from single source, easy to maintain.
2)ALT + ENTER is used to resolve import, when you add code and introduce new class, you need to import it.
3)Oncreate method in activity is used to setup layout for activity and provide content to be displayed on screen for the activity

Categories

Resources