Market on Emulator - Android Software/Hacking General [Developers Only]

Hi everyone! It's my first post. Did the "Noob video" kind of emerge from a frustration with new users?
Purpose
I want to run the Android Market on Android 2.3 inside the emulator, since I don't want to register a Google account on my phone. I donwload the apps there and transfer them to my phone.
Situation
I successfully set up an AVD with 1.6 and 2.3 where the Market seems to run flawlessly. However, it's not really deterministic what conditions lead to a running Market [1]. I want to be able to make all modifications of the SDK images and APKs myself in order to run the market. I consulted several guides already [2]:
Varun's How to: Install Android market on Emulator <hxxp://blog.varunkumar.me/2010/11/how-to-install-android-market-in-google.html>
Anything simple: How to use Android Market on Android Emulator 2.2 <hxxp://anythingsimple.blogspot.com/2010/09/how-to-use-android-market-on-android.html>
Tech-Recipes: How Do I Install the Android Market on Android SDK <hxxp://w#w.tech-recipes.com/rx/10004/accessing-android-market-from-android-sdk/>
CareAce: How to fix "protected" Android Market app <hxxp://w#w.careace.net/2010/06/16/how-to-fix-protected-android-market-app/>
All files I used are provided.
What I did
I followed the guide by Varun and it worked quite well, but it really worked only after I changed ro.secure=1 and ro.allow.mock.location=0 in default.prop (located in ramdisk.img).
Create a new AVD. Config.ini:
Code:
hw.lcd.density=160
hw.gps=yes
hw.camera=yes
hw.ramSize=256
sdcard.size=256M
Edit build.prop (see attachment, original values are commented with ###)
Install Vending.apk and GoogleServicesFramework.apk
Delete SdkSetup.apk
ro.secure=1 and ro.allow.mock.location=0
When using GSF provided by Varun, the Market runs fine. When I use the GSF from my phone, it doesn't work. So, my two questions:
What exactly does a running market depend on? (Only fingerprint and gsf?)
Is the GSF by Varun the original or a patched variant?
How could my version of the GSF be modified to work?
Attachments
CRC32 values are in parantheses.
com.android.vending.apk (6502c750)
Original Market v2.3.6 as downloaded by the Market Updater
Vending_Adi.apk (a51aa807)
Above patched on byte basis [3] (no re-assembling, modification directly in classes.dex for minimal deviation from original).
Installed on my working AVD.
GoogleServicesFramework_htc.apk (3f770666)
Version 2.2.1
I pulled this file from my HTC Desire Z with Android 2.2.1
GoogleServicesFramework_varun.apk (6b3ea386)
Version 2.2
Available from Varun's guide
[1] A non-running Market only shows TerraTime on the home screen and games like PapiWall and PapiStep.
[2] Sorry for the obfuscation of the links. It's because this is my first post.
[3] I will explain every modification in detail, if asked for.

I've been trying to get the market working on the emulator "properly" for days.
Can you find protected apps such as g-mon or dr droid?
If yes PLEASE can you post a detailed howto?
It could be that they fixed it with the latest packages, judging from comments on some blog entries on the subject, so don't update your SDK before making a backup!
Thanks in advance,
- MF

How did u change "ro.secure=1 and ro.allow.mock.location=0" ?

MFighter said:
Can you find protected apps such as g-mon or dr droid?
If yes PLEASE can you post a detailed howto?
Click to expand...
Click to collapse
Edit build.prop in "system.img" before running emulator.
1) copy "%SDK%\platforms\android-10\images\system.img" "%userprofile%\.android\avd\%AVD%.avd\system.img"
2) open this file with binary file editor,
3) search "# begin build properties" or "23 20 62 65 67 69 6E 20 62 75 69 6C 64 20 70 72",
4) rewrite build.prop's content with real device's.

mrawekul said:
Edit build.prop in "system.img" before running emulator.
1) copy "%SDK%\platforms\android-10\images\system.img" "%userprofile%\.android\avd\%AVD%.avd\system.img"
2) open this file with binary file editor,
3) search "# begin build properties" or "23 20 62 65 67 69 6E 20 62 75 69 6C 64 20 70 72",
4) rewrite build.prop's content with real device's.
Click to expand...
Click to collapse
Don't suppose you would be willing to share your system.img file. I understand most of this but I tried to edit the system.img with no success. And there is no ramdisk.img in the avd folder. Can you help me out? I've tried everything. All I want to do is be able to download apps from the market so I can install on my tablet which is a Pandigital Planet and some of the apps don't show up on the market.

Persisting system.img and trying to make Android Market application to work
Actually, there is a way to persist system partition.
Built-in command line help shows that there is an optional persistent system-qemu.img. If it worked, all the hoops below would be not necessary.
If it try to create system-qemu.img in .avd directory as a copy of system.img from one the platforms in the SDK, emulator fails with an error
Code:
ko:Missing initial system image path!
. My guess is that emulator was deliberately crippled to not support persistent /system partition out of the box. If someone has a method to make system-qemu.img to actually work, please post.
I quickly looked through the emulator sources, the patch to enable system-qemu.img would be a pretty easy task for someone who has built android emulator from sources at least once. Any volunteers?
Read on for a hack to get system-qemu.img functionality.
When emulator starts, it creates a copy of system.img in %temp%/AndroidEmulator with some random name like TMP9323.tmp. If you do
Code:
adb -e remount
to mount /system as rw, you will get the writable system, but with an empty free space. Everything you do to /system is saved into this .tmp file.
The next trick is to start emulator instance with more virtual sectors than there are actually are in the stock system.img. You do that by starting emulator with the aptly named emulator command like so
Code:
emulator @AvdName -partition-size 256
If look later at free space with df, you will get something like this
Code:
adb -e shell df
Filesystem Size Used Free Blksize
/dev 252M 32K 252M 4096
/mnt/asec 252M 0K 252M 4096
/mnt/obb 252M 0K 252M 4096
/system 248M 96M 151M 4096
/data 248M 34M 213M 4096
/cache 64M 1M 62M 4096
/mnt/sdcard 252M 1K 252M 512
/mnt/secure/asec 252M 1K 252M 512
Note that you now have some free space in /system.
Later you do
Code:
adb remount
from your host shell. This is essentially the same as running
Code:
#mount -o remount,rw /dev/block/mtdblock0 /system
from emulator shell.
Now you get the fully writable /system filesystem. You can copy with
Code:
adb push
any files you like into the /system and they will be successfully written.
After you are happy with your new /system, from
Code:
adb -e shell
you sync filesystems and make system read-only:
Code:
#sync
#mount -o remount,ro /dev/block/mtdblock0 /system
After that you can hot copy the .tmp to some other place and close the emulator with an [x] button from the window title bar. I do not use snapshots, so closing emulator is akin to removing the battery from a real device.
And using snapshots to get a "persistent" /system is impossible without rebooting. Currently it is not possible to shutdown via emulated power button (F7). The emulator manual says just to close the emulator window. If you do that with snapshots enabled, you will get into the state you were when you closed the window. Also it is not possible to reboot, as there are no documented way to reset the virtual processor. The reboot command does not work. It just hangs the emulator-arm.exe with 100% use of the CPU core it happens to run on. That is another observation for emulator was deliberately crippled or not developed to a point when resetting the virtual processor is possible.
Later you put your .tmp file into your .avd directory with a name of system.img. And when you start your emulator (even from AVD Manager GUI) you will get your new /system.
If you later need to make some modification to /system, you need to go through all the steps again.
When starting emulator with a new /system for the first time, I recommend to check "Wipe user data" to recreate the file and directory structure in the /data partition, especially if you pushed new .apk files into /system/app or pushed some other system wide components like .jar (framework) or .so (library) files.
Wiping a /data partition can be a lengthy process because it leads to recreation of dalvik-cache, the most CPU demanding process. In most cases, you can avoid the /data wipe. But if you push Google Apps to a pristine AVD, you should do a wipe so that Google initialization program with "Touch Droid to begin" kicks in. It is a first step screen the user sees at least on a real, Google "enhanced" device based on Android 2.3.
You can even observe how userdata-qemu.img file gets bigger as dalvik-cache and other parts of /data get populated. You may even use the
Code:
top
command to see the processes on the emulated device.
If you are running emulator from the command line you can add -wipe-data option to wipe the /data partition.
Optionally you can remove cache.img from .avd directory to clear the cache. cache.img will be recreated from scratch in this case.
After all these manipulations, the only way to launch AVD would be from command line as -partition-size 256 must be specified every time, otherwise you will get a kernel panic when mounting the /system partition.
The GUI option "Ideal size of system partition" is actually ignored. Its value is not copied into hardware-qemu.ini from config.ini, but stays at the size of initial system.img. Just another observation that emulator was deliberately crippled.
If emulator hangs with textual (not graphical) "A N D R O I D" on its screen, it is likely that the new system.img is corrupted and/or the partition size of 256MB has not been specified for not stock system.img. You can verify this by launching AVD from the command line with -show-kernel option to get all the kernel output in real time. You will likely find a kernel panic there.
If emulator hangs with a graphical ANDROID animation (aka boot loop), you can use
Code:
adb -e logcat
tool to look for any errors in the start up process. Examples below.
But that was an easy part. Now we need to install Vending.apk and its dependencies.
As my goal is Android 2.3.3, as it is a close to current majority of real devices as it can be. I tried to work with the version of Google Apps for CyanogenMod. I own an HTC Desire with CyanogneMod 7.1-nightly. I downloaded the initial gapps-gb-20110828-signed.zip from the link in CM wiki. This .zip, when flashed through recovery works without any issues on CM. Also I pulled from HTC Desire an updated Android Market .apk. Also I generated a demo app which shows a text edit and a button, but does nothing just to check that .apks can be installed both as system and 3rd party apps.
Here is what I tried.
0. Started with a Google API (API Level 10) emulator images. Pushed unpacked gapps. Everything worked: initial Google account registration, Talk, Maps, Latitude, Navigaton, Places, News and Weather (widget + app), Search (including widget). But not Market. There were no icon for it. Fail.
1. Started with Android 2.3.3 (API Level 10) emulator images. Pushed unpacked gapps. Got a boot loop with an exception in logcat related to contacts migration/upgrade. Strange, Google API 10 image may have something that plain image does not have. Fail.
2. Started with Android 2.3.3 (API Level 10) emulator images. Pushed upgraded Vending.apk to /system/app. No Market icon after a reset. Even with data wipe. Fail.
3. Started with a Google API (API Level 10) emulator images. Tried to install through adb the latest Vending.apk as a third-party app. adb install failed with "INSTALL_FAILED_ALREADY_EXISTS". Fail.
4. Started with a Google API (API Level 10) emulator images. Deleted /system/app/SdkSetup.apk. Tried to install latest Vending.apk with adb. Same result as in 3. Fail.
5. Started with a Google API (API Level 10) emulator images. Deleted /system/app/SdkSetup.apk. Pushed latest Vending.apk to /system/app. After reboot no icon. Also pushed own app, it got the icon. Vending.apk got no entry in /data/dalvik-cache, but demo app got it. Something prevents the Vending.apk to be recognized as a valid app. Fail.
6. Same as 5, but pushed not as Vending.apk, but as foobar.apk. Same result. No icon after reboot, no entry in dalvik-cache. Fail.
Spent the last 4 hours for figuring out the method for /system persistence and Vending.apk experiments.
Some possible reasons for Market Application to not show up in dalvik cache and no icon in launcher application list:
1. Some metadata in .apk prevents it from being processed. SDK level?
2. Crypto keys mismatch. Firmware signing keys != .apk signing keys.
3. Apk contents conflict with something existing in the firmware. (INSTALL_FAILED_ALREADY_EXISTS).
4. Permission issues.
5. System image configuration variables like ro.secure and ro.allow.mock.location.
The next step for me would be to read 3 books:
1. Learning Android.
2. Application Security for the Android Platform
3. Android Forensics: Investigation, Analysis and Mobile Security for Google Android
As I plan to fork or contribute to pffmod (http://forum.xda-developers.com/showthread.php?t=996726), I had to read them anyway.
If someone has a working method to put recent Android Market into Android 2.3.3 (API level 10) or Google API (API level 10) emulator images, please post.

nice information M4rketSqueezer and geckoneer! may be try to change the property ro.config.nocheckin=yes? i have 2.1 emulator with market now..same method as M4rketSqueezer

I don't have my device yet and want to take advantage of what few apps are still 49 cents.
I've been trying to follow this method today and when I get to the pulling build.prop part I get a cmd error saying adb is not recognized as an internal or external command.
I'm not sure what I did wrong :\

I've download the image referenced in this article at techdroid.kbeanie.com/2011/01/android-market-on-emulator-22.html. This post is merely for 2.2, but I managed to extract their googleservicesframework.apk and vending.apk from inside the image(using adb pull while the emulator is running). I then created a normal 2.3 AVD, started it from the command line with -partition-size 100, pushed the pak files I just extracted from 2.2, and followed geckoneer's hints for getting the system image that contained the pushed apk files. Now having that image with the market apk files, I ran that image inside the emulator and got the market running successfully. Once you start the market for the first time it'll run you through the google account registration wizard. Once you complete with an account, you'll have the market running and I tried searching and downloading applications from it. I've attached the two apk files for convenience.
Two points are noteworthy here: I had to change /system/build.prop inside the system image to one of the real supported models in google market at support.google.com/googleplay/bin/answer.py?hl=en&answer=1727131. I extracted the file from my mobile which was Samsung galaxy mini GT-S5570. I had to replace some of the values(especially those related to the model and manufacturer) in build.prop inside the emulator with those from my mobile.
The second point is that, after I exit the market(with several back-button presses till I get to the home screen) or restart the emulator. It seems the market isn't working properly. By working properly I mean that when I search for something in the search box, it just reports the number of matched results it found for my search(like saying 543 matches or so), without actually displaying the result. So far the only fix I managed to find to this was by restarting the emulator from the command line with -wipe-data; this repeats the google account registration process when I try to run the market again, and it's once again running effectively just after the registration, but it'll get crippled soon if I exit it or restart the emulator. This seems like an annoyance, but other than that the image works fine.

Related

Testing ROM Images in the SDK Emulator!

I started looking at Android Development and got the whole Dev kit and the Eclipse enrionment setup and working fine.
The question I have is that I would try different apps I develop on the different ROMs available.
How do I get any of the new ROMs, like the HERO ROM ZIP files I can download to run in the emulator or is it even possible?
Im assuming that the system.img file in the SDK id the file I need to replace or re-create, but how is this done?
I am a noob to the develop stuff so step by step instructions would be much appreciated.
I also think this would be great for other developers and ROM makers to be able to test in this way.
Thanks
Simon
Hopefully THIS one dont get closed, it IS asking a development question...anyway,
I would like to know this as well. I would like to test things myself (getting better at manipulating them), and would like to know what he is asking as well.
Thanks.
I don't think this would work, as the ROMs are hardware depending, me thinks. Or at the least the kernel and drivers are.
maybe this will help, maybe not, just an emulator primer, so maybe people can jump on board with this
under <sdk path>/tools
to list out your AVD(android virtual device)
android list targets
will return:
Available Android targets:
id:1
Name: Android 1.1
Type: platform
API level: 2
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id:2
Name: Android 1.5
Type: platform
API level: 3
Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
id:3
Name: Google APIs
Type: add-on
Vendor: Google Inc.
Description: Android + Google APIs
Based on Android 1.5 (API level 3)
Libraries:
* com.google.android.maps (maps.jar)
API for Google Maps
Skins: HVGA (default), HVGA-L, QVGA-P, HVGA-P, QVGA-L
from here we choose our integer target, lets say 2
creating an AVD:
android create avd -n your_chosen_name_here -t 2
When you create an AVD, the android tool creates a dedicated directory for it on your development computer. The directory contains the AVD configuration file, the user data image and SD card image (if available), and any other files associated with the device. Note that the directory does not contain a system image — instead, the AVD configuration file contains a mapping to the system image, which it loads when the AVD is launched.
By default, the android tool creates the AVD directory inside ~/.android/avd/ (on Linux/Mac), C:\Documents and Settings\<user>\.android\ on Windows XP, and C:\Users\<user>\.android\ on Windows Vista
Click to expand...
Click to collapse
to run your newly created AVD:
emulator -avd your_chosen_name_here
maybe this will help, but I'm guessing everyone here already knows all of this.
references:
http://developer.android.com/guide/developing/tools/emulator.html#starting
Yeah, I understand that you can specify the AVD.
The only thing now is to edit the AVD to point to a different image. This is easy!
The system image file is a *.img file.
So how do we get our ROM images compiled into the IMG file format?
There must be a tool, but I cant find anything.
And what hardware does the emulator, emulate? Maybe it ignores the hardware specific calls throu an API so the ROM image target hardware shouldn't matter.
I just started messing around with rom's and after I build one I put system.img userdata.img and ramdisk.img from my /mydroid/out folder into the sdk's image folder and start the and it uses the new rom when I start the emulator
thats the easy part
do a nandroid backup
copy the sdk/platforms/android-1.5
to something like sdk/platforms/MINE
go to your AVD directory AVD/whateveryoucalledit
open up the config.ini
edit:
skin.name=HVGA
skin.path=platforms\MINE\skins\HVGA
image.sysdir.1=platforms\MINE\images\
go to your nandroid backup on your sdcard
copy system.img
go to sdk/platforms/MINE/images/
and paste the nandroid system.img
now run your AVD and it will boot that system.img
im running CyanogenMod rom right now in the emulator
hint* number pad 7 with numlock off in the emulator is how to open up the hardware keyboard
Awesome. I'll be giving this a try later.
One question: The apps are in the system.img file on the SDK images as far as I can tell. What do you do with all the apps in the new ROMs?
whatever you want to do with them, they're all there, even android market works perfectly
And where are you guys getting the system.img file from?
The ROM zip files dont have them.
Sorry....Im noob to this. LOL
ggolemg said:
whatever you want to do with them, they're all there, even android market works perfectly
Click to expand...
Click to collapse
OK, Im confused. Can you just unzip the ROM files and place in the folder that you point using the same folder structure?
OR
Do you have to have a system.img ?
Another thought:
I dont want to have to install all the ROMs just to create a Nandroid backup to get the images. There must be a way to create the images from the raw files in the ZIP files.
Any ideas?
UPDATE: The same technology used by Nandroid itself!
The google android emulator included in the google android sdk is limited. Although you can use 'adb push' to upload more tools, but one has to do it again next time. Follow the steps to create a enhanced system.img:
1. system.img is yaffs2 flash file system, so firstly you need the mkfs.yaffs2 tool, download it in the following link: Release Android Yaffs2 Tool (Both X86 And ARM). One has to be a registered user to download the tools.
2. use the 'adb push' to upload tools to android emulator, executables in /system/bin/, libraries in /system/lib, one can also create folder. One need change the file mode necessary.
3. upload the ARM mkfs.yaffs2 tool, use the following command to create system.img: # mkfs.yaffs2 /system /system.img
4. download the system.img to local with command 'adb pull', replace the system.img in your emulator folder/tools/lib/images/
Click to expand...
Click to collapse
so it seems like it would be just as much fun doing a nandroid backup
*edit*
so now the real question is, how do we go about ripping out the nandroid functionality to be able to do this locally?
*edit 2*
it is the mkfs.yaffs2 tool
Usage:
mkfs.yaffs2 yourdir yourimage
Ohsaka said:
NANDROID - CYGWIN DIRECTIONS (not not not, I repeat, not fully tested and verified yet)
Changes so far if you are using cygwin:
1) Make sure you have the 'netcat' and 'gcc' packages, else just run cygwin.exe again and get them.
You can test if you have them by running 'which nc' and 'which gcc', both commands should return /usr/bin/<command>
2) Compile the mkyaffs2image executable.
Inside the extracted nandroid archive directory, goto the tartools\yaffs2\utils\ directory (inside a cygwin prompt) and type 'make'.
This should generate a file named "mkyaffs2image.exe" which you need to place somewhere on your path.
(Hint: If you haven't downloaded the Android SDK, abort now. Wait for more explicit directions... Else, place the .exe where adb is, since it should be on your path already)
3) Edit the nandroid.sh script. (else you get a permission denied error when the script tries to run the dump_image-arm file)
Find the line:
adb push ./$tool /cache/$tool
Add the following line after it:
adb shell chmod 777 /cache/$tool
4) Make a managed mount named /tmp (else windows will puke on the long unix filenames with colons, etc)
mkdir /tmp
mount -o managed c:/cygwin/tmp /tmp (Note: change c:/cygwin to be the directory cygwin was installed to, you can find it by typing 'cd /' and then 'explorer .')
5) Follow the standard "tar + mkyaffs2image" directions to generate the last three .img files. They refer to the /tmp directory which you created in the previous step.
Viola! Looks like I have a complete backup image now...
$ ls -l
total 117504
-rw-r--r-- 1 Osaka None 2621440 Jun 12 21:31 boot.img
-rw------- 1 Osaka None 737088 Jun 12 22:07 cache.img
-rw------- 1 Osaka None 53570880 Jun 12 22:06 data.img
-rw-r--r-- 1 Osaka None 262144 Jun 12 21:31 misc.img
-rw-r--r-- 1 Osaka None 5242880 Jun 12 21:31 recovery.img
-rw------- 1 Osaka None 57885696 Jun 12 22:06 system.img
Now I just need to drink up the courage to test it on my phone!
Click to expand...
Click to collapse
ggolemg said:
so it seems like it would be just as much fun doing a nandroid backup
*edit*
so now the real question is, how do we go about ripping out the nandroid functionality to be able to do this locally?
*edit 2*
it is the mkfs.yaffs2 tool
Usage:
mkfs.yaffs2 yourdir yourimage
Click to expand...
Click to collapse
Is this for Linux (which I don't have) and if so, is there a Windows version?
short answer: yes its only for linux
long answer is a plea for help i posted in the nandroid thread about it:
I was wondering if there was a method to use the yaffs3 command to make a system.img from an unzipped rom placed on the sdcard through ADB, from what I've seen nandroid is almost exactly what I'm after.
The issue of why I can not just do this through linux, i can. I just want to be able to do it through windows some way without loading the entire rom on the phone and nandroiding the system.img out.
Either the aforementioned method, or the ability to mount a portion of my computers hard drive as a recognizable mountable partition within android running on the usb connected phone, loading the rom on that partition, unzipping it there, running ADB and making the system.img. But this way seems to bring up more problems than it's worth.
Or.. running the make yaffs3 command through ADB running the emulator with the rom unzipped on the virtual sdcard. This would actually be the best option as it would not require an actual phone.
I hope someone can help. Thank you very much.
Click to expand...
Click to collapse
hopefully someone knows the answer, I'm still trying though.
so on windows we would adb push the update.zip to the sdcard on the emulator
unzip it on the sdcard, there are apps for that
adb shell mkfs.yaffs2 sdcard/<extractedzipfilename>/system/ sdcard/system.img
adb pull the newly created system.img and proceed to load it in the emulator
i know im missing a ton here, please someone correct me
I'd love to be able to run these images in the emulator on windows!
ggolemg said:
thats the easy part
do a nandroid backup
copy the sdk/platforms/android-1.5
to something like sdk/platforms/MINE
go to your AVD directory AVD/whateveryoucalledit
open up the config.ini
edit:
skin.name=HVGA
skin.path=platforms\MINE\skins\HVGA
image.sysdir.1=platforms\MINE\images\
go to your nandroid backup on your sdcard
copy system.img
go to sdk/platforms/MINE/images/
and paste the nandroid system.img
now run your AVD and it will boot that system.img
im running CyanogenMod rom right now in the emulator
hint* number pad 7 with numlock off in the emulator is how to open up the hardware keyboard
Click to expand...
Click to collapse
Hm, the emulator just hangs on the ANDROID.. message, similar to when the standard system.img was in.
anyone figure out how to do this on a mac?
thanks if anyone can.
johnnylicious said:
anyone figure out how to do this on a mac?
thanks if anyone can.
Click to expand...
Click to collapse
I found this somewhere else and take no credit for it. I did shorten the steps.
Of course this is once you have the sdk installed on your mac
1. Run Terminal, and change to the 'tools' directory of the SDK (or add the tools directory to the path settings in ~/.profile).
2. Type './android list target'
3. Note the 'id' number of the '1.5' target (in my case it's '2')
4. Type './android create avd -n enhanced -t 2' (substitute 2 with the target number determined above if required)
5. You will be prompted to create a hardware profile. {You can leave as default no}
6. Use nandroid to create a backup then copy system.img
7. Copy file to ~/.android/avd/enhanced.avd/system.img
8. You're ready! Type './emulator -avd enhanced' to run! Note: inital boot may take a few minutes!
Can anyone post up the
Android Yaffs2 Tool (Both X86 And ARM)
for download? The above link doesn't work. I did a google search and all the D/L links are referring to the same location.
thanks!

[TUTORIAL] Jit hack for beginners - please move to G1 General

Note: This guide is for beginners who might have barely been able to get a custom rom running on their phone, who might not know how to unzip a file on their android phone, and who are not comfortable navigating a linux file system, but who are daring enough to try a simple hack to get significantly more speed out of their phone. Before reading this, please read the thread in the first reply below this post, and if that works for you - use it! If you want to know more, find out what its doing, or if the other Jit hack technique does not work, you can try this. Or you can tell me I fail. Maybe a moderator could move this thread to the basic G1 subforum?
Hello,
I really enjoy both Super D rom and the Jit hack posted by xda member licknuts in the post called [HACK] JIT enabled Dalvik VM on Android 1.6 (Dusted Donuts) [Hack] - the link to this post can be found in the first reply here, if you scroll down.
So, I thought id post a guide on how to accomplish this hack using Amon_Ra's recovery, Super D or Cyanogen rom (probably works on other roms listed in first post of above thread), and a couple apps available from the android market. I'm not trying to take any credit for this hack - I'm just trying to explain it step-by-step for people who have barely managed to get a rom running on their phone but can't get the hack working using the instructions in the above thread and might not be very experienced with navigating around a linux filesystem.
Please read all of this before beginning - you'll need to write some of it down for when you're in the recovery console doing some file copying/moving/renaming. Especially take note of the instructions at the end for restoring in case of a disaster, although if you're really afraid even after following these instructions, you probably shouldn't try this.
1. Download and install AndroZip File Manager app from android market.
(this is so we can un-zip or decompress a .zip file we will download later containing a modified libdvm.so file, which we will use to replace the original libdvm.so file, enabling Jit)
2. Download and install Linpack For Android app from android market.
(this is so we can benchmark or test our phone to make sure this hack actually works. we can measure the MFLOPS score, or basically how many calculations the cpu is able to perform in a set amount of time)
3. Run Linpack For Android and press "Run Benchmark" - remember the MFLOPS value.
(it should be around 2.5 or so - when we enable Jit, we should get more like 3.5 MFLOPS which means more speed)
4. Download a specific file from the original thread listed above, BUT get the file from alldroid by t3hsteve... its in the first post of the above-mentioned thread about halfway down.
(if this link goes down, the point is that you need to obtain the new modified jit-enabled libdvm.so file from somewhere, either in a zip file or by itself, and download it to your phone so you can use it to replace the original libdvm.so - the instructions that follow apply only to the specific file above. If you get a different file you'll have to navigate through the unzipping process differently based on where the libdvm.so file is inside the zip file, and the result being the modified libdvm.so file in the root directory of your sdcard (/sdcard) - if you download the correct file from that post you can follow the instructions below exactly. I would post the link but I'm not allowed to post outside links.)
5. Run AndroZip app, and navigate to your download folder. This should just require clicking the "download" folder, since you should already be in the ./sdcard folder which will be listed as your current directory when you start AndroZip.
(If you're not in this directory, navigate back as far as you can by scrollng up in the app and tapping the blue/left arrow to go "up" or back a direcory. You aren't done with this step until you see ./sdcard/download/ at the top of AndroZip and you can scroll down to see the file "dusted-donuts.zip" - this is the .zip dile we downloaded that contains the libdvm.so (and some other files). If you downloaded a jit-enabled/hacked/modified libdvm.so from a different source, you don't need to be doing any of these unzipping steps.)
6. In AndroZip, click "dusted-donuts.zip" and click "extract to." Then click the back arrow in AndroZip, which should take you to the ./sdcard directory. Click "extract here."
(you will see ./sdcard at the top of AndroZip indicating this is the directory you changed to. When the "successfully unzipped file" message has appeared, you have extracted the libdvm.so and possibly some other harmless files which can't do any damage since they're just in your download folder and not one of your android system folders.)
7. In AndroZip, click the "dusted-donuts" folder, which will have appeared after you extracted the above zip file, and then click the "lib" folder (this is all part of the zip file you extrated) - this is where the modified libdvm.so file is. Click AND HOLD the libdvm.so file, and a menu will appear. Click "copy." Click the back arrow (scroll up in the AndroZip app if you can't see it) until you have reached ./sdcard again (you will have to click it twice, once to go from /sdcard/dusted-donuts/lib/ to /sdcard/dusted-donuts/, and a second time to go from /sdcard/dusted-donuts/ to /sdcard, which is where we want to paste the libdvm.so file. Click "copy here" in the upper right - the "copy action successful" message should appear. If you scroll down, you should see libdvm.so and at the top of AndroZip you should see that you're in the ./sdcard folder.
8. Reboot into recovery console.
(the place you go to flash a custom rom and do other low-level operations, by rebooting your phone, or powering it off and then starting it back up and holding Home key and Power key at the same time. Don't hold them when your phone is still shutting down or rebooting, wait until the screen has turned black. You only need to hold them until the G1 screen shows up with white text and the phone vibrates briefly. Then you can let go and you will enter recovery. If the system boots normally, pull the battery and try again.
9. Click "go to console"
(Slide your screen so you can use your hardware keyboard if you haven't opened it already. At the console you might see the message "press enter" - if you do, press enter to get a command prompt. Pressing enter even if you don't see this message won't hurt anything. You should see a command prompt, which is a character or set of characters at the start of a line prompting you for or waiting for a command to be entered. It should look like / or # or # / or > or anything like that. It might also have a flashing cursor, or underscore character that looks like _ or something similar.)
Now we are going to back up the old libdvm.so file and put the new modified one in its place, enabling Jit for a speed improvement.
10. Type these commands, pressing enter after each line:
mount /sdcard
mount /system
(You have now enabled access to or "mounted" your sdcard directory (where the new libdvm.so file is) and your system directory (where the current libdvm.so is) so you can do file operations on them such as copying/pasting and moving/renaming.)
11. Type these commands, pressing enter after each line:
cd /system
cd lib
(You have changed directory (cd command) to the system folder you have just mounted in step 11, and then you have changed directory again to the lib subfolder of the system folder which contains various library files like libdvm.so - optionally, you could just type cd /system/lib and press enter.)
12. Type the following command, and press enter:
mv libdvm.so libdvm.old
(You have used the mv command (move) to rename a file, by "moving" it from one file name to another. This command can also be used in linux to move a file to a new directory sort of like cut and paste. Instead, you could choose a different extension at the end of that command, maybe .bak or something (mv libdvm.so libdvm.bak) - the point is you're renaming this file so its still available if you ever need to restore it (if this process doesn't work or you just want to go back to the way it was).)
13. Type the following command, and then press enter:
cd /sdcard
(This changes directory (cd) to the sdcard folder, where your libdvm.so file should be if you followed the steps above. We have to use a leading slash / before sdcard because we are telling linux or the terminal to change to a new main directory and not a subdirecory in the /system/lib directory, because that doesn't (well, shouldn't...) exist.)
14. Type the following command, and press enter (note that the first letter is lower case L):
ls libd*
(This will list (ls) all files (or folders too i think) that start with libd, such as libdvm.so file. I if there are no results, or you just see another command prompt, try typing ls by itself and pressing enter. This will show you all files and folders. Hopefully you see the libdvm.so file as a result of doing this ls command. If not, and you're scared and want to go back to the way things were, type: cd /system/lib ...then type: mv libdvm.old libdvm.so - Do Not do that if you are continuing on, it basically undoes what we did in step 13.)
15. Type the following, then press enter:
cp libdvm.so /system/lib/libdvm.so
(This will copy (cp) the modified/hacked/jit-enabled libdvm.so from the current directory (/sdcard) to /system/lib/ so it is in the correct system folder so Android can see it.
You might also try cp /sdcard/dusted-donuts/lib/libdvm.so /system/lib/libdvm.so if you extracted the zip file correctly in one of the steps above but did not move it to the proper place, if the above command doesn't work.)
16. Type the following, and press enter after each line (note that in the 2nd line, the first character is a lower-case L):
cd /system/lib
ls libdv*
(This will change directory (cd) to /system/lib, the libdvm.so folder which will now contain the libdvm.so file you copied there in the last step as well as the libdvm.old file which is the original libdvm in case you need to remove this hack and restore it. The ls command lists files starting with the letters libdv...)
Now you have finished, you can type reboot and press enter. This time, don't worry about holding home and power, because we just want Android to boot normally. This might take a while, but don't worry. Worst case scenario you can pull the battery and reboot into recovery (hold home + power) after you put the battery back in. Then you could do something like this to restore your original backed-up libdvm.so:
ONLY DO THE FOLLOWING IF... you want to restore your system back to normal and remove the modified libdvm.so file:
mount /system
cd /system/lib
ls libd* (confirm you have both libdvm.so and libdvm.old)
rm libdvm.so (removes libdvm.so, like delete command)
mv libdvm.old libdvm.so (moves libdvm.old to libdvm.so, like rename command)
If this doesn't work to restore, I'm sorry but you'll have to re-flash your custom rom from recovery.
You can check that this hack is working by using Linpack app and clicking the Run Test button, you should see approximately 3.5 MFLOPS. Click Run Test a few times and that number might grow a little if it is less than 3.5.
Thanks to the original poster licknuts mentioned above - all credit goes to him and the original people who figured out this hack in the first place.
[HACK] JIT enabled Dalvik VM on Android 1.6 (Dusted Donuts) [Hack]
the original post by licknuts, it is a more informative read and instructions are a lot more concise
licknuts said:
Primer: Read this about Dalvik VM http://en.wikipedia.org/wiki/Dalvik_virtual_machine
Read this to: Google Groups post about JIT compiler for Dalvik VM from Android-Platform Link
From the post we see that this particular compiled library is ALPHA, so results can vary, but from reading most posts in this thread the results are right near the talked about 3x faster code, stability is going to vary on what apps and or widgets are running. More Widgets = slower performance as these have processes that are eating cycles. When testing with Linpack wait for the advertisement to load first then tap the benchmark button and remove your finger from the touch screen. Background process such that interrupt or having auto-rotate enabled while testing is going to give you slower benchmarks.
In short your apps should load faster and run faster, particularly 3D games. The web browser is faster and you can actually scroll through pages even while graphics are still loading.
The reboot when enabling it is long even appearing to hang at the G1 Screen for 5 minutes or more but once it starts booting past this you will know that your ROM is compatible. The cause is that the dex files are being optimized, after about a third reboot, your ROM should feel pretty snappy and launching apps should be quicker as well as switching apps. The snappiness lasts as well and as some may have said that it's a placebo effect are wrong. Bench mark readings prove it and more importantly a few ROM builders have included this in their 2.1 ROMs as experimental.
The libdvm.so that t3steve cross compiled for the DROID at the time was for Android 2.0, the library works for with newer ROMs Android 1.6 that have some eclair pieces built into the kernel, CyanogenMOD has been using bits and pieces for a while now, if other ROM builders have been using his kernel and framework than a good chance it will work for your phone as well.
I have nothing to do with the compiling of this or the exact functions of enabling JIT except that I had a hunch that the combo might work and it did, so I'm sharing it.
If you aren't good at typing in commands, or don't know how to extract a zip file and understand that a sub folder may or may not exist where you have extracted said zip file to, well.... you may run into some issues, maybe a video tutorial for basic command line on youtube would be a good place to learn.
I wanted to make a very detailed post on www.andoidonroids.com about how to mash the JIT enabled Dalvik VM library into Android 1.6 Donuts I'm calling the hack "Dusted Donuts" and take from the name for what you will. I have been using the JIT enabled Dalvik VM for about two weeks and i runs decent but not perfect. Anyhow a death in the family Sunday has kept me from making a decent post and haven't had the time to get to the website and post and cross post and give credit where due.
No doubt that aaraya1516 broke the news on http://forum.xda-developers.com/showpost.php?p=5703076&postcount=193 as he was first to break the hack on FastTest, not taking anything away from him on that.
My testing goes back two weeks or more even during the 580mhz & 780mhz hack, I was waiting for someone to compile a boot.img with some 2.x stuff and sure enough the carlospants boot.img from ctso worked with enabling JIT for Dalvik VM, but as we know now the overclocking doesn't work at the moment.
Thank Cyanogen and t3hSteve of which may not know that this was entirely possible. Cyanogen mixed in enough Eclair into his Donuts (he's like Willy Wonka) that makes it possible to use the cross compiled JIT enabled Dalvik VM library from 2.1 for the Motorola DROID 2.0.1 libdvm.so that t3hSteve of www.alldroid.com compiled for the custom roms on Droid.
WARNING: Using other methods supplied from other forum members that include replacing the build.prop may cause problems, using the build.prop from the original VMLIBS.ZIP (which is here for reference and original source for libdvm.so) is definitely going to cause ROM and application problems. Hello....use your head here... the VMLIBS.ZIP is for Motorola DROIDS, why would you put the build.prop file for a DROID on your G1 and expect your apps or ROM to work afterwards? It's so simple, you need 1 file, it's called libdvm.so it goes in /system/lib a file by the same name already exists there and it's in your best interest to at least back it up before overwriting it and gives you the ability in the event that your system doesn't boot up you can restore it through recovery console and get your phone to boot past the G1 screen.
FYI: Some ROMs have the option dalvik.vm.execution-mode=int:fast in the /system/build.prop file, this would need to be changed to dalvik.vm.execution-mode=int:jit or commented out or deleted. If you want to play with advanced options create /data/local.prop and fiddle in there with options available from typing dalvikvm -h in your console or terminal app.
Required:
1. Android 1.6 ROMS with a bit Eclair stuff in the Kernel and framework such as Cyanogen ROM 4.2.x, Super D 1.8 - 1.92, WG Y2.6, FastTest, KingKlick Eclair and more.. This libdvm.so works on Android 2.1 as well as it seems it should.. 1 st bootup is slow and I recommend you let it sit even when desktops are up for a couple of minutes and then reboot it, 2nd and 3rd bootups are faster and smoother response overall even for long durations, days.
FIX YOUR FILE SYSTEM FIRST !!!!!! Got to do it from Recovery Console, It's partly the cause of poorly running ROMS and takes seriously longer to type the command than to fix your unknowingly faulty file system. EXT2 is the worst offender and the built in function to repair falls short, even more so when checking EXT4.
Code:
#e2fsck -fcpDC0 /dev/block/mmcblk0p2
#reboot recovery
For the lazy fingers
#e2fsck -fcpDC0 /*/*/*0p2
#reboot recovery
1. Download www.androidonroids.com/dusted-donuts (File has 3 scripts backup, install, restore, 2 folders, 1 libdvm.so)
2. Extract zip to root of /sdcard or where ever you like (the zip has a folder containing the files named dusted-donuts)
3. Open Terminal or go to Recovery Console
FYI when running the install through Terminal your system may freeze or reboot and if it does I highly recommend that you prepare to enter Recovery Mode and check your file system. EXT2 corrupts quickly choosing this for apps2sd to use is not the best option especially if you are using custom ROMs that may lockup or reboot, basically that's a crash.
Code:
$su
#mount -o rw,remount auto /sdcard
#cd /sdcard/dusted-donuts
#sh backup
#sh install
#sync
#reboot
Check the Dalvik VM execution mode. look at the bottom line with_jit means the it is installed , and look at all of those options that can be jammed into your build.prop and local.prop files
Code:
$su
#dalvikvm -h
Phone won't boot past G1 screen? Go to recovery console and restore libdvm.so (give it at least 5 minutes first before giving up)
Code:
#mount -o rw,remount auto /sdcard
#cd /sdcard/dusted-donuts
#sh restore
#sync
#reboot
---------------------------------------------------------------------------------------------------------------------
prefer to use VMLIBS.ZIP from t3hSteve? This is how you can install using that.
Required:
1. Android 1.6 ROMS with a bit Eclair stuff in the Kernel and framework such as Cyanogen ROM 4.2.x, Super D 1.8 - 19.2, WG Y2.6, FastTest, KingKlick Eclair and more.. This libdvm.so works on Android 2.1 as well as it seems it should..
How to install: (easier to go in recovery mode but can be done through terminal)
1. Download the VMLIBS.ZIP from t3hSteve of allroid.com http://alldroid.org/download/file.php?id=1374
2. You only need the libdvm.so file of which appears to be JIT enabled by default.
3. Backup the original libdvm.so #cp /system/lib/libdvm.so /sdcard/libdvm.so
4. Copy the JIT enabled libdvm.so #cp -f /sdcard/vmlibs/libdvm.so /system/lib/libdvm.so
5. Set permissions on the file #chmod 644 /system/lib/libdvm.so
Optional for disabling: (easier to do vi through recovery console, since the back key escapes out of terminal)
To disable JIT MODE but want to keep the libdvm.so create a local.prop in /data and add dalvik.vm.execution-mode=int:fast
#vi /data/local.prop
press the i key to enter vi interactive mode
type dalvik.vm.execution-mode=int:fast
press back key to exit vi interactive mode
to write the file out and quit vi type :wq
or
restore your backed libdvm.so file from the sdcard.
-----------------------------------------------------------------------------------------------------------------------
Enjoi! the dusted donuts,
-Licknuts (me? I'm like Varuca Salt, I want another pony)
Vendor G1 roms around 1.2 Mflops, Custom G1 roms are around 2.4 MFlops/s and with JIT compiled Dalvik VM 3.6 MFlops/s. At most you will see 3.5 MFlops/s fairly consistently with a minimal load on your system and highs at 3.7 Mflops/s. Test before and after using Linpack from the Market, it's free.
The 13.236 Mflops/s is not normal and you will probably not see with your testing, I have seen 5.x & 7.x but these are far and few between and this took a while with tweaked configurations/settings with a persistent app to kill processes, it is attainable and I hope a ROM developer finds the sweet spot to exploit.
Click to expand...
Click to collapse
You fail...
Jerzeeloon said:
You fail...
Click to expand...
Click to collapse
Could you please explain how I fail? The title of this thread specifies it's for beginners, so if it's too detailed or basic for you why don't you just ignore it rather than being insulting. I took the time to elaborate on all the steps hoping this would be helpful to the many people in the original thread who are unable to execute the batch method posted there or don't know how this works or what it's doing (how simple it is). If someone wants to delete it or move it to a different subforum, go ahead, but don't be an asshole.
jeez you kids are a-holes. he's trying his best to help the community and all you have are insults -.-
@OP Good Job dude hopefully someone likes this
Jerzeeloon said:
You fail...
Click to expand...
Click to collapse
seems that you ment yourself...
@wrb123: I also think thats a great guide for beginners =)
Is there any way to get this working with 1.5 hero roms?? That could be a big improvement.
Jerzeeloon said:
You fail...
Click to expand...
Click to collapse
Hey dude don't be a nob - Good going at least you bothered to help beginners out
To make this thread easier to read, it may be worthwile posting all the console commands in quote boxes. This just improves the overall look of the guide. You might want to try making it a bit less wordy, as the length might actually daunt some beginners, but overall, it is a good guide
goofyog said:
Is there any way to get this working with 1.5 hero roms?? That could be a big improvement.
Click to expand...
Click to collapse
I have no idea if this does or does not work on 1.5 Hero roms... from the original post it seems to work on 1.6 roms with "a bit of eclair" so cyanogen, super d, other non-hero types. If you want to try it, I really don't think you'll brick your phone - it probably just either won't do anything or it'll cause a bunch of instability and crashes, in which case you can pull your battery and restore the original libdvo.so file you've backed up, using the steps above. Maybe someone much more knowledgable than me (like, basically anyone...) can answer, or you could try asking in the original thread found in the 2nd post in this thread.
I think i will do that thnx
I personally think those that cant get Dusted-Donuts JIT enabled shouldn't be running it anyways. JIT is experimental, and hasnt been mainstreamed yet.
Maybe those that find it too complicated shouldnt mess around w/ experimental enhancement till they are built into some ROMs first. Will make things easier for everyone........

GUIDES & FAQs [Android]: ADB Workshop by Adrynalyne and Guide by Captainkrtek

DO NOT POST IN THIS THREAD BEFORE READING THE WHOLE POST
PLEASE ADD GUIDES TO COMMON ISSUES YOURSELVES
To my recollection, the previous WM Guides thread was successful.. so we'll be moving on to android as well - from beginner to pro.
I hope this thread will provide answers to a decent percentage of your questions.
Please hold until guide collecting is finished..
In the meanwhile you are ALL invited to send me links or full guides to add to this thread.. remember, we are all about sharing.
COMING SOON! (in the meanwhile, you've got a great battery life guide at http://forum.xda-developers.com/showthread.php?t=471521 - be sure to thank BruceElliot for it!)
also, if you decide to post a guide, please keep the guide as neat as possible, with a title containing the LEVEL ([BEGINNER], [INTERMEDIATE], [PRO]) and the commonly searched words so that people who look for it can find it easily. (if you can, use the same color (dark orange) and same size (4) and Bold.. for the main title.. tho that's not a must )
post #2. [BEGINNERS+INTERMEDIATE] Replacing System Files using Android Commander
post #3. [EVERYONE] ADB Workshop by Adrynalyne and Guide by Captainkrtek
post #4. [QUICK FAQ's] Common QnA's for beginners by Timmymarsh (work in progress)
[BEGINNERS] Replacing system files using Android Commander
Replacing system files using Android Commander:
(This post was formally based in the HD2's RTL support thread and revolved around our need to replace frameworks)
so:
1. Download the android SDK from: http://dl.google.com/android/android...08-windows.zip
2. EXTRACT(!!!) the android-sdk-windows to c:\
(make sure you extract the dir - not run the setup from inside the zip file)
3. install Android Commander from http://androidcommander.com
4. Connect your device and make sure it's set to Debugging mode in /settings/applications/development/
5. You might have to set a dir containing your adb.exe file. set it to c:\android-sdk-windows\tools\
6. You will see a Total Commander-like interface. you can then copy the framework.jar file to the correct directory (there's no difference between SD android builds and androids in ROM - the system dir will be shown the same way)
a. Yes, you can replace/delete system files while android is running.
b. (for androids running from SD) Any file copied to /sdcard/android/root/system/X will be copied to /system/X in the system file. The sdcard/android root dir is JUST LIKE your root in ROM androids.
c. Make sure you either created a backup or verified a match in any other way before replacing files like frameworks, zimage, modules, etc.. your android might not boot afterwards (I keep all system.ext2 files backed up so that i can restore them incase i screw something up.)
enjoy
[EVERYONE] ADB Workshop by Adrynalyne and Guide by Captainkrtek
This following guide was rewritten by Captainkrtek, please make sure to thank him for it
Original Post:
(http://forum.xda-developers.com/showthread.php?t=879701)
This workshop was held in #android-learning on irc.freenode.net by XDA Member Adrynalyne. All credit to him for this guide, I simply am taking it and turning it into a guide. Here we go!
You can find the raw IRC log here
Good evening folks, and welcome to my ADB workshop. This is by no means a full explanation on the subject, but more of a crash course to help folks get up to speed, and get more from their devices. There may be some things you already know here, so please be patient and respect those who do not.
Reference Files
http://adrynalyne.us/files/How to install adb.pdf
http://adrynalyne.us/files/Using ADB.pdf
So, lets just start with the basics.
What is ADB?
ADB stands for the android debugging bridge and is used for testing and debugging purposes by developers.
However, we like to get more out of our devices, and its a great way to fix things.
Knowing adb can mean the difference between a paperweight and a working phone.
So, to start with, we will look at installing ADB.
Generally speaking, the Sun/Oracle JDK is required to run all SDK functions.
ADB is but one tool in the SDK arsenal.
So, we begin by downloading and installing the JDK. This can be found here:
https://cds.sun.com/is-bin/[email protected]_Developer
Choose your OS, download and install. I recommend that 64 bit users use the regular x86/32 bit version as well.
Moving ahead, we download the Windows sdk from here:
http://dl.google.com/android/installer_r08-windows.exe
Due to already installing JDK, you won't be stopped by the install process.
Now, if you notice, I installed it to:
C:\android-sdk-windows
I did this because it makes things easier when setting up path variables.
I encourage everyone to do the same, but obviously it is not required.
So, this SDK is handy, but is only good up to 2.2. We want the latest and greatest! (Well I do)
So, we navigate to:
C:\android-sdk-windows\
and we run SDK Manager.exe
If you notice in your PDF file for installing adb, you will notice that you can update, and I made a choice not to include earlier sdk versions.
I won't go into full detail on that, but depending on the version of SDK you have, 8 or 9, it WILL make a difference in using adb.
By default, for version 8 adb.exe resides in C:\android-sdk-windows\tools
By default, for version 9 adb.exe resides in C:\android-sdk-windows\platform-tools
We will assume version 9 in this guide
Really, the SDK is installed and adb is usable right now, but in my humble opinion, its not enough
I like the ability to use adb in ANY directory on my machine.
To do this, we edit Windows's environment variables.
Specifically, the system path.
To do this, we click on start, or the orb (depending on OS), and right click on Computer, left clicking on properties in the menu.
If its windows XP, I believe it brings you into advanced system properties immediatly. Vista and 7 need a second step.
On the left hand side, as you notice I have highlighted in the pdf, left click advanced system settings.
Under advanced tab, we left click environment variables...
There are two boxes here.
We are concerned with system variables, however.
So we scroll down the list and highlight path and click edit.
Ignoring all the extra stuff in here, make sure you are at the end of the line, and type
Code:
;C:\android-sdk-windows\platform-tools
The semicolon allows us to separate it
from the previous path statement.
Click ok all the way out.
We now have ADB setup globally. We can use cmd.exe (I use powershell) and no matter what directory we are in, adb is recognized.
If it is not, make certain you entered the path into system variables, and made no typos.
If you installed to a different location, you will need to adjust the path accordingly.
This concludes the section on installing the Android SDK to use ADB.
This next section will be on using ADB, so please open that pdf now.
Now, this applies to any OS, not just Windows.
Well, with the exception of the USB drivers.
I will not go too much into that, but if you take a look at the PDF, it goes through installing usb drivers for the sdk, and how to download them.
Fiarly straightforward, in that rspect.
Now, to setup our phones to use with the SDK and ADB, we must change some settings.
First, we go to menu softkey, then settings.
We scroll down to Applications and tap it.
Under Development, we will check Enable USB Debugging. Please note the SGS phones are different in this respect.
The USB cable must be unplugged before enabling or disabling this setting.
Once this is done, we are now ready to play with adb
One quick note: If you get device not found/conencted, please reboot your phone. DJ05 has a quirk in it where ADBD randomly crashes on boot.
A reboot will fix this
ADBD= ADB Daemon
Ok, continuing on.
Lets look at installing applications. This is also known as sideloading.
Unlike installing from the SD card, it does not require unknown sources to be enabled.
The command for this is
Code:
adb install packagename
This assumes that you are working from the directory where the file is located.
This will install the application to /data/app.
It will also show sometimes useful errors if install fails.
That is not something you will see from the Android GUI.
Now, a lot of us have probably deleted files with apps like Root Explorer. While this isn't really a bad thing, it leaves behind databases and data for the application removed.
This is where the 0kb applicaiton entries come from.
If you take that application entry name, you can uninstall the extra data via adb.
First we go to the adb shell which logs into the phone.
Code:
adb shell
If we end up with a $, we will want admin rights, in many cases. This is not one of them, I don't beleive.
To get admin rights, you want to type
Code:
su
Look at your phone if this is the first time, it may prompt you to allow access. Else you will get permission denied.
If you are not rooted, this will not work either.
Ok, now that we are logged in, we will type
Code:
pm uninstall packagename
where packagename is the name of the 0kb listing.
Now this seems like a pain in the a** and I agree.
HOWEVER
There will be a time where Manage applications crashes when you try to uninstall it from the phone. In this case, a factory reset, or this method is the only effective way to fix the problem.
Moving on.
How many of us have removed system applications or renamed them? Did you know that you can simply disable them from the system?
Code:
adb shell
su
pm disable appllicationname
This will disable it, and the system will ignore it.
This can be seen as safer than deleting or renaming things, but your mileage may vary.
On the other hand, you can also re-enable these applications.
Code:
adb shell
su
pm enable applicationname
Please note: Not all applications will properly re-enable. I believe a factory reset or reinstall of said application will fix the issue.
Also, application names are absolutely case sensitive.
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Ok, a lot of us tweak and mod our phones and turning off the device to get to clockwork recovery, or battery pulls, or multiple button holds to get into Download mode are troublesome and annoying at best.
ADB can help us here.
Here, we do not need to be logged into the shell
If we want to merely reboot the phone:
Code:
adb reboot
If we want to go to recovery (works well with voodoo5)
Code:
adb reboot recovery
If we want to go to Download Mode because we need Odin, heaven forbid:
Code:
adb reboot download
Its instant. No waiting on animations or anything else.
Its also handy if Android has locked up, but yet still works in adb.
I for one hate taking my case off to battery pull.
So now we move on to pushing and pulling files.
Sometimes, I don't feel like mounting my sd card to copy a file over to my phone.
I can use this command to push a file straight to my sd card:
Code:
adb push filename /pathtodirectoryonphone
So for instance, if I have test.txt that I want to send, I would type:
Code:
adb push test.txt /sdcard/
and there it goes.
Ok moving on
Pushing files can be done to any directory, however, some are protected.
For instance, /system is going to give you a permission denied or a read only filesystem error.
To get around this, the easiest thing to do is push the file to your sdcard, then log into the shell:
Code:
adb shell
Code:
su
We will then mount the system as writable
Code:
mount -o rw,remount /dev/block/stl9 /system
Then we can use something like
Code:
cp /sdcard/test.txt /system/app/test.txt
cp stands for copy
and it requires the path of the file and destination path. The name of the file is optional
When you copy it, you can rename it to whatever you like.
For instance, if we wanted to backup a file
Code:
cp /sdcard/test.txt /sdcard/backuptest.txt
Now, lets assume you do not have busybox installed.
You non rooted users will not.
Then you must use a slightly more complicated command called dd
This is used like this:
Code:
dd if=/sdcard/test.txt of=/system/app/test.txt
if is for inputfile
of= output file
Not every user friendly, but probably one of the safer copy commands.
Ok, moving on to pulling files.
Lets say you want to get a file from your phone, to modify, backup, etc.
To do this, we simply use adb in this manner:
Code:
adb pull /pathtofile/filename destinationname
For instance, if I wanted to backup ADW launcher in system/app
I would do this
Code:
adb pull /system/app/ADWLaucnher.apk ADWLauncher.apk
And it will pull the file from the phone and put it in the current directory.
Like above, you can specifcy where it goes.
pushing files to the sdcard, it seems prudent to talk about changing permissions.
sdcards are typically fat32, which destroys permisisons, and Android is heavily permission based.
So if you push an application to your sd card, then try to copy it to /system/app/ bad things are going to happen, or the app may not even show up.
So in that case, we use something called chmod.
This is used in this manner
Code:
adb shell
su
chmod 755 /pathtoapplication/applicationname
Keep in mind
you dont want to do this while its still on your sd card.
an example
Code:
adb shell
su
chmod 755 /system/app/ADWLauncher.apk
755 is good for applications and script files.
Just a couple more topics to cover.
Lets go over deleting files.
This becomes especially handy for removing rogue applications.
To do this, we must be in the adb shell.
Code:
adb shell
su
rm /system/app/ADWLauncher.apk
You may need to remount system as writable with:
Code:
mount -o rw,remount /dev/block/stl9 /system
That applies when using chmod as well.
So what I did above was delete ADW Launcher from system/app
However, what if I wanted to delete the entire contents of a directory?
Same thing as before, except
Code:
adb shell
rm -f /data/dalvik-cache/*.*
I just cleared my dalvik-cache with that command
very quick, very effective.
If you just tried that, please reboot your phone now
Ok....this leaves us with the final topic: logcat
logcat allows us to log what the OS is doing, and possibly delve information for when things are not working
its quite simple Reading it is another.
To use logcat
Code:
adb shell
logcat
To logcat to a certain file do
Code:
adb shell
logcat > /sdcard/logcat.txt
Now we let the log settle down to a reasonable amount of data coming in and not a wall of scrolling, then start the app in question. When it gives an error, we hit ctrl-C and kill the adb shell session.
This should have captured enough data to see the error. Now, I prepared an example. A user came to me on IRC, and Google Maps was force closing. Clearing data didnt fix it, Clearing dalvik-cache, and fix permissions did not fix it. In this case, the user did not know how to use adb So I had him grab an app called alogcat from the market and email me the log. This is also a very valid method.
this file explains what the problem was, and highlights what to look for as an example.
http://adrynalyne.us/files/logcat.pdf
___________________________________________________________________
This concludes the guide from Adrynalyne, there will be more workshops such as this one in irc.freenode.net #android-learning.
Thanks to everyone in #samsung-fascinate !
QUICK FAQ's
sources: Q&A Section, The Weekly Q&A Section by XDA News Writers (thanks guys)
Q: ‘Is there any way to block specific apps from using my data connection?’
A: Try the Droid Wall application.
Q: ‘I read how you can make changes in the build.prop file on my Android device. How exactly do I get to it?’
A: Install ASTRO file manager, browse to /system, long press on build.prop – Edit – Copy. Press on the home icon then Edit icon – Paste. Connect sd card, edit it, and paste it over from where you copied build.prop
Q: What happens if I update my phone? will I need to re-root it and get the ROM again? will all of my applications get erased? If so, is there a way around this?
A: You will lose your root, but not apps if it is just an update.
Q: I just tried to flash a ROM from recovery on my Android phone and got “Verification Failed, Installation Aborted” What happened?
A: Before you can flash a custom ROM the .zip file must be digitally signed in the ROM kitchen, if unzipped and re-zipped it will lose its verification, this happens often using the Safari browser as it likes to decompress .zip’s. Or if your download is corrupted (download the ROM again) it will fail the Verification.
Q - HTC Location Widget shows "map data unavailable"
A - On the widget, click the pin/then click the windows button/click get more/scroll to download maps/download relevant map (care, maybe a big file). Now exit and click onto map, your location should now be visible :)
Q:So, I moved all the apps on the SD, but is still not enough. How can I free some memory? I could delete the cache of the older upgrade or something else?
A:Do you have pictures and videos? If so, check if they are on the SD card and not on your internal memory. Cleaning your cache helps, and try deleting your text messages threads.
Q: ‘What exactly is a kernel and what are the benefits in changing it?’
A: A kernel is a bridge between the applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources – the communication between hardware and software components. Flashing different kernels gives you different operating speeds, better battery life, the ability to overclock, and more.
Android control other device with IOIO Board.
It use ADB.
http://androidcontrol.blogspot.com/2011/10/ioio-board-for-android-control-io.html
timmymarsh said:
QUICK FAQ's
sources: Q&A Section, The Weekly Q&A Section by XDA News Writers (thanks guys)
Q: ‘Is there any way to block specific apps from using my data connection?’
A: Try the Droid Wall application.
Q: ‘I read how you can make changes in the build.prop file on my Android device. How exactly do I get to it?’
A: Install ASTRO file manager, browse to /system, long press on build.prop – Edit – Copy. Press on the home icon then Edit icon – Paste. Connect sd card, edit it, and paste it over from where you copied build.prop
Q: What happens if I update my phone? will I need to re-root it and get the ROM again? will all of my applications get erased? If so, is there a way around this?
A: You will lose your root, but not apps if it is just an update.
Q: I just tried to flash a ROM from recovery on my Android phone and got “Verification Failed, Installation Aborted” What happened?
A: Before you can flash a custom ROM the .zip file must be digitally signed in the ROM kitchen, if unzipped and re-zipped it will lose its verification, this happens often using the Safari browser as it likes to decompress .zip’s. Or if your download is corrupted (download the ROM again) it will fail the Verification.
Q - HTC Location Widget shows "map data unavailable"
A - On the widget, click the pin/then click the windows button/click get more/scroll to download maps/download relevant map (care, maybe a big file). Now exit and click onto map, your location should now be visible :)
Q:So, I moved all the apps on the SD, but is still not enough. How can I free some memory? I could delete the cache of the older upgrade or something else?
A:Do you have pictures and videos? If so, check if they are on the SD card and not on your internal memory. Cleaning your cache helps, and try deleting your text messages threads.
Q: ‘What exactly is a kernel and what are the benefits in changing it?’
A: A kernel is a bridge between the applications and the actual data processing done at the hardware level. The kernel’s responsibilities include managing the system’s resources – the communication between hardware and software components. Flashing different kernels gives you different operating speeds, better battery life, the ability to overclock, and more.
Click to expand...
Click to collapse
Thank you for your patience and taking the time to answer those questions. I loved your simple and easily digestible format.
There is a note
*nix based Operating Systems see the letter 'a' and 'A' as two different things.
when you log into adb shell, you are playing by android rules
Click to expand...
Click to collapse
this note is all wrong..
1. linNUX is not *NIX.
2. Mac OS-X is a *NIX OS, it is based upon UNIX, they use their own variant called Darwin. Darwin does not require capitolization.
3. The word should be POSIX. Linux is POSIX compliant and POSIX defines the capitolization standardards
soft brick
Taioba said:
Is there any way to use ADB even though I can not enable USB debugging by the android?
I have an Atrix with soft-brick. How can I restore a file (framework-res.apk) knowing that my USB debugging is off?
I can enable ADB via fastboot?
Thanks!
Click to expand...
Click to collapse
I found this for atrix 4g....
http://forum.xda-developers.com/showthread.php?t=965546
hope it helps
knoknot said:
i have a bricked s2 not so sure how to go about reviving it via adb
Click to expand...
Click to collapse
check this thread
http://forum.xda-developers.com/showthread.php?t=1237815
thanks. searched for that
Thanks for it.
Great Guys............ :good:
Thanks for sharing.
Thanks for sharing this guild :d, i am new member for reccod
Great job~ Sometimes could be used this.
I'm using Windows 10 RTM and I've set the path, yet I still get the "unrecognized application" error in the command console. What am I missing?
Nevermind, a restart fixed it. Used to be you didn't have to.... sheesh.
nir36 said:
Replacing system files using Android Commander:
(This post was formally based in the HD2's RTL support thread and revolved around our need to replace frameworks)
so:
1. Download the android SDK from: http://dl.google.com/android/android...08-windows.zip
2. EXTRACT(!!!) the android-sdk-windows to c:\
(make sure you extract the dir - not run the setup from inside the zip file)
3. install Android Commander from http://androidcommander.com
4. Connect your device and make sure it's set to Debugging mode in /settings/applications/development/
5. You might have to set a dir containing your adb.exe file. set it to c:\android-sdk-windows\tools\
6. You will see a Total Commander-like interface. you can then copy the framework.jar file to the correct directory (there's no difference between SD android builds and androids in ROM - the system dir will be shown the same way)
a. Yes, you can replace/delete system files while android is running.
b. (for androids running from SD) Any file copied to /sdcard/android/root/system/X will be copied to /system/X in the system file. The sdcard/android root dir is JUST LIKE your root in ROM androids.
c. Make sure you either created a backup or verified a match in any other way before replacing files like frameworks, zimage, modules, etc.. your android might not boot afterwards (I keep all system.ext2 files backed up so that i can restore them incase i screw something up.)
enjoy
Click to expand...
Click to collapse
Thanks, this Guide is very informative
Help with LG D722
I'm using LG D722 phone and I somehow unlocked bootloader and installed twrp recovery. I backed up Lollipop that's what I'm using and i want to restore custom ROM
I know I need to install Google Apps after installing Custom ROM. But Do I also need to install Modem files on my device ? Because I can't find them on XDA Forums. Please give me a link or something. The help is not just appreciated but seriously needed.
Success. Thanks
Hello, I walk testing one recovery but I'm booting before flashing, the question is, will the recovery feel same when booted vs flashed? I've booted and used to flash a pair of zips but felt very laggy and bugged although did the work right. Thanks
Edit: solved, tried myself
Sent from my SHIELD Tablet K1 using XDA-Developers mobile app
http://forum.xda-developers.com/showthread.php?t=872128&page=2

[GUIDE/DEV] Microsoft Android "Emulator"

I can't find much of any information on hacking the microsoft android emulator. Ideally, I'd like to get it working with superuser, exposed, etc, so it can be a fully functional way to see how android itself and apps work in different environments, all from my desktop. Also, I can just play around with stuff that I wouldn't touch on my tablet for fear of bricking it. I like playing with things.
Disclaimer: I'm not interested in maintaining anything, but as mentioned above, I can't find any information. Therefore, I'm simply posting what information I have here, in the hopes it will interest someone else enough to take a harder look at it. My original post was over here, but I've expanded beyond simply adding supersu to the image.
Things I can't do:
- Install superuser
- Install Xposed
- Install Google Play for anything more recent than KitKat
- Install recovery scripts
Things I can do:
- Run commands as root.
- Install Google Play Services on KitKat
- Change the screen resolution
- Change the amount of internal disk space
- Change the amount of memory and cpu cores available.
- Install busybox
- Flash simple scripts that don't require recent versions of cwm/twrp/other modern recovery.
----------------------------------------
Background information: The Microsoft Android "Emulator" is actually a HyperV virtual machine. When you install it, it enables the HyperV virtualization service in windows*. The effect of this is that instead of running android by emulating an arm processor, it runs android natively, with far better performance, by using Microsoft's hypervisor that's built into windows (win8+). You can work with it with Visual Studio and with Android Studio, but I don't use either much, so I can't help you with that. You can download it from Visual Studio if you want to (VS 2015 is free), or you can download a standalone version. I don't know if there's a difference between the two.
* I'm not sure if it installs the HyperV GUI as well, as I already use HyperV for other things and had it already installed. If you need to do so, you can install the GUI by going to add-remove windows features in the control panel ('appwiz.cpl' from the control panel).
----------------------------------------
Modifying the properties of the emulated system.
Configuration file location: After you create a device, the .cfg file for it will be located in %localappdata%\Microsoft\VisualStudioEmulator\Android\Containers\Local\Devices
To change the resolution: So far, I haven't identified any supported resolutions other than those listed in the device profiles list. So far, supported resolutions that I've used successfully are 480x800, 720x1080. You can edit the .cfg file for the specific device that you want to change the resolution of, and change the `device.screen.resolution=` line to any supported (see previous) resolution.
To change the size of the internal storage, follow the instructions here. You'll need an ubuntu cd; minimal install cd is fine if you have slow internet/computer or low ram.
To change the amount of ram or processors allocated to the virtual machine: Open Hyper-V manager, right-click the appropriate VM and click settings.
- Change the ram allocation by clicking Memory in the list at left. I do not know what happens if you try using Dynamic Memory; if it works, it should be more memory-efficient, but I left that alone. Now update the `device.vm.ram.size=` line in the .cfg file.
- Change the cpu allocation by clicking the Processor field. Please note that if you have hyper-threading, you should only use half your logical processors as cpus; the hyperthreaded 'cores' won't work as well (according to information online; you can check number of logical processors in windows task manager's performance tab). Now update the 'device.vm.cpu.count=' line in the .cfg file
----------------------------------------
Info on "recovery" and "flashing" - Installing google play
So far, I have only managed to get Google Play Services working on KitKat. I can't get it to work on Lollipop or Marshmallow (and haven't tried earlier versions at all); the virtual machine does *not* have a recovery or fastboot because of the way it works, and I haven't figured out any way of installing such. Instead, there's a simple shell file called install_zip.sh. It does not work with modern flashable zips that require TWRP/CWM; it only works with the old style zip designed for a specific architecture. As such, opengapps flashable zips will not work.
To install Google Play Services on KitKat (4.4.4)
1. Inside the emulator, open the browser and go to http://www.teamandroid.com/gapps/ and download the file linked under Gapps CyanogenMod 11.
2. Open the window the the android VM from the Hyper-V Manager to get console access. If you have ADB installed locally, you can use that in the future, but getting the VM's shared IP requires terminal access anyways (run `ip addr` as root inside the emulator to get the list of IPs).
3. Run `adb shell` to get access to the root shell (yes, it's that easy).
4. Run `install_zip.sh /sdcard/Downloads/gapps-kk-20140105-signed.zip` (or whatever the name/path for the downloaded gapps file is).
5. It should complete successfully. Now type exit to exit the adb shell, and close the hyper-v console window (the android emulator will continue running).
6. Click the 'X' at the top right of the Emulator to shut down/close the VM
7. Start the emulator back up. You should now have access to Google Play Services.
----------------------------------------
Busybox
The emulator does not come with a preinstalled copy of busybox. It does come with the android toolbox, but this has only a very minimal amount of commands in it. The instructions below are for installing stericson's busybox.
1. Get a copy of stericson's busybox from somewhere--your personal device, etc, it doesn't matter. The easiest way is to either install it on a real android device and grab it with airdroid (or other), or to use a play store scanner to get it. The file name will probably be something like stericson.busybox.apk.
2. Rename it to .zip so you can access the contents.
3. Extract the busybox-x86.png file from the 'assets' folder inside the zip, and rename it to `busybox`.
4. In the Android Emulator, click the >> button for tools, and click the sdcard header. Choose a folder (a new one on your dekstop will do) and tell it to pull the contents of the sdcard to the folder.
5. Move the busybox file into the Download folder that you just pulled from the sdcard. If you created a folder for this, you can delete it now.
6. Back in the android emulator, push the folder structure back into the sdcard; this will move the busybox onto the emulator.
7. Open the HyperV console for the emulator or open a terminal app in the android emulator (installing it is up to you)
8. Run `adb shell` to get a root prompt.
9. Run `mount -o rw,remount /system` to remount the system partition as writable
10. Run `cp /sdcard/Download/busybox /system/xbin` to copy the busybox binary over
11. Run `chmod 777 /system/xbin/busybox` to make the busybox binary executable.
12. Run `busybox --install /system/xbin` to copy the busybox binary for all the included applets. I think the -s paramter will symlink the applets to the main binary instead, but I'm not sure.
13. Type exit in the adb shell.
14. You can now run busybox commands in the terminal, and use apps that require busybox to be installed.
Now that you have busybox installed, you can use unzip, etc.
----------------------------------------
Hacking the OS itself.
The android emulator uses a VHD file for the disks. I've mounted the vhd file inside an ubuntu server to play with, and discovered several things about the way it works. The first partition is the boot partition, it contains 3 files:
- kernel - the android/linux kernel
- ramdisk - the ramdisk for the root filesystem. gzipped cpio archive.
- cmdline - the kernel parameters(? not sure what to call this)
I've tried modifying the ramdisk to add the init files for the superuser, but this doesn't seem to work properly; when I boot up the vhd file, I can open the console with hyper-v manager (the android emulator machines show up there automatically), and when it gets to the ramdisk, it says so--then the caps/num/scroll lights start flashing and it hangs. I haven't gotten any further than that at this time.

A Beginner’s Guide to Modifying Android Devices

Warning: Even an expert runs the risk of “bricking,” or locking up their Android device when modifying it. Often this is a ‘soft brick’ from which they can recover, but sometimes the device is “hard bricked” from which no recovery is possible, and the device becomes a source of spare parts. Proceed at your own risk. Neither the author, nor XDA is liable if you do “brick” your device.
Note: I have insufficient posts to include outside links. I'll add them when I do. Until then you'll need to search the 'net.
Keeping that in mind, you may wish to acquire an older model device to practice with before attempting to modify leading edge devices. Kijiji and Craig’s List are good sources for low cost, used devices that can be used for practice. I acquired the Samsung Galaxy S5 neo (SM-G903W) with Android 7.0.0 (Nougat) installed, I’m using in this guide for about $20 USD. Although any device will do, try to get one from the same manufacturer as the device you want to modify. If your device is a phone, you do not need a SIM card to follow this guide.
The Android OS is a derivative of Linux, and many, but not all commands are the same. You should refer to Linux or Unix manuals for an explanation of the commands. Search the ‘net for “Linux Commands” to find the latest manuals.
As the boot animation and sound are the most common modifications, changes to those are the goals of this guide. It seems as though there is an app for everything now. Yes, they are handy, but this guide will use the command line for many of the modifications. I use Terminal Emulator on the device for command line access. I also use BusyBox to expand the command set available. Both are available from the Play Store. You need root access to install and use BusyBox.
The first step is to read the manual for your device. Pay particular attention to the method used to enter the download and recovery modes. The Samsung Galaxy S5 neo uses volume up + home + power to enter the recovery mode, and volume down + home + power To enter the download mode from the power off condition. Press the volume and home buttons first, and then press the power button while holding them down. The device will boot into the desired mode. You may also require special USB drivers on your PC for your device.
Next you need to take as complete a backup of your device as possible using the stock options. See your manual for help with this. It’s also a very good idea to download the full firmware, as well as the boot and recovery partitions and any tools needed to re-flash this software. The best way to find these is to consult the manufacturer’s website, then this forum, followed by a ‘net search if nothing else provides results. For my device I need Odin on my PC. I found the full firmware at sammobile.com and firmware.mobi. The boot and recovery images can be extracted from the Samsung file, and then re-compressed using 7-zip on your PC. The firmware.mobi website offers all three files for several versions of Android, as well as a configured Odin package to root my device.
Now that we’re ready, the next few posts in this thread will cover the following sequence:
1. Root Device
2. Install Recovery
3. Install Applications
4. NANDroid backup
5. Make your modifications​
Root Device with Chainfire
Warning: If you have a KNOX enabled device, rooting it will trip the KNOX warranty flag, voiding your warranty. This flag cannot be reset, and will prevent some applications from working.
Warning: Rooting improperly can “Hard Brick” your device, turning it into a source of spare parts.
There are numerous rooting tools out there. I use Chainfire whenever possible. The current website firmware.mobi will generate an easy to use package including Odin for supported devices. Download and extract the package to a new folder on your PC. Start Odin using the root.bat file. Read the warnings. Next:
Ensure Developer Options are enabled on your device. On the SM-G903W, go to Settings/About Phone/Software information/Build number seven times. Other devices may use a different method. Consult your manual.
In Settings / Developer Options ensure OEM Unlock is on and turn on USB Debugging
Note: I also turn “Auto update system” off
Turn the device off, then re-boot into the download mode (Volume Down + Home + Power, and then press Volume Up on my device)
Plug the device into a USB port of your PC
Select AP in Odin, then select the image.tar.md5 file downloaded with your package.
Ensure one of the COM ports is highlighted.
This is your last chance to abort. DO NOT CONTINE if you have any doubts.
Click Start
When your device is rooted successfully you’ll see a green pass in Odin. Congratulations! Your device will re-boot into recovery mode to root the device, and then re-boot normally. Well, that’s how it was supposed to work. When I used the CF Autoroot file for the SM-G903W, I got the error message “Recovery is NOT seandroid enforcing”, and was unable to boot into the recovery mode. I used Odin to re-flash the recovery partition which allowed me to enter the recovery mode again. A little searching on this forum, led me to this post by Neoony. I used the link for the SM-G903F and succeeded in rooting the device.
Now you need a root manager. My preference is Super SU. Install it from Google Play. Run Super SU. It will let you know if you were not successful by reporting that your device is not rooted.
Install Backup/Recovery (TWRP)
As we intend to modify the Android system itself, we need the ability to back it up and restore it. There are several options including Clockwork Mod (CWM), Team Win Recovery Project (TWRP) and Titanium Backup. My personal preference is TWRP.
Installation is as follows:
Install the “Official TWRP App” from Google Play
Run the App, agree to the Terms and Conditions, and enable “Run with root permissions,” then tap OK.
Tap “TWRP FLASH” on the next screen
Select your device from the drop down menu, you will need a network connection for this. You’ll be presented with a series of choices. Choose the latest and greatest. The image will be downloaded to your device.
Select “FLASH TO RECOVERY”, and confirm the image is correct. You will see the message “Flash Completed Successfully!” when installation is complete.
Exit the “Official TWRP App” and re-boot your device into the Download, followed by Recovery, and finally normally to confirm all is well.
Install Applications
The applications to install are those you will use to customize your device. I suggest BusyBox, and Terminal Emulator from the Play Store. BusyBox requires root access for the expanded command set. Terminal Emulator will allow command line access on your device so you won’t need ADB on your computer. You will be able to gain root access through it to modify anything on your device anytime, anywhere.
Other Apps you may find useful are the Jota Text Editor, and Hex Editor. These are also available through the Play Store.
NANDroid backup
Once the device is rooted, and your choice of applications are installed it’s a good idea to fully back up the device. This includes ALL partitions, so you have a baseline that you can re-flash. If your device has minimal memory, you may need an SD card or USB OTG drive to hold your backup. These backups will often be larger than 4GB.
Re-boot your device into the Recovery Mode. In TWRP, select ALL the partitions. Select the desired Storage location, and tap OK. Swipe to backup your device. Note the warning that “Backups of data do not include any files in internal storage such as pictures or downloads.” That is not the purpose of TWRP, and is best accomplished with the native backup utility. This backup will require several minutes.
Make your modifications
With root access, a recovery program and needed applications installed; and a complete backup we are finally ready to modify the Android installation of your device. We’ll start with the boot animation.
Modifying the boot animation:
Most devices use a ZIP file for boot animations. Samsung uses a proprietary QMG file. I tried to convert a boot animation that I put together a few years ago into the QMG format using Samsung’s Theme Designer Version 2.0.4 (Build 3918), as the links I found to newer versions on the XDA forum were broken. Searching through this forum, I found this post by Jertlok. I used the Marshmallow version with Nougat successfully.
Enough of this talking, let the games begin! Find the boot animation you want to use and download it to your device.
I’m using the Terminal Emulator for this installation. Our first step is to find the source and destination folders for this file. The relevant folders for the SM-G903W are:
boot animation: /system/media
downloads: /data/media/0/Download
If you have another device and the boot animation is located elsewhere, do a search of this forum first to find them. Look for your device first, and the other models by the same manufacturer.
Type the following commands using the Terminal Emulator:
Code:
su get super user privileges
mount -o rw,remount /system remount /system with read & write permissions
cd /system/media go to directory with boot media files, may differ
ls verify this is the correct folder
mv /data/media/0/Download/bootanimation.zip . move the file to our current location
ls verify the file was moved
exit leave super user mode
Reboot your device and verify the boot animation works.
Note: Don’t forget the period at the end of the mv command. This is a shortcut meaning the current directory, saving you from typing the full location.
Modifying the boot sound:
Finding the location for the boot sound can be more involved that finding that for the boot animation. If you know the name of the file, you can do a search through Terminal Emulator with the following commands:
Code:
su get super user privileges
cd /system/media choose a starting point for your search
find –name PowerOn.ogg name of the boot sound on the SM-G903W
This shows the file to be located in /system/media/audio/ui. Put the sound you want in the Download folder. I’ve named mine bootsound.ogg to show another use of the mv command. Use the following commands in Terminal Emulator:
Code:
su get super user privileges
mount -o rw,remount /system remount system with read /write permissions
cd /system/media/audio/ui go to the folder containing PowerOn.ogg
ls confirm we’re in the right folder
mv PowerOn.ogg PowerOn.ogg.bak rename PowerOn.ogg
mv /data/media/0/Download/bootsound.ogg . move bootsound.ogg
mv bootsound.ogg PowerOn.ogg rename bootsound.ogg
ls confirm the change has been made
exit leave super user mode
Reboot your device and verify the boot sound works. The shutdown sound is not used in the stock ROM. You can add a shutdown sound in the same manner by placing PowerOff.ogg in /system/media/audio/ui. Note: If PowerOn.ogg or PowerOff.ogg do not play, check your file permissions. Set them to the same values as the remainder of the files in the directory, usually 644.
Wrap up
Everyone needs to start somewhere. My goal in starting this thread was to provide that starting point, and a path forward for those new to modifying an Android device. That is why I started with a stock not-too-old device, and showed how to take it to manually changing the boot animation and sound. Why manually, when there are apps for that? An App can only accomplish a single task, such as changing the boot animation. At the command line you can do almost anything. You won’t be stopped by the lack of an App.
Much of the material covered by this guide is specific for a device. Those with Samsung devices came out far ahead, and those with a Galaxy S5 neo may just have hit the jackpot. The general sequence for all devices is the same. You’ll just need to dig for those devilish details.
There are two things that should stick out:
1. Use a not too old device by the same manufacturer as your target when starting. It’s far cheaper than bricking a bleeding edge device.
2. Backup, backup, backup! This can’t be stressed enough. Losing hours or days of work is very depressing, and often leads to dropping a project.
Good luck modding your device. This forum is one of the best, if not THE best place for resolving those devilish details that you will encounter.
The Next Step: Changing the Boot Logo
First, thanks to Near_07 for his post Galaxy S9 and S9+ Boot logo. I modified his package to make one for the Samsung Galaxy S5 neo. Note that his script is for the same exynos platform. This is critical for packages containing binaries.
I unpacked the pile to a new directory on my PC.
The first thing I did was to verify paths and filenames in the script "update-binary". I opened the file using WordPad on my PC for ease of reading. The file contains references to "/dev/block/platform/11120000.ufs/by-name/UP_PARAM", which does not exist on the S5 neo. I used Terminal Emulator to check for something close and found "/dev/block/platform/13540000.dwmmc0/by-name/PARAM ". I copied the file to the Download directory, and from there to my PC. Opening the archive, I found that it contained the file "logo.jpg". Bingo! I was in the right place. I copied the "update-binary" back to the Download directory on the S5 neo, and used Jota Text Editor to change ALL the references from 11120000.ufs to 13540000.dwmmc0; and UP_PARAM to PARAM. I then copied the modified "update-binary" back to replace the original on my PC. Why did I use Jota Text Editor on the S5 neo, instead of notepad on my PC? Unix, Linux, and Android use different end of line sequences than the PC. There are programs for the PC capable of generating Android compatible files, but I'm sticking with software already mentioned in this tutorial.
Choosing or Creating a New Boot Logo:
Choose or create a new .jpg image, the same size as your screen for your new boot logo. I've attached the original logo.jpg from my S5 neo to this post. I used that as a starting point, moving and adding elements to mate with my boot animation. I've included a demo copy in the zipped package. I've also attached a copy of the first image in my boot animation sequence. The powered by Android Nougat element fades in as the animation runs.
How to Change the Boot Logo:
You are rooted and have TWRP installed if you've been following along. These are pre-requisites. STOP NOW if they are not installed.
Download the file S5neo_Boot_Logo_Changer
Unzip the file to an empty directory
Replace logo.jpg with your desired logo. Note the name MUST be exactly the same.
Use 7-Zip to compress the contents of your working folder, with 'Store' as the compression method
Copy the resulting archive to the Download folder on your S5 neo
Re-boot your S5 neo into the Recovery mode
Install the package, re-boot, and enjoy!
Removing Bloatware (or fun with scripts)
Bloatware consists of the unwanted apps generously added to your phone by Google, the manufacturer, and your carrier. There can literally be a hundred or more of these apps on your phone. So how do you get rid of them? You can use a package found on this site, but that can be problematical. You may have a different view of bloatware than the package’s author. You may not know what each APK deleted by the package does, and delete one you actually want on your phone. If this happens you’ll need to restore from backup, factory reset the phone, or even re-flash the firmware. My preference is to archive the APK on my desktop so that hopefully I can restore the APks with the package manager.
To start, grab one of the packages to delete bloatware for your version of Android, for as close to your phone as possible. I used this one by Windforce. The contents of updater-script may include a section that looks like this:
Code:
run_program("/sbin/rm", "-rf", "system/app/AASAservice");
run_program("/sbin/rm", "-rf", "system/app/BluetoothMidiService");
run_program("/sbin/rm", "-rf", "system/app/CloudGateway2017");
run_program("/sbin/rm", "-rf", "system/app/GooglePrintRecommendationService");
There are many tools such as word processors, and text editors that you can use to strip out the unwanted bits so that you end up with something like this:
Code:
AASAservice
BluetoothMidiService
CloudGateway2017
GooglePrintRecommendationService
Save it as a file, ensuring that you have an Android (Unix) end of line character. We end up with a list of folders containing the unwanted APKs. Next we need a script to archive the APKs.
The following script has been designed to run in the ‘Download’ folder, from the Terminal Emulator, or ADB (Android Debugging Bridge). It was written on my desktop using Notepad++, to ensure the proper end-of-line character was used. The script, and APK lists must be copied to the Download folder from the desktop. To access the Download folder from the Terminal Emulator or ADB, Super User or root permissions are required. File permissions allowing root to execute the script must be set. Finally the script must be run from within a shell.
Code:
mount -o rw,remount /system # mount /system for read/write
tempdir=/system/app/app # temporary folder for APKs to be archived
mkdir $tempdir
while read apkname # loop parses file for APK names to archive
do
mv /system/app/$apkname $tempdir/$apkname
done < sysapp.txt # supplied list of APKs to be archived
tar -czvf sysapp.tar.gz $tempdir # archive APKs
rm -rf $tempdir # remove temporary folder recursively
rm -rf /cache/* # clear cache contents
rm -rf /data/dalvik-cache/* # clear dalvik-cache contents
reboot
exit 0
After the script has executed, you’ll note the icons for the archived APKs remain on the apps screen, and are still listed under Apps. The must be manually removed. You’ll find that ‘Uninstall’ is now available in both places for the archived apps.
Attached is a .zip file containing the script, and data files I used on a Samsung Galaxy S5 neo (SM-G903W).

Categories

Resources