Help with creating keystore...please - Android Software Development

Hey everyone...I can't seem to find any help on creating a keystore. I created my first live wallpaper and have the apk, but I cant upload to the market until I create a keystore and sign the apk. I don't know how to do this. I have the jdk and sdk installed, along with Eclipse, but all the tutorials out there are way above my head.I don't know anything about java code and all tutorials assume that I do. Is anyone willing to help walk me through this? I don't even know how to get my apk file into Eclipse properly to start. Any help is appreciated.

* to make key
enter this into cmd prompt: cd C:\Program Files\Java\jre1.6.0_01\bin
and then this: keytool -genkey -v -keystore C:\Program Files\Java\jdk1.6.0_23\bin\keystore1.keystore -alias (your name) -keyalg RSA -validity 10000
*then to sign apk
(this is how I do it)
1.copy/paste the apk onto your desktop
2. change the extension to .zip
3. open the now .zip file
4. delete the "META-INF" folder
5. convert it back to .apk
6. open cmd prompt
7. paste this in (without quotes): "cd C:\Program Files\Java\jdk1.6.0_23\bin " (change the path if you have to first)
8. then paste this: "jarsigner -verbose -keystore (pathway to key file) C:\Users\(name of user)\Desktop\(appname).apk (name of key)"
*that is to sign it, not sure if that will work or if your key saved properly when you tried, let me know
It took me about 8 hours to figure it out when I first started too

yeah, or you could just use eclipse
go to file -> export project
and then it'll walk you through the whole process
it takes like 30 seconds
it still amazes me the number of people who do not know this
it's about 500 times easier if you just do it in eclipse
you can spend 8 hours trying to figure it out like hyperbyte did
or you can just use eclipse and be done in a few minutes

smaskell said:
yeah, or you could just use eclipse
go to file -> export project
and then it'll walk you through the whole process
it takes like 30 seconds
it still amazes me the number of people who do not know this
it's about 500 times easier if you just do it in eclipse
you can spend 8 hours trying to figure it out like hyperbyte did
or you can just use eclipse and be done in a few minutes
Click to expand...
Click to collapse
WOW really!? Why the heck didn't anyone else tell me that!? LOL I'm gonna try it now. Thanks for quick responses.

StoopidNoob said:
WOW really!? Why the heck didn't anyone else tell me that!? LOL I'm gonna try it now. Thanks for quick responses.
Click to expand...
Click to collapse
You can also right click on the project and go to Android Tools > Export signed application package

hyperbyteX's method also doesnt zipalign the package which the export wizard does and is reccommended.
http://developer.android.com/resources/articles/zipalign.html
Eventually advanced users would want to use an ant build script (and possibly proguard to optimize) but the export tool is fine for most stuff.

alostpacket said:
hyperbyteX's method also doesnt zipalign the package which the export wizard does and is reccommended.
http://developer.android.com/resources/articles/zipalign.html
Eventually advanced users would want to use an ant build script (and possibly proguard to optimize) but the export tool is fine for most stuff.
Click to expand...
Click to collapse
alostpacket said:
You can also right click on the project and go to Android Tools > Export signed application package
Click to expand...
Click to collapse
And this is going to let me publish in the market?? For sure?? LOL I'm sorry. Been going in circles with this. I'm completely new to Droid and everything that comes with it.

StoopidNoob said:
And this is going to let me publish in the market?? For sure?? LOL I'm sorry. Been going in circles with this. I'm completely new to Droid and everything that comes with it.
Click to expand...
Click to collapse
My method is just a different menu/way to get you to the same "export wizard" as smaskell reccommended.
And yes, once signed, you should be able to publish to the market.

Ok this is gonna sound even more stoopid...but how do I package the apk? I used a program someone provided and it automatically made the .apk file for me, which I was able to upload and install in my inspire, but I assume there's more to it than just exporting the .apk itself right?

There are basically two keys developers come across when developing.
1) The debug key that comes with the SDK and just allows devs to test their apps
2) Your private personal developer/publisher key (that you generate yourself)
In eclipse whenever you build the project it makes an apk signed with the debug key (you can't use this to install on other devices unless they have debugging enabled and cannot upload to the market with this key). This is just a standard key built into android for debugging.
When you go through the export wizard that we posted, it will save an apk that is signed with your key. You can give this apk to others to sideload and upload to the market. It will also help you generate a key and alias and password if you havent generated one before.
Whatever you do, SAVE your key and and remember your alias and password and do NOT give it out to anyone else.
This is how the market will know that an apk comes from you. If you lose this key, you wont be able to upload new versions under the same package name.
hope that helps.

Also, in your manifest.xml make sure you have
Code:
android:debuggable="false"
in the <application> tag
example:
Code:
<application
android:icon="@drawable/my_icon"
android:label="@string/app_name"
android:debuggable="false" >
<!-- your acitivities, services, and broadcast recivers are here-->
</application>

Related

[TOOL/KITCHEN] - Android Builder v.5 (Dead)

This project is no longer being updated. Feel free to use the code.
Android Builder (AB v.5)
kiel123 has joined the AB team!
Thanks to dsixda, Armin Coralic, and cteneyck. I do have permission to reuse their code.
Requirements:
Ubuntu Linux or variant
dsixda's HTC Android Basic Kitchen - http://forum.xda-developers.com/showthread.php?t=633246
In my crazy quest to learn more about Android, I decided to create a companion to dsixda's kitchen that will take some of the drudgery out of downloading and compiling AOSP and the HTC kernel.
Here's what the current menus looks like:
Code:
Select the device that you would like to build for.
1) HTC Droid Eris
a) About Builder
0. Exit
Please enter option number:
and then
Code:
1. Sync AOSP - Cupcake (1.5) repo
2. Sync AOSP - Donut (1.6) repo
3. Sync AOSP - Eclair (2.1) repo
4. Sync AOSP - Froyo (2.2) repo
0. Exit
Please enter option number:
You can follow these two steps, and you will get a freshly compiled, but unsigned ROM in the original_update folder. After running it through the kitchen, it boots up just fine. Of course, most of the hardware doesn't work. That's the part that I am working on now (seriously, I am). I've been working on this for a while, because as I said - this is really about me learning. If I can make a tool that someone finds useful, then great!
Install instructions:
1) download and unzip dsixda's kitchen to whatever directory you want
2) download Android Builder into kitchen's scripts/plugins folder and unzip
3) back out and start the kitchen
4) select 'Run plugin scripts' from Advanced menu and select 'Android Builder'
5) you're there!
NOTE: This will try to install/update all of the packages that it needs, including Java5. Please look at the code so that you know what it's doing. That's just a good general practice with any code that you can actually look at and that you have to run as root...
Future plans:
1) add more kernels (devices)
2) add more vendor trees (goes along with devices)
3) add more repos (CM5, CM6, AOSP Master)
I hope someone finds this useful, and feel free to post useful suggestions/bug reports.
DOWNLOAD - (https://github.com/gnarlyc/android_builder)
CHANGELOG -
v5. - kiel123 re-wrote v.4 as a plugin to dsixda's kitchen with me testing afterward, minor fixes, removed Java6 as no longer needed by kitchen
v.4 - re-wrote to add structure to support more devices in the future
added option for Cupcake, Donut, and Froyo
added .config files that enable touchscreen in kernel by default
v.3 - unreleased build
v.2 - corrected misspellings in code and dialogs
added sudo to launch setup script (Still need to sudo bash first. Sorry.)
v.1 - initial release
Very nice. I have been doing the same. I have used darchstar's post here as the basis of my work. But, I am always glad to look how others are doing things. Thanks for the post.
arockj said:
Very nice. I have been doing the same. I have used darchstar's post here as the basis of my work. But, I am always glad to look how others are doing things. Thanks for the post.
Click to expand...
Click to collapse
Thanks for the thanks! I don't quite get the vendor tree thing, but I just need to look at it again a few times. And, that's where I'm at. It would be really neat to be able create a working AOSP ROM from scratch with minimal manual intervention. It might not be possible, but I haven't found that out yet. (But wait! If you can do it manually, it can be scripted. Right?)
there's typo in your install script
look for line: android_builder*
should be android-builder*
and your install script should use mv command instead of cp to avoid files duplication
EDIT: also you should use sudo command along with ./ab_setup script or include within script as well.
When i ran ./abmenu and i get this message
Code:
Please copy 'menu-kd' to the root of your kitchen folder with 'menu'
menu-kd?.... don't you mean abmenu? turned out it was looking for menu file which i had it renamed to kitchen_menu but I fixed that on my part and all is working well.
Dont let any of my criticism scare you away, I can see there's a lot of potential use for this scripts, great start by the way.
firestrife23 said:
there's typo in your install script
look for line: android_builder*
should be android-builder*
and your install script should use mv command instead of cp to avoid files duplication
EDIT: also you should use sudo command along with ./ab_setup script or include within script as well.
When i ran ./abmenu and i get this message
Code:
Please copy 'menu-kd' to the root of your kitchen folder with 'menu'
menu-kd?.... don't you mean abmenu? turned out it was looking for menu file which i had it renamed to kitchen_menu but I fixed that on my part and all is working well.
Dont let any of my criticism scare you away, I can see there's a lot of potential use for this scripts, great start by the way.
Click to expand...
Click to collapse
I renamed all of the scripts at the last minute and thought that I had them fixed. I'll make the corrections and repost. The goal is to get this thing working well. Your criticism is just more motivation. Thanks!
I'm new to all this but I would love this to work with Froyo source.
Geo411m said:
I'm new to all this but I would love this to work with Froyo source.
Click to expand...
Click to collapse
The current 'internal' build works with Cupcake (1.5), Eclair (2.1), and Froyo (2.2). It's not ready to release though. Give me another week or two. I'm working on proprietary bits now, so that you get a more usable ROM from the start.
Although from your sig, it appears that you don't have an Eris, so you probably don't care much about it's proprietary bits. If you want it to get Froyo instead of Eclair, you can just change 'eclair' to 'froyo' in the script that creates the repo.
I'm with you on Froyo. I have a feeling in a month or two very few people will want to run a pre-Froyo ROM. It's really nice.
rm error on install
i keep getting "rm: cannot remove './bkup': No such file or directory"
the file is there untill i run the ./install script then it disappears and shoots me an error any help would be appriciated
Sjflowerhorn said:
i keep getting "rm: cannot remove './bkup': No such file or directory"
the file is there untill i run the ./install script then it disappears and shoots me an error any help would be appriciated
Click to expand...
Click to collapse
That files was used by me while developing the code. It's not needed. I'll fix the install script for v.5, but if you really want to fix the script now... Just remove the line -
'rm ./bkup'
from the 'install' script
You should still be able to start Android Builder by typing './abmenu', as long as it's in the same folder with the kitchen's menu. The error shouldn't matter.
gnarlyc said:
That files was used by me while developing the code. It's not needed. I'll fix the install script for v.5, but if you really want to fix the script now... Just remove the line -
'rm ./bkup'
from the 'install' script
You should still be able to start Android Builder by typing './abmenu', as long as it's in the same folder with the kitchen's menu. The error shouldn't matter.
Click to expand...
Click to collapse
k thanks i think it worked the same even with the error but got it =)
Sjflowerhorn said:
k thanks i think it worked the same even with the error but got it =)
Click to expand...
Click to collapse
Good deal. Let me know how it goes.
gnarlyc --
Have you thought of making this into a .plugin file that can be placed in the scripts/plugins folder of the HTC Android Kitchen? Then that way you won't need to update your scripts each time I update my kitchen
In my thread I could provide a link to your tool, so that people can add that plugin if they want.
dsixda said:
gnarlyc --
Have you thought of making this into a .plugin file that can be placed in the scripts/plugins folder of the HTC Android Kitchen? Then that way you won't need to update your scripts each time I update my kitchen
In my thread I could provide a link to your tool, so that people can add that plugin if they want.
Click to expand...
Click to collapse
The thought has occurred to me.
Give me a bit. A link in your thread would be great. It might even motivate me to add more devices. Getting stuck on adding Eris proprietary bits has lead me down the road of making a ROM (http://forum.xda-developers.com/showthread.php?t=725447) and documenting the process. I'll get back to Android Builder soon though.
Ok, so...
TO-DO
-------
1) rewrite AB as a plugin to dsixda's HTC Android Kitchen
2) add proprietary bits for Eris
3) add more devices
4) add CM repos
5) add Gingerbread repo
6) add compatibility with more distros
i am getting line 28: update-java-alernatives: command not found?
lord194409 said:
i am getting line 28: update-java-alernatives: command not found?
Click to expand...
Click to collapse
Interesting... I've tested from a freshly installed Ubuntu installation several times. It should install everything you need.
You could try 'update-alternatives --config java' and let me know what it says. You could also look for a file called 'setup_ran' in the root of the Kitchen, and delete it. Start './abmenu' after that and try again.
thanks for answering. Could the problem be that i installed it on cygwin.
lord194409 said:
thanks for answering. Could the problem be that i installed it on cygwin.
Click to expand...
Click to collapse
Yes. Android Builder will not work under cygwin. I don't know that it ever will. That's on the TO-DO list, but it's so far down that it's not on the posted TO-DO list.
I've only tested under Xubuntu 10.04 and minimal Ubuntu 10.04.
If you happen to work it out on cygwin, let me know! I'm sure others would be happy to have the option. Heck, I might even be. I'm mainly using Ubuntu because of AB anyway. (Although, it is kind of growing on me.)
thanks i will look in to it.
Sent from my Eris using XDA App
just wanted to let you know that it didn't work for me. It runs, gives some errors and outputs a update.zip called AOSPbase but the file is only 1.1kb in size.
Geo411m said:
just wanted to let you know that it didn't work for me. It runs, gives some errors and outputs a update.zip called AOSPbase but the file is only 1.1kb in size.
Click to expand...
Click to collapse
make sure you have java5 and java6 jre/jdk installed. it should work then. i had a similar issue the first time through... took it literally 10hours plus, then output was the 1.1k AOSPBase.zip file.
manually installed all java components, and everything worked perfectly then (and took half the time)

[TUTORIAL] Reverse engineering HTC FM Radio for noobs (on EVO 4G)

Okay, I'm writing this because I want to help any other newbies trying to learn how to reverse engineer. The technical details involved in this are extremely daunting, so the purpose of this tutorial is to first explain in layman terms exactly what you're trying to accomplish and what to expect. Then we'll go over the details. That way you're not completely blind going into this. I'm fairly new to the scene, so I'm not as knowledgeable as everyone else. If you see any errors in my post, let me know so I can change. I'm going to assume you know a little bit of Java, can find your way around a computer, and know nothing about Android. The techniques used should work with other Android phones. For this tutorial I'm using Windows 7, Cygwin, and my stock (not rooted) EVO 4G mobile phone.
The FM tuner for the Evo is run by a Broadcom chip: BCM4329. This chip is pretty amazing in that it does wireless, bluetooth, and it has an FM receiver/transmitter. We're interested in the FM receiver / transmitter.
Now, all android phones are based on a Linux kernel. Basically they're Linux running computers. The Android operating system is then installed onto the linux system. Every app is then run off of Android.
Android is based on Java but it is not a Java system. It uses a virtual machine called Dalvik. Google did this to get around licensing issues with Sun Microsystems. So they pretty much invented their own machine language (called byte code) for the Java language. This makes things complicated for the reverse engineer because from what I've read, once Java is converted into this machine language or byte code, it can't be converted back.
So let's rehash.
If you were programming strictly in Java, you would see these extensions:
Java source code = .java
Compiled Java source code = Java byte code = .class
Compressed file to package your program = .jar (Java Archive)
But since you're programming in Android and Dalvik, you will see these:
Java source code = .java
Compiled Java source code = Dalvik byte code = .dex
Compressed file to package your program = .apk
(I haven't mentioned this, but HTC further Optimizes their .dex code)
Optimized Dalvik byte code = .odex
I'm writing all of these down because it's very easy to get confused with all of the extensions. (for me at least!). remember how I said once you go dex, you can't go back to java? That's where JesusFreke comes in. He's a senior member of XDA, and he created "baksmali" and "smali", two programs that can convert the Dalvik code back into a human readable format. These files have extensions of .smali
Decompiled Dalvik byte code = .smali
But what can you do with .smali files? That's where this other senior member, brut.all comes in: He developed apktool. apktool takes JesusFreke's work to the next level. This program in conjunction with NetBeans, actually lets you trace through any program using the .smali code taken from JesusFreke's programs!
apktool does this by converting those .smali files into "fake" .java files that can be used by the NetBeans (program that compiles and makes java programs) IDE. I say "fake" because apktool embeds the .smali code into java files as comments. However, once you attach a debugger to NetBeans, you'll see that the debugger will follow line by line every execution statement found in the smali code!
So...... you can take the program you want, plug it into Net Beans using a debugger (using the default ddms command provided by Android SDK), and you can trace everything you do in the program. I have it connected to my phone, so whenever I push a button while running my HTC FMRadio app or unplug my headphones,I see the corresponding response to the HTCFMRadio code I have loaded in NetBeans. I can now see in real-time how the program operates from my own interactions... JAM.
Technical Aspects: How to get from ground zero to tracing HTCFMRadio?
1.) Download Android SDK - Go to google development site and follow instructions: Make sure to download the latest Java JDK. Once that is installed, download NetBeans 6.8. Unfortunately, smali debugging does not work with the lastest versions of NetBeans.
Download the "Java SE" version for minimal space
http://netbeans.org/downloads/6.8/index.html
You can follow the rest of Google walkthrough and download Eclipse and ADT plugin, but it's not pertinent to this. You're going to be using adb and ddms from the android SDK extensively, so make sure the path for </android SDK/tools> is included in the PATH variable in your ENVIRONMENT SETTINGS. To get here, right click My computer, click properties, Advanced Settings, ENVIRONMENT SETTINGS.
2.) Search for 7z and download it. It is an awesome and free compression tool that will be extremely useful. It can be used to "unzip" .jar, .apk, and other compressed formats.
3.) Get the Radio app. You can do this by going to "shipped-roms" website, downloading the latest Supersonic image, and following the directions in the unlockr tutorial for HTC kitchens at the unlockr website... (once you have extracted the files from the image, you can look in the system/app and system/framework directories to get the files listed below) or:
you can pull the following files from your phone:
Using the command prompt type (and with phone plugged in, and with USB debugging enabled on phone):
adb pull /system/app/HtcFMRadio.odex
adb pull /system/app/HtcFMRadio.apk
adb pull /system/framework ./framework
This will put HtcFMRadio.odex and HtcFMRadio.apk in the current directory and create a framework directory with more files. A couple of the files in the framework are needed for the HtcFMRadio app, but for simplicity, we're just going to pull the whole directory.
Now that we have the files, we have to make a few changes to make the app installable and to be viewable by the debugger. To do this we have to decompile the .odex format into a human readable format we can edit. That brings us to:
3.) Download baksmali and smali from Project Hosting on Google Code (google search smali).
Usually an Android application is made up of one file, an apk file. Inside the apk file is an AndroidManifest.xml file, a classes.dex file (compiled Java code for the program), and other folders. The other folders contain either graphics or other .xml files that tell the program how it should look to the user. We don't have to worry about those for now. This is important because APKTOOL only opens programs set up this way. But wait up? We didn't download one .apk file, we downloaded an .apk file and an .odex file! What gives? Well, if you right click the apk file and open it (using 7z), you'll see that it's missing the classes.dex file. The dex file for the app is actually the HtcFMRadio.odex file we downloaded. So, to make this system app more like a nominal app, we have to find a way to convert the HtcFMRadio.odex to a classes.dex file. That's easy with baksmali and smali!
Once you download goto command prompt and type:
java -jar baksmali-<version>.jar -d framework -x HtcFMRadio.odex
(Remember to match baksmali-<version>.jar with the filename of baksmali you downloaded)
If done correctly, you should see a newly created \out directory
This creates an out\com\htc\fm directory with many .smali files.
Now let's reverse the process and put it back as a dex file. Type at command prompt:
java -jar smali-<version>.jar out -o classes.dex
If done correctly you'll see a newly created classes.dex.
now, right click on HtcFMRadio.apk (select 7z and open). Drag classes.dex into the file. Say yes to the prompt. Now you have a normal apk file APKTOOL can read!
4.) Download APKTOOL from Project Hosting on Google Code and the helper apps for your OS. (If you're extracting files for windows OS you should have apktool.bat and aapt.exe). Extract (again using 7z, don't you love this program?) apktool.jar (keep it as a jar file, don't extract the stuff inside of it), apktool.bat, and aapt.exe to the directory you're working on. To make things neat, you can also delete HtcFMRadio.odex (you don't need it anymore) and classes.dex (make sure you put it in the HtcFMRadio.apk file first!)
If this is the first time you're using apktool, then you have to install the htc framework so apktool can baksmali the Radio app. You only have to do this once:
apktool if ./framework/com.htc.resources.apk
Alright, at the command prompt:
apktool d -d HtcFMRadio.apk
This extracts the contents of HtcFMRadio.apk and places them in the HtcFMRadio directory. However, there are two major differences between this content and the content created in step 3. If you go into the smali directory you'll see that instead of .smali files, you'll see .java files. And if you go back and edit the AndroidManifest.xml file, you will also see that it's in text! Android applications convert their xml files to binary format. Now that APKTOOL has converted everything to an IDE friendly format, we can use NetBeans to edit everything. The first thing we're going to do is edit AndroidManifest.xml (using notepad) and add the following:
android:debuggable="true" to the Application tag.
IT should now look like this:
<application android:theme="@android:style/Theme.Black.NoTitleBar" android:label="@string/fm_app_name" android:icon="@drawable/fm_radio" android:taskAffinity="android.task.fmradio" android:description="@string/htc_corp" android:allowTaskReparenting="true" android:debuggable="true">
This permission lets the debugger watch the program while it's running on the phone.
We are going to run into two problems if we try to install this program. One is that Android doesn't let you install more than one copy of a system app. The second issue is that if we change the signature of our system app, then we'll have to change the signatures of our other system apps as well! Ahh.... So, to get around that, we're going to trick Android into thinking we have a completely new program. We're going to do that by renaming the com.htc.fm class to com.htc.modradio class. Next step:
5.) Cygwin (or Linux virtual machine)
The easiest way that I can think of to replace strings in multiple files is by using linux. You can most definitely do it in WIndows, but I dont know how. If you let me know how, I can put it in this tutorial.
(update: you can use Notepad++ to easily find/replace strings in multiple files for Windows. You still, however, want to download Cygwin if you're going to develop with Android-NDK.)
For now, just search for Cygwin (Cygwin is a program that lets you run Linux commands from a command prompt using your Windows directories), and install it. Make sure to have the Perl option selected. You'll need Perl to make the following commands work.
Once you get Cygwin up and running
cd <to your HtcFMRadio directory>
in my case it's
cd /cygdrive/c/Users/Jerry/Desktop/HtcFMRadio
now type the following commands in this order:
this command changes all occurances of htc/fm to htc/modradio in your xml and .java files.
find ./ -type f | xargs perl -pi -e 's/htc\/fm/htc\/modradio/g'
this command changes all occurances of htc.fm to htc.modradio
find ./ -type f | xargs perl -pi -e 's/htc.fm/htc.modradio/g'
If you don't follow this order, your source code will get messed up.
If using cygwin, a bunch of .bak files will be created. Using windows search, find all .bak files in your HtcFMRadio directory, then select them all and delete them (Make sure they are only files with .bak!)
Now just rename the fm directory to modradio. It is located in HtcFMRadio/smali/com/htc
Now go to your windows command prompt and type:
apktool b -d .\HtcFMRadio modradio.apk
Now sign and install modradio.apk on your phone.
adb install modradio.apk
If you have never signed before, then you need to use keytool and jarsigner. These two files are in your JDK directory, so make sure you include your JDK directory in the PATH variable of your ENVIRONMENT SETTINGS. (To get here, right click on My Computer, click Properties, Advanced Settings, Environment Variables. Once you make change, open up a new COMMAND prompt to see changes).
cd to the directory which has modradio.apk
now type:
keytool -genkeypair
Answer all questions, then use the same password for all password prompts.
Next type:
jarsigner -verbose modradio.apk mykey
Type in the password you created in the above step. Your apk should now be signed.
Next install:
adb install modradio.apk
Success!
6.) Testing the app on phone
Go to your phone and you'll now see a new FMRadio icon next to your first. Click on it and watch it open. It should now be able to play music. Keep it open.
7.) Using Netbeans
Go into HtcFMRadio and delete the build directory created by APKTOOL.
Now open up Net Beans and click on File, New Project, Select Java Project with Existing Sources, click on Next
Select HtcFMRadio directory for Project Folder, rename Project Name to whatever you want. Let's type in ModRadio. click on Next
Next to "Source Package Folders" click on "Add Folder" and select the smali directory.
Click Finish. For a quick tutorial by Brut.all, search APKTOOL in youtube and click on: Apktool Demo 2 - Smali improvements
Right click on Libraries. Click on "Add Jar / Folder". You want to add Android.Jar. Since I have Android 2.1 loaded I went to /platforms/android-7 located in my android SDK directory.
Your project is now ready for editting!
8.) Running the Debugger to trace through program.
Next go back to Windows command prompt and type ddms. This runs the Dalvik Debug Monitor. A window should open up. In the left hand side you should see com.htc.modradio. That's our app! To the right you're going to see 2 numbers, you're interested in the one to the right, 4 cells away from com.htc.modradio. This number is a port number, and you're going to use it to communicate with NetBeans. (In my case it is 8603)
Go back to NetBeans and click on Debug, Attach Debugger.
In the host field type: localhost
In the Port field: type in the second number you saw. (8603)
If everything is working you'll see a bug appear next to com.htc.modradio in the Dalvik Debug Monitor. Look at the bottom bar of NetBeans for feedback. If you get errors make sure the numbers match, or try port 8700 and make sure you select com.htc.modradio in the Dalvik Debug Monitor. Port 8700 is the default port used for whatever program you select in Dalvik Debug Monitor.
9.) Setting a breakpoint
I'm making this a seperate step because it is completely arbitrary. When creating a break point be sure to follow this rule:
You must select line with some instruction, you can't set breakpoint on lines starting with ".", ":" or "#".
Rather than looking for a spot to breakpoint, though, I'll tell you where to put one so you can quickly see how the debugger traces through the code. You aren't "REQUIRED" to do the next step, but if you want to trace you have to put a breakpoint somewhere.
In Net Beans click on the Project tab, click on Source Packages, com.htc.modradio, and then doubleclick on BroadcomFMTuner.java
We're going to insert a breakpoint. Scroll down to line 3226 and on your keyboard press: CTRL-SHIFT-F8, select line in dropdown box and hit ok. (To keep it simple, I usually look for "invoke" instructions to set breakpoints at)
Now go to your phone and click on the physical "back" button on your phone. This will clear the radio,(you should still be able to listen to music). Drag your status bar down. You should see a radio icon. Click on it again. The radio backgroudn will appear, but you wont' see any text or anything. Now go back to your netbeans application. You should now see debug options highlighted! Click on Step Over (F8) to step through!
nice tutorial
Nice tutor! I'm glad that finally someone is interested in smali debugging feature ;-)
About package name changing: I must warn you, that this isn't always that easy. It's advanced task, you must understand, what are you doing - otherwise you will get FCs for some apps and you won't know, why. And you don't have to change Java classes package name, so actually changing com.example.android should be enough - there is no need for changing com/example/android and dir names.
And I have few words about the background/theory: dexes, smali, (de)compiling, etc., but I will write them tomorrow
So I don't have to change the directory names for all of the invokes? Which means I don't have to rename the directory either? That sounds much easier. So you're saying to only replace the name in the application tag in the AndroidManifest.xml file?
Wow I'm a noob
Your badass tutorial just made me realize how much further I have to go. Great work!
BTW, if someone could figure how to make use of the FM transmitter and create an FM modulation app I think that could be popular. Not everyone has cars with input jacks and I know I really could of made use of it for my vacation I just took.
Once you understand how the software interacts with the Broadcom chip it shouldn't take too much should it? I would envision something working just like wifi tether does. No need to turn on the radio, the app just takes control.
Cool! Thanks! Will this work with eclipse also?
oikjdfkrjhr said:
Cool! Thanks! Will this work with eclipse also?
Click to expand...
Click to collapse
According to Brut.all, no.
"Google smali debugging - you'll find an article written by Brut.all"
Eclipse can open the files, but certain workarounds have to be done to get the same tracing to work.
A FM Transmitter that is able to transmit audio to a receiver without any addition cords hardware etc would IMO make the EVO 4G Un-Stoppable!!! I'll donate to support the dev/s in this effort
Will this get FM Radio working on any android phone with that broadcom chip?
Wow, great tutorial. I was looking for the hitch-hackers guide to my new galaxy and I think I found it. Cheers
Thanks this is great. I almost got it 100% working. But there's one problem. I'm debugging some other apk. And I can't set any breakpoints because, since the apktool made fake java files, all the code is comments, so there's no place to set any breakpoints since there's no real executable code!
Help how to get around this?
At the beginning of a class I tried to add something like... int a=0; while keeping the same amount of lines... just before comment start...
Code:
package com.example.app; class MainActivity {
int a = 0; /*
.class public Lcom/example/app/MainActivity;
.super Landroid/app/Activity;
.source "MainActivity.java"
and put a breakpoint there, but it still says its not an executable location.
Any ideas? This is cool and I'm so close with your great tutorial. Thanks!
oikjdfkrjhr said:
Thanks this is great. I almost got it 100% working. But there's one problem. I'm debugging some other apk. And I can't set any breakpoints because, since the apktool made fake java files, all the code is comments, so there's no place to set any breakpoints since there's no real executable code!
Click to expand...
Click to collapse
http://code.google.com/p/android-apktool/wiki/SmaliDebugging
I tried to use Eclipse, but seems it forbids to add breakpoint on unknown (commented out) line :-/ I workarounded this and added breakpoint, then I was able to debug normally, but you should treat apktool debuging as unworkable on Eclipse - at least until someone will find some solution.
Click to expand...
Click to collapse
And actually midnjerry said this to you just few posts above.
neomagik said:
Will this get FM Radio working on any android phone with that broadcom chip?
Click to expand...
Click to collapse
Unfortunately not.
Refer to IntersectRaven's posts regarding enabling the FM Tuner for the Nexus One. He needed to create drivers for a custom Linux kernel to be used with a Desire ROM.
Smali debugging is important, however, because it allows developers to learn the code that implements the "undocumented" hardware for their phone (in this case, HTC phones with a working FM Radio app).
oikjdfkrjhr said:
Thanks this is great. I almost got it 100% working. But there's one problem. I'm debugging some other apk. And I can't set any breakpoints because, since the apktool made fake java files, all the code is comments, so there's no place to set any breakpoints since there's no real executable code!
Help how to get around this?
At the beginning of a class I tried to add something like... int a=0; while keeping the same amount of lines... just before comment start...
Code:
package com.example.app; class MainActivity {
int a = 0; /*
.class public Lcom/example/app/MainActivity;
.super Landroid/app/Activity;
.source "MainActivity.java"
and put a breakpoint there, but it still says its not an executable location.
Any ideas? This is cool and I'm so close with your great tutorial. Thanks!
Click to expand...
Click to collapse
if you're using NetBeans, just keep trying to insert breakpoints at every "invoke" type statement.
A really interesting thread. Thanks for sharing your knowledge with us. A topic like this should have its own Forum like ‘Android Engineering Tutorial’. We need more tutorials like this one!
Bluetooth Driver Files released by HTC!
Just went to
http://developer.htc.com/
Bluetooth driver files released! We should be able to better control the radio now.
Any progress? I'll donate to the first person who gets an app to broadcast my music to my radio.
Sent from my HTC EVO using XDA App
@midnjerry,
sorry if this is way off topic, but it does deal with the fundamental aspects that you have established here.
Can I use this method to reverse engineer the Google Voice app, so that I can have the same program installed twice for my two different Google voice accounts?
I just want to name the application something else, so that I can install it twice with two different sign in names.
reekotubbs said:
@midnjerry,
sorry if this is way off topic, but it does deal with the fundamental aspects that you have established here.
Can I use this method to reverse engineer the Google Voice app, so that I can have the same program installed twice for my two different Google voice accounts?
I just want to name the application something else, so that I can install it twice with two different sign in names.
Click to expand...
Click to collapse
Yeah, I think you can do that. Just change package name of an app to something else.
Brut.all said:
Yeah, I think you can do that. Just change package name of an app to something else.
Click to expand...
Click to collapse
@Brut.all
Can I do that in Eclipse or do I need to use need to use Smali Debugging? Just asking because I am not looking to debug the program only install it twice.

[TOOL] pySignare - Quickly Sign APKs [Windows]

pySignare
"-to sign"
v1.0​
Version 1.0
Complete re-write into python.
Prerequisites
Windows (for now)
Java
Get Java here --> https://www.java.com/en/download/
Python 3.x
Get 3.3.4 here --> http://www.python.org/download/releases/3.3.4/
Instructions
Download
Extract
Copy Unsigned APKs Into "UnsignedApks"
Run "pySignare.py"
Follow On-Screen Prompts
Thats It
Future Development
Make X-Platform - (Shouldn't be too hard)
Minor code tidy up
Currently its bundled with TestExample.apk (just an empty renamed zip) so it can be tested straight away.
DOWNLOAD HERE (Download ZIP - Right hand side)
Please post your experience, and if you encounter any errors, let me know and I'll attempt to fix.
FAQ
Q. I get the error - 'java' is not recognized as an internal or external command, operable program or batch file.
A. You either, do not have the Java installed or have not added java to your PATH in Environment Variables. Either install Java or add Java to your PATH.
Thanks dude.
Any feedback, problems or suggestions?
wow it works! Easy to use! thanks!
Thank you.
Are there any Linux wizards out there who can help me port this?
New version 0.3 available.
tried it all i get is cannot find specified path
edit: forget that i fixed it had to modify the it as im using jdk 1.7.0
I don't know why I changed it, but in v0.3 it assumes you have installed the Java Development Kit (JDK) on a 64bit system (it mirrors my system rather than a universal approach).
If you have java added to your windows PATH, try using these files, just extract these to the same directory and run these instead.
works great! small suggestion is for the batch file to ask for the location of your jdk.
also have error checking as the batch said it worked but didnt at first (due to the location of the jdk)
andyharney said:
I don't know why I changed it, but in v0.3 it assumes you have installed the Java Development Kit (JDK) on a 64bit system (it mirrors my system rather than a universal approach).
If you have java added to your windows PATH, try using these files, just extract these to the same directory and run these instead.
Click to expand...
Click to collapse
I am using a 64 bit system I have jdk on both program files 64 bit and (x86) and the path in the test keys ran to jdk 1.6.0_25(x86) so I used notepad ++ edit it to 1.7.0(x86) tried again it signed and zipalinged no problem
Sent from my Desire HD using XDA App
Your right, I wrote this quickly to fulfil my needs on my system.
I will update to v0.4 with error checking & JDK checking soon.
Thanks for the suggestion.
EDIT: Seems you beat me to the reply leith. If your JDK is added to your windows path then it shouldnt matter whether its 32 or 64 bit. When I updated from v0.2 to v0.3 I used my personal build rather than the universal "java" approach. I can see that as explicit paths are specified in the .bat. v0.4 will add error checking and will most probably include a stripped out java package.
awesome! keep up the good work dude
andyharney said:
DOWNLOAD HERE
Click to expand...
Click to collapse
unable to dl now: Fatal error: Method ExceptionDisplay::__toString() must not throw an exception in /home/aharney/public_html/index.php on line 644
?
Try using a different browser, that error is quite rare and unique to certain localised versions of windows + firefox.
Version 0.4 now out.
Flawless victory brilliant Andy
im no stranger to signing apks
both of us know this tool is the best
better than any other signtool
never gonna give this up
not gonna desert this tool...
I saw what you did there. Version 0.5 will replace icon.png in every apk with a png of his face.
I can't download the file
Forbidden
You don't have permission to access /index.php on this server.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Click to expand...
Click to collapse
Yeah, I had to take the site down again. Been hit with 2 DDoS attacks in the last 3 days. I don't know why.
I will have it back up at some point tonight. I will PM you when its back up.

[GUIDE] How to Set Up ADB & Build Android with Fedora KDE

Hello all. I have written a guide to setting up & using Android ADB, & building Android, with Fedora KDE. Almost every guide that I've ever seen for setting up ADB, & a build environment for building Android, is always written for Ubuntu, & ONLY Ubuntu. But I choose to work with Fedora KDE. Why Fedora with KDE??? Because I hate Ubuntu. !!!HATE!!! I also can't stand gnome 3.X. I'm sure I'm not the only one who feels this way, so that's why I'm writing this guide. I've tried different linux distros, & I've found Fedora to be the best of all. It is my favorite now. They also seem to be one of the few distros that stays on top of the linux kernel updates. As of 03/20/13, they're already on kernel 3.8.3!!! Other distros stay way behind. Also, with KDE, you can keep the "windoze" traditional desktop look & feel, especially when you use the "folder view" activity. It's great!!! Well, let's get started.
!!!WARNING!!! Before anything else, I will mention this right now. The Dolphin file manager can destroy your Android build with hidden ".directory" files. Please keep this in mind. I will explain this at the end of the guide.
INSTALL JDK6
-I guess I'll mention this 1st, since this can actually be one of the most painful & confusing parts of all. You'll need to install the java jdk6. As far as I know, Android stuff won't work with the newer jdk7. You can find it on oracle's page here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
-Scroll down & you'll see it. Get the "rpm.bin" version. If your working with 64bit, it should look like this:
jdk-6u43-linux-x64-rpm.bin
-Someone by the name of JR already made a very good guide on how to do this. It is what I followed, & you should too. You can find it here:
http://www.if-not-true-then-false.c...java-jdk-jre-6-on-fedora-centos-red-hat-rhel/
NOTE: When following this guide, be sure to go through only steps 3a & 4a when you reach them. Steps 3b & 4b are for the "non-jdk" jre.
NOTE: The "alternatives" listed in step 4 seems to be some kind of program that creates symlinks for whatever you want, & labels them. When you install, or create the symlinks, you can then use "alternatives" to switch back & forth between the different programs that you make the symlinks for. For example, you can make links for java in jdk6 & jdk7, & then switch to either one or the other, as you please. That way, you can have them both installed, while using only one at a time. You can type "alternatives --config java" to switch, or whatever name you used for the link. For help, type "alternatives --help".
INSTALL SDK
-You can follow these:
http://developer.android.com/sdk/index.html
http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development
SETTING UP ADB
-Download the sdk & unpack it somewhere in your home directory. For example, I like to put mine in "~/Android-Development/sdk" (the ~ symbol is short for your Home folder).
-cd to your sdk tools location. For example, from my Home folder, I would type this:
Code:
$ cd Android-Development/sdk/tools
-NOTE: DON'T TYPE THE DOLLAR SIGN!!! I put it there because that's what you see in the terminal. It's only there for reference.
-NOTE: At any time, you can type "ls", or "ls -l" to see everything in the folder you're currently in.
-Now, execute the android program.
Code:
$ ./android
-Install Android SDK Tools & Platform-tools.
-Install 32bit packages. Since Android is a 32bit OS, you must install the 32bit packages regardless if whether your computer is 64bit or not.
Code:
$ sudo yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
NOTE: In order to install packages with yum, you must do it as su. You can either type sudo before the command, or you can just type "su" & enter your password to become superuser. If you're new to the command line, it's probably better to use "sudo" instead, that way you won't stay logged in as superuser & potentially mess things up.
-Now, it's time to install the udev rules. Basically, they are the rules that govern whatever device you plug in with USB. You can find all the info on this page:
http://developer.android.com/tools/device.html
-Create an empty file named 51-android.rules to write in. We will create it in /etc/udev/rules.d/
Code:
$ sudo touch /etc/udev/rules.d/51-android.rules
NOTE: "Touch" is a linux command that you can use to create a new, empty file. To see more info on it, type "touch --help", or "man touch" to see the manual page for it. Of course, you can always google it, & anything else as well. Google "linux commands touch".
NOTE: Since this file is in the root user's directories, you will need to enter commands as superuser, or else it won't save. Either type "sudo" before the command, or, if you're comfortable with the command line, log in as superuser by typing "su" & entering your password.
-Now, you can use any text editor to write inside that file you just created. I like to use nano from the command line, so let's use that. ("nano --help", "man nano", google "linux commands nano")
Code:
$ sudo nano /etc/udev/rules.d/51-android.rules
NOTE: In linux, you can copy & paste without even "right-clicking" & selecting copy or paste from the menu. Instead, you can just highlight some text, & go somewhere else & press the mouse middle button to paste it. Highlighting text will automatically copy it, & pressing the mouse middle button will automatically paste whatever you highlighted. No need for "right-clicking" anything. You can do this for the next step.
-Now, from the webpage listed above, just copy & paste the lines with the USB Vendor IDs that you want to use. For example, for Asus, HTC, & Samsung, write these:
Code:
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0666", GROUP="plugdev"
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0666", GROUP="plugdev"
-Save & exit the file.
NOTE: In nano, you can always see important commands at the bottom of the screen. For example, to exit, you hold in the "control" button & press "x".
-Now, check the permissions of the file & make sure everyone can read it.
Code:
$ ls -l /etc/udev/rules.d/
-You should see something like this:
Code:
$ -rw-r--r--. 1 root root 639 Feb 5 14:08 51-android.rules
NOTE: The 1st line indicates whether it's a directory or not. The next 3 lines indicate Read, Write, & eXecute permissions for the user. The next 3 lines indicate Read, Write, & eXecute permissions for the group. The last 3 lines indicate Read, Write, & eXecute permissions for others. The 1st "root" means that root is the user. Root owns that file. The 2nd "root" means that the file belongs to the group root.
-If for some reason you don't see the "r" letters (meaning that it's readable) to the left of the file name, then just change the permissions. Add "read" permissions for all.
Code:
$ sudo chmod a+r /etc/udev/rules.d/51-android.rules
-Finally, if you didn't do it earlier, now's a good time to do this. Make sure the ADB folders are in your global PATH. This is so that you can use the ADB commands anywhere in the system, no matter what folder you're currently in.
-Return to your home folder.
Code:
$ cd
NOTE: In the linux command line, simply typing "cd" & pressing enter will bring you right back to your Home folder.
-There's a hidden file called ".bash_profile" in your home folder. You can see it if you LIST ALL:
Code:
$ ls -a
-Your global PATH is defined in there. Let's edit it to add the ADB folders.
Code:
$ nano .bash_profile
-You'll see that there's already one line in there with 2 entries that look like this:
Code:
PATH=$PATH:$HOME/.local/bin:$HOME/bin
You can use that as your example as to what the format should look like. The line begins with
Code:
PATH=$PATH:
Then there are 2 entries, with each entry separated by a colon. Each entry must be separated by a colon and NO space.
Code:
$HOME/.local/bin
is one entry, &
Code:
$HOME/bin
is the other entry. Now, we want to add our 2 ADB folders to the list. You can either add each path to your folder separated by a colon & no space, like the example, or you can start your own line. I always like to start my own line underneath that one. So, for example, here's what my new line looks like:
Code:
PATH=$PATH:$HOME/Android-Development/sdk/platform-tools:$HOME/Android-Development/sdk/tools
-Everyone likes to use different folder names. Remember to use the proper path of where you put your folders in.
-Save & exit the file. That's it. Now, reboot your computer, plug in your android device, & test it out. You should be able to type "adb devices" from any folder, & the computer should be able to see it now.
INITIALIZING YOUR BUILD ENVIRONMENT
-For me, this was the hardest part of the whole process, as there wasn't a lot of help on how to do this for Fedora with KDE. Whatever few guides for Fedora I found out there were usually missing something here & there. My goal is to change that & help everyone. I've gone through this multiple times now, including multiple reinstalls of Fedora 18 from scratch.
-You'll need to install lots of drivers & libraries.
NOTE: Use Apper, the software management program, to look up drivers & libs. Apper will show you many different files that have the name that you typed in, whereas yum won't. Personally, I like to look things up with Apper so I can get lots of hits, & then actually download them by typing them in manually with yum. Yum shows you what it's actually doing behind the scenes while it's downloading things, whereas Apper doesn't. If yum gets stuck & hangs, you can actually see what's going on, whereas Apper won't show you anything & will just leave you wondering what's going on.
NOTE: I have found it to be a good idea to always look for the development (-devel) version of anything that you have to install. Not everything has a development version, but some do. For example, if you look up "flex" in Apper, you'll see that there's also a "flex-devel". Be sure to download them both.
-Here is what I went by:
http://fedoraproject.org/wiki/HOWTO_Setup_Android_Development
http://source.android.com/source/initializing.html
http://wiki.cyanogenmod.org/w/Main_Page
http://wiki.cyanogenmod.org/w/Build_for_maguro
-I used the lists on the fedora page, & I also used the lists of required packages for Ubuntu 10.04 & 12.04. I chose to try a build for Samsung Galaxy Nexus, since that's what I have. While going through the Ubuntu lists, you must keep in mind that some of these packages don't exist for Fedora, & many others do exist with slightly different names. It is best to spend some time & look them up 1 at a time using Apper. For example, typing "libxml2-utils" into Apper shows nothing, but typing in "libxml2" shows results. Finally, whatever you still can't find, you must google search it. For example, google search = "fedora libxml2-utils" You'll get clues & answers from what other people have already found about them. I mainly used the Ubuntu lists of necessary libs to download. So, without further ado, here's everything that I did that works for me...
Code:
$ sudo yum install git gnupg gnupg2 flex flex-devel bison bison-devel gperf gcc gcc-c++ make automake kernel-devel zip curl zlib zlib-devel glibc glibc-devel ncurses ncurses-devel xulrunner xulrunner-devel libX11 libX11-common libX11-devel xorg-x11-proto-devel readline readline-devel mesa-libGL mesa-libGL-devel mesa-libGLU
NOTE: You won't need mingw32 & tofrodos.
Code:
$ sudo yum install python-markdown libxml2 libxml2-devel libxslt libxslt-devel perl perl-devel perl-Switch SDL SDL-devel wxGTK wxGTK-devel squashfs-tools pngcrush schedtool
NOTE: If you installed Fedora with the options for development programs, than some of these will be installed already. This list may be a slight bit of overkill, but I purposely wrote down everything anyway, so that way nobody misses anything. I went through hell when figuring this out, so it's better to be safe than sorry.
NOTE: If you've been doing everything logged in as superuser, be sure to exit su when you're not installing things anymore. If you create directories as root user, you won't have permissions to access them under your own name, unless you manually change the permissions. Other permissions issues can arise too.
-After all this, it's just a matter of installing the directories & repo, & following the remaining directions on the CyanogenMod Wiki build guide page. I wanted to sync up with the Jellybean branch, so as an example, I set my directories up like this:
Code:
mkdir Android-Development/Builds/bin
mkdir Android-Development/Builds/CM10.1_Jellybean
-Whenever I download the repo command, I do it like this:
Code:
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/Android-Development/Builds/bin/repo
-You'll need to add this to your global PATH as well, so be sure to do that, then log out & back in again, or reboot to make it active. Do that, & then continue.
-Then, I go inside the CM10.1_Jellybean folder to do the repo init. (Get ready for repo sync. That takes hours!!!)
-That's pretty much it. : ) Be sure to read through the sites & all their instructions & guides to help you understand everything.
!!!WARNING!!! Here is what I mentioned all the way at the beginning. Please don't forget the most important thing of all: those damn hidden ".directory" files. Any time you change the folder views in Dolphin File Manager, it places a hidden ".directory" file in that folder. THESE HIDDEN FILES WILL DESTROY YOUR BUILD!!! I went through hell with this, trying to figure out what was going on. I always set up the Android folders to show in "details" view mode, so that they're easier to see. Every time I tried to build, it would build for 5 or 10 minutes, & then fail, citing errors in java. I eventually realized that the ".directory" files were the cause of all the problems.
If you change the folder views, you need to get rid of those hidden ".directory" files. You'll have to do it in terminal. A good way to do it is by using the "find" command to find them all, & then pipe the output of that into the "rm" command to remove (delete) them all. ("find --help", "man find", google "linux commands find")
The "find" command can find whatever you're looking for in the current directory, & in all of its sub-directories as well. With the "rm" command, you can also use the "v" option. "V" stands for "verbose". It will show you everything that is being done, as it's being done. As an example, here's how I do it on my computer:
Code:
$ cd ~/Android-Development/Builds/CM10.1_Jellybean
$ find -name .directory -exec rm -v '{}' \;
That will find all of the ".directory" files & delete them all. It works pretty fast too. With the "v" option, it will show you what's going, while it's happening, as well. So, if you're like me & think that it's much easier to see huge lists of folders in "details" view mode, feel free to set it for the current directory & all sub-directories as well. However, DON'T FORGET TO DELETE all of the ".directory" files before you start building, or your build WILL FAIL!!!
Well, as you can see, you can customize some things to your liking. There's plenty of learning involved, so be ready to spend lots of time with everything. Good luck, & have fun!!!
Now, I'd like to add a personal note. After all this, I'm able to build Android from source with no problem now. However, I tried porting CyanogenMod & building ClockworkMod recovery for some Ainol Tab that I have. Long story short, in the end, it didn't work. I learned about having to build your own device tree, & I found myself completely lost in a sea of xml & java that I didn't understand at all. That's when I realized how much I don't know. It's also when I quickly realized the good advice of cyanogen himself...
http://forum.xda-developers.com/showthread.php?t=667298
"... Here's my advice for those looking to make their own Android ROMs.. Stop. Write an app or two first, learn how the system works from a developer standpoint. Learn some Java. ..."
His advice is dead on accurate. Now I know why he says the things he said. I have no previous experience with java, or any other programming language. In trying to do these things, I found myself completely lost in code that I didn't understand at all. How can I possibly mess around with entire ROMs when I don't even know what's going on under the hood???
Since then, I've been concentrating most of my spare time learning java. It's a bit overwhelming to say the least, but I am getting it now. Recently, I took a peek back at all the code that confused me before, & I'm actually starting to understand it all now. I'm no longer lost. Studying java (& xml) is actually working, & quite well too. I can personally confirm cyanogen's advice to be spot on, & well worth listening to.
So, in conclusion, if you're wanting to get into messing around with ROMs & stuff, but you have no programming experience, I think it would be best to take cyanogen's advice & start at the higher levels first. Learn some java (& xml), & learn to build a simple app or two for Android. You'll better learn how the system works that way. That's what I'm doing now, & it's really working for me. Doing this should help you out with ROMs, & app development too. Well, I hope this is helpful to everybody looking to get into all this stuff. Good luck, & have fun!!!
Glad I'm not the only Fedora user building android around here. I admit, I'm no good at java, but I have really only been focusing on kernel stuff for my device. Good luck to anyone using this.
XirXes said:
Glad I'm not the only Fedora user building android around here. I admit, I'm no good at java, but I have really only been focusing on kernel stuff for my device. Good luck to anyone using this.
Click to expand...
Click to collapse
I guess different people will have different experiences depending on what kind of knowledge they have. For me, I ran into trouble when I tried to port CyanogenMod to a different device on my own. I found that my knowledge was not quite up to par. Studying java is helping me in regards to both ROM development, & app development as well. It's just what I need because I also want to make games.
Very nice guide. I can tell you spent a lot of time putting this together. thank you!
I already had a mostly working Android SDK, and was successfully building kernels for my Ainol Elf2. However, I was never able to build the Elf2 ported version (by Christian Troy) of Cyanogen 10. Perhaps after starting over with my Java installs, this will work now. I have had the Android SDK installed for quite some time, but after v4.2, it would no longer update itself. Now it does.
Not that I want to use 4.2 on my Elf2. I hate they dropped Bluez and now USB Bluetooth dongles no longer work. That is a show stopper for my Elf2. However, my newly purchased Samsung GS3 might benefit nicely. I plan on starting to build a new kernel for this tonight.
BTW, I am still on Fedora 14 32bit, because I also hate Gnome 3 and the latest KDE's as well. My F14 is still kicking along just fine, with updates manually compiled by me.
Nice Job!
Thanks for sharing!! Good job!!
lexridge said:
Very nice guide. I can tell you spent a lot of time putting this together. thank you!
I already had a mostly working Android SDK, and was successfully building kernels for my Ainol Elf2. However, I was never able to build the Elf2 ported version (by Christian Troy) of Cyanogen 10. Perhaps after starting over with my Java installs, this will work now. I have had the Android SDK installed for quite some time, but after v4.2, it would no longer update itself. Now it does.
Not that I want to use 4.2 on my Elf2. I hate they dropped Bluez and now USB Bluetooth dongles no longer work. That is a show stopper for my Elf2. However, my newly purchased Samsung GS3 might benefit nicely. I plan on starting to build a new kernel for this tonight.
BTW, I am still on Fedora 14 32bit, because I also hate Gnome 3 and the latest KDE's as well. My F14 is still kicking along just fine, with updates manually compiled by me.
Nice Job!
Click to expand...
Click to collapse
Thanks!!! Yes, I did spend quite a bit of time on it. I always try to do everything as perfect as I can.
What a coincidence... It was messing around with my Ainol Novo7 Crystal tab that really pushed me into this journey of learning. I think that one & the Elfii are almost the same. That Christian Troy guy seems to be an absolute Linux master. I hope I can be as good as him someday.
I think many people should use Fedora. It may not be so easy for beginners, but the more people that help by writing helpful guides for different things, the easier it will be to transition to. It's really great. I even run it on my little Acer Aspire One A522 netbook with no problems.
Sent from my Galaxy Nexus using xda premium
PotatotreeSoft said:
Thanks for sharing!! Good job!!
Click to expand...
Click to collapse
Thank you!!! I hope it helps many people.
Sent from my Galaxy Nexus using xda premium
Thanks for "going the extra mile" (x10!) and taking the time to lay out such a well-organized procedure. Describing potential pitfalls is quite valuable as well. Sharing learning experiences helps everyone. And good luck with Java.
!!!WARNING!!! Here is what I mentioned all the way at the beginning. Please don't forget the most important thing of all: those damn hidden ".directory" files. Any time you change the folder views in Dolphin File Manager, it places a hidden ".directory" file in that folder. THESE HIDDEN FILES WILL DESTROY YOUR BUILD!!! I went through hell with this, trying to figure out what was going on. I always set up the Android folders to show in "details" view mode, so that they're easier to see. Every time I tried to build, it would build for 5 or 10 minutes, & then fail, citing errors in java. I eventually realized that the ".directory" files were the cause of all the problems.
Click to expand...
Click to collapse
You can disable this via:
Menu: Settings > Configure Dolphin > General > Behaviour and set it to common view for all folders. Found here
hi, im stuck ins this step
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/Android-Development/Builds/bin/repo
how can i make this work??
what im missing??
sorry and thanks
plmosqueda said:
hi, im stuck ins this step
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/Android-Development/Builds/bin/repo
how can i make this work??
what im missing??
sorry and thanks
Click to expand...
Click to collapse
Oh, hello. Sorry, I've been away for a very long time. It's cause I'm so busy trying to fix my screwed up life.
Were you still having trouble with this??? Does anything happen at all when you type the command??? I haven't done this in quite a long time now, but if I remember right, I think that this command looks like it doesn't do anything, but it really does. Be sure to check your folders for the repo command afterwards. Curl is a program you can use for downloading things. As long as you have it installed, it should at least tell you something when you type it in. By the way, nice Gameboy.
3ndymion218 said:
Oh, hello. Sorry, I've been away for a very long time. It's cause I'm so busy trying to fix my screwed up life.
Were you still having trouble with this??? Does anything happen at all when you type the command??? I haven't done this in quite a long time now, but if I remember right, I think that this command looks like it doesn't do anything, but it really does. Be sure to check your folders for the repo command afterwards. Curl is a program you can use for downloading things. As long as you have it installed, it should at least tell you something when you type it in. By the way, nice Gameboy.
Click to expand...
Click to collapse
Done XD, i was having ṕroblems with the global path. Well in now in Arch. All works fine, im trying to make a custon recovery for alcatel Ot 983
A bit late to the party but just found this great guide , too bad I didnt find it one year ago It took me almost a full day to figure all this out using Eclipse Kepler to dl the sdk and Nano to write new rules (had to find the rules...) ...
But all in all once you have done it one time seems to me the process is more straitfoward than with a comparable ubuntu system
this well written guide deserves more publicity!
Thanks!

[TOOL][WIN]DroidShell - Windows Shell Integration for Android Development[02/02/16]

Greetings, and welcome to the home of a little set of utilities I'm calling "DroidShell".
What it is:
DroidShell is my attempt at bridging the gap between the various android utilities used for ROM modification and the Windows explorer system. It is a series of scripts that are automatically associated with .apk, .jar, and .iso files so that they are automatically decompiled on double-click or enter. Additionally, when a file is decompiled, a corresponding .dcp, dcf, or dci (decompiled package, decompiled framework, decompiled image) file is created, which allows for automatic recompiling, as well as optional cleanup, or resigning.
The goal of this project is pretty simple...to have all the tools needed for ROM work in one place, and have them easily accessible without having to have eighty command windows open or to have to go through a chain of commands to create a usable apk/jarfile.
Features:
One-shot setup. Extract the files, run install/installer.bat, and all of the necessary file associations and paths are created.
Batch terminal integration - provides integration for adb, fastboot, apktool, 7zip, zipalign, oat2dex, unpackbootimg, repackbootimg, baksmali and smali in windows command-line interface from path.
Automagic association with common android filetypes for decompilation.
Custom placeholder files - dcp, dcf, and dci - for packages, framework, and image files. Allows for automatic recompiling, and optional signing and cleanup of decompiled files.
Recompiled apks and jars are automatically repacked with modified files while excluding androidmanifest.xml, meaning signatures are unaffected.
For modifications requiring androidmanifest be changed, you can right-click a .dcp file to recompile with signature.
Auto-detection of framework-res file with prompting to install.
Popup dialogue boxes for errors and alerts.
(NEW) Right-click to decompile to java code. This cannot be recompiled, but is great for researching more complex mods. (Can also be invoked by using the command dj filename.apk)
(NEW) Support for sparse image system -> .img conversion.
(NEW) za command for zipaligning apk's.
(NEW)
Download:
https://github.com/d8ahazard/DroidShell/archive/master.zip
Source:
https://github.com/d8ahazard/DroidShell
Instructions...
You need the Java Runtime Environment (RE). Get it here.
Extract to a folder somewhere. Spaces in the path are probably not good. I put it in C:\DroidShell
Browse to the folder. Go into the install folder. Run installer.bat. (Installer needs admin priveleges. It will prompt for them, but in some cases, you may have to automatically run as admin)
Reboot.
You should now have shell integration. APKs, Jars, and .img files will automagically decompile.
It's late, I've been working on this all weekend...but it should be good to go. Please let me know if you have any thoughts.
CHANGELOG:
Code:
02.02.16 - v2.0
Update smali, baksmal to v. 2.1.1.
Add shell script for oat2dex (not implemented in context menus, just avaialable for now)
Update APKTool to latest version
Add dx.jar - for converting java classfiles to .dex (just available for now)
Add ext4 and ext2 tools - For manually unpacking images if needed. These are GUI based, not my work.
Add rimg2sdat - For converting .img to sparse (Not implemented yet)
Update sdat2img to latest version by xspirit, added python to installer as required.
Add zipalign function (Not implemented, can be called via "za filename.apk"
Add decompile to pure Java:
This utilizes a few tools to take apk's and jarfiles and decompile them to as close of an android package as we can get without having the actual source code. While we cannot at this time recompile these into apk's, it is very useful for analysis when trying to implement other mods. Like...really helpful. This one can be accessed by right-clicking a decompileable package and picking "decompile to java".
01.31.15 - v1.8
Added windows progress bar for file copies in system.img extraction.
Fixed some script errors.
01.29.15 - v1.7
Cleaned up installer, added more verbosity.
Better error checking in image extractor.
Add support for .list files, allowing double-click extraction of system.transfer.list and cm12-style image files.
Added custom language files for notepad++, allows syntax highlighting of .smali and logcat files.
01.27.15 -v1.6
Added support for system images. Requires installation of included OSFMount.
Added file associations for common plaintext android files to notepad++ if installed.
Converted several .bat files to .exe, allows for icons, inclusion of required files, and UAC prompting when needed.
01.26.15 - v1.5
Fixed fatfinger in APKtool detection causing error.
01.26.15 - v1.4
Added zipaligning
Added check to make sure apktool is present
Updated test-keys to latest AOSP version
Compiled batches to .exe with required files for AIO-packages
Fixed: Installer not always associating with files correctly.
Thanks a million
Version 1.5 uploaded.
Added Zipaligning
Check to make sure apktool.jar is found in %DROIDROOT% directory.
Updated signing keys.
Switch from .bat to .exe, allows modularization of functions, cleaner.
Modifications to installer to try and fix some issues with file associations.
Fixed issue between 1.4 and v 1.5 where I fatfingered a check.
Hell yes!
digitalhigh said:
Greetings, and welcome to the home of a little set of utilities I'm calling "DroidShell".
What it is:...
Click to expand...
Click to collapse
So many thanks for this! I'm going to use it like hell!
Excellent Job!
I'm bookmarking this, gona read it thuroughly at breakfas
So I'm curious - has anybody had a chance to give this a try yet?
Testing file association stuff is tricky, because Windows likes to keep track of the "user selected" association too. So, I had to add some extra commands to the installer script to clean up everything appropriately first.
Either way, I've ran it on like three different computers "clean" and had it work like a charm on all of them. I'd like to know how it works with WIndows 7 or XP.
I could be doing something wrong (windows is not my OS of choice, I use kubuntu 14.10 as my daily driver, and as such am mostly illiterate in dos/batch, I'm a sh/bash guy), but the installer bombed out (hung up without confirmation of success) on my windows 7 pro install (on a dell latitude e6400, with a dual core core2 @2.8ghz, quattro 160m graphics, 4gb of ddr2 @800mhz, booting off a 120gb Samsung evo ssd. Wouldn't think its relevant, but just in case).
Steps:
First I decompressed the .zip in the root of my C:\ drive, with 7zip (did not change file name, kept as "DroidShell_1.5").
Next I ran the installer script.
I then granted it admin privileges.
It killed my desktop, explorer.exe. I assume this is normal due to the terminal output:
Code:
SUCCESS: The process "explorer.exe" with PID 3260 has been terminated
Then I got:
Code:
file type 'apk_auto_file' not found or no open command associated with it.
Followed by 4 more identical errors, just replace "apk" with dfc, dcp, dci, img.
A bunch of successful operations.
Then:
Code:
ERROR: Invalid syntax.
Type "REG ADD /?" for usage
A bunch of successful operations.
Then:
Code:
ERROR: The system was unable to find the specified registry key or value.
The above output repeats 17 times.
Then 4 more operation success messages and it hangs, with my desktop killed.
Ctrl+alt+del, logout, log in, and I'm back in business. No noticeable increase in disk space, no newly installed programs (as expected).
I read the op, and from my understanding it doesn't require any dependencies? (Apktool, android SDK, android studio, etc). All the necessary dependencies are built in, right? It's a fresh install of windows 7 pro, with all available updates taken.
EDIT:
It worked perfectly regardless of the errors, see my post on page 2.
thisguysayswht said:
I could be doing something wrong (windows is not my OS of choice, I use kubuntu 14.10 as my daily driver, and as such am mostly illiterate in dos/batch, I'm a sh/bash guy), but the installer bombed out on my windows 7 pro install (on a dell latitude e6400, with a dual core core2 @2.8ghz, quattro 160m graphics, 4gb of ddr2 @800mhz, booting off a 120gb Samsung evo ssd. Wouldn't think its relevant, but just in case).
Steps:
First I decompressed the .zip in the root of my C:\ drive, with 7zip (did not change file name, kept as "DroidShell_1.5").
Next I ran the installer script.
I then granted it admin privileges.
It killed my desktop, explorer.exe. I assume this is normal due to the terminal output:
Code:
SUCCESS: The process "explorer.exe" with PID 3260 has been terminated
Then I got:
Code:
file type 'apk_auto_file' not found or no open command associated with it.
Followed by 4 more identical errors, just replace "apk" with dfc, dcp, dci, img.
A bunch of successful operations.
Then:
Code:
ERROR: Invalid syntax.
Type "REG ADD /?" for usage
A bunch of successful operations.
Then:
Code:
ERROR: The system was unable to find the specified registry key or value.
The above output repeats 17 times.
Then 4 more operation success messages and it hangs, with my desktop killed.
Ctrl+alt+del, logout, log in, and I'm back in business. No noticeable increase in disk space, no newly installed programs (as expected).
I read the op, and from my understanding it doesn't require any dependencies? (Apktool, android SDK, android studio, etc). All the necessary dependencies are built in, right? It's a fresh install of windows 7 pro, with all available updates taken.
Click to expand...
Click to collapse
Bombed out is a rough term. The installer is just writing a bunch of registry keys, and deleting some other ones to make sure other associations don't mess it up. So, some registry operations don't always work - there just there to be sure. I've actually worked on cleaning that up in the next iteration I'm cooking.
And yes, there shouldn't be any more size increase past extracting the original zip. All the files used are enclosed. "Installer" is just telling Windows that "droid shell is at location %CD%" and "use app xxx in %CD% to open file XX". A few extras for the right-click context menus and icons...so forth.
So, to know if it is working is really just a matter of finding an apk or .jar and double-clicking it. You should get a terminal window showing the process and a box confirming success or failure, plus a reason why if failure.
The only dependency is the Java Runtime environment, which is the same common necessity as for any other Apktool environment. You can get it here, and I'll throw that link in the OP in a second.
The next iteration of the installer is going to be a lot cleaner, plus be more verbose so you actually know what it's doing. My first thought in putting it out was just to see how well the decompile/recompile stuff worked.
Bombed out is a rough term. The installer is just writing a bunch of registry keys, and deleting some other ones to make sure other associations don't mess it up. So, some registry operations don't always work - there just there to be sure. I've actually worked on cleaning that up in the next iteration I'm cooking.
And yes, there shouldn't be any more size increase past extracting the original zip. All the files used are enclosed. "Installer" is just telling Windows that "droid shell is at location %CD%" and "use app xxx in %CD% to open file XX". A few extras for the right-click context menus and icons...so forth.
So, to know if it is working is really just a matter of finding an apk or .jar and double-clicking it. You should get a terminal window showing the process and a box confirming success or failure, plus a reason why if failure.
The only dependency is the Java Runtime environment, which is the same common necessity as for any other Apktool environment. You can get it here, and I'll throw that link in the OP in a second.
The next iteration of the installer is going to be a lot cleaner, plus be more verbose so you actually know what it's doing. My first thought in putting it out was just to see how well the decompile/recompile stuff worked.
Click to expand...
Click to collapse
I didn't mean to offend with the term "bombed out", it may have been a bit of a rough term. I just meant the script terminated my desktop and hung up.
It actually succeed regardless of the errors, and is working like a charm. I apologize, I should have actually tested it before posting. I shouldn't have assumed that it didn't work based off of the terminal output/behavior.
Also, I would like to say that I greatly appreciate the work that you put into this, and all your other projects here on xda. I'm running your 4.4.4 gpe port for the verizon m8 as my primary rom, and it is by far the most stable port I have ever had the pleasure of flashing.
Attached are screenshots of DroidShell successfully decompiling and recompiling an apk with a simple right click selection on windows 7 pro. Good stuff.
Thanks! tons
Thanks for the work. very useful.
The compiling and decompiling of apk is perfect on Win 7 pro.
From the OP, i also got the impression it would unpack / pack images, so i tried it with a system.img copied to the droidshell directory.
With the command c:\droidshell\unpackimg system.img, I got the error as shown in screenshot
Am I doing something wrong, or is this not supported yet?
arbit12 said:
Thanks for the work. very useful.
The compiling and decompiling of apk is perfect on Win 7 pro.
From the OP, i also got the impression it would unpack / pack images, so i tried it with a system.img copied to the droidshell directory.
With the command c:\droidshell\unpackimg system.img, I got the error as shown in screenshot
Am I doing something wrong, or is this not supported yet?
Click to expand...
Click to collapse
It only works for boot images at the moment. System images are a different beast.
Sent from my HTC6525LVW using XDA Free mobile app
digitalhigh said:
It only works for boot images at the moment. System images are a different beast.
Sent from my HTC6525LVW using XDA Free mobile app
Click to expand...
Click to collapse
Okay. Thanks for the info.
thisguysayswht said:
I didn't mean to offend with the term "bombed out", it may have been a bit of a rough term. I just meant the script terminated my desktop and hung up.
It actually succeed regardless of the errors, and is working like a charm. I apologize, I should have actually tested it before posting. I shouldn't have assumed that it didn't work based off of the terminal output/behavior.
Also, I would like to say that I greatly appreciate the work that you put into this, and all your other projects here on xda. I'm running your 4.4.4 gpe port for the verizon m8 as my primary rom, and it is by far the most stable port I have ever had the pleasure of flashing.
Attached are screenshots of DroidShell successfully decompiling and recompiling an apk with a simple right click selection on windows 7 pro. Good stuff.
Click to expand...
Click to collapse
Oh, no offense taken.
I came at this project, as I do with most, with the mindset of "OOOH, SHINY THING. I MUST SHOW EVERYONE." So, first thought was putting out the app, despite some of the install stuff being a bit dirty.
However, the next iteration is shaping up to be quite lovely. See below.
arbit12 said:
Okay. Thanks for the info.
Click to expand...
Click to collapse
So, it appears that this question has motivated me to try making that function a reality sooner than later.
However, as far as I can see, the *ONLY* application for windows that currently deals with system images right now is Ext2Explore, which is a bit old and doesn't have command-line support.
Fortunately, there's source code for it, so I'm currently downloading Visual Studio and will see if I can add command line functionality, as well as make it launch with UAC prompting.
If I can make this work, my plan is to make one handler for .img files that works like so:
1. Look at the file passed to it and see if it's a boot image. If it is, extract and exit.
2. If it's not a boot image, try to extract it as a system image. If it is, extract and exit.
3. If it's not a boot or system image - pass it to explorer and mount as usual.
I can do # 1 and #3 already...it's just getting #2 to go.
Also, I've added a check in the installer that looks for the installation of notepad++. If it finds it, it will create additional associations for .xml, .prop, conf, config, .smali, and whatever else I can think of that I could possibly need to edit in a ROM.
Then, lastly, with all these additions, I'd like to make the installer a bit more verbose. Give some options so it's not just an all or nothing install, make it prettier, etc.
digitalhigh said:
Oh, no offense taken.
I came at this project, as I do with most, with the mindset of "OOOH, SHINY THING. I MUST SHOW EVERYONE." So, first thought was putting out the app, despite some of the install stuff being a bit dirty.
However, the next iteration is shaping up to be quite lovely. See below.
So, it appears that this question has motivated me to try making that function a reality sooner than later.
However, as far as I can see, the *ONLY* application for windows that currently deals with system images right now is Ext2Explore, which is a bit old and doesn't have command-line support.
Fortunately, there's source code for it, so I'm currently downloading Visual Studio and will see if I can add command line functionality, as well as make it launch with UAC prompting.
If I can make this work, my plan is to make one handler for .img files that works like so:
1. Look at the file passed to it and see if it's a boot image. If it is, extract and exit.
2. If it's not a boot image, try to extract it as a system image. If it is, extract and exit.
3. If it's not a boot or system image - pass it to explorer and mount as usual.
I can do # 1 and #3 already...it's just getting #2 to go.
Also, I've added a check in the installer that looks for the installation of notepad++. If it finds it, it will create additional associations for .xml, .prop, conf, config, .smali, and whatever else I can think of that I could possibly need to edit in a ROM.
Then, lastly, with all these additions, I'd like to make the installer a bit more verbose. Give some options so it's not just an all or nothing install, make it prettier, etc.
Click to expand...
Click to collapse
Captain_Throwback said:
Click to expand...
Click to collapse
Don't get too excited. I've never touched C++ before, and ext2Explore was done in VisualStudio.net and a WYSIWYG editor called QT. I found updated source for the program from 2012 and have gotten it to import into QT, however, it needs MingW and some other dependencies. I'll be lucky if I can even get it to compile again, let alone work, let alone work with added command-line stuff.
However, that's still the goal.
Also, I want to add wget (windows equivalent) stuff to auto grab and install java and notepad++ while we're at it.
So, I think Ext2Explore is more work than it's worth.
OSFMount, on the other hand, just let me mount a system.img as a removable disk with read-write access. I'm going to go down this road...
Good to hear that. Extracting system.img on windows can be a real pain at times - this would be great.

Categories

Resources