{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This will be a Full Tutorial on MonkeyRunner Android Automation Tool
I will be updating this thread as I get time. SO NO ETA's.
Click to expand...
Click to collapse
If anybody wants to use / copy this tutorial to their Website or Blog please feel free to contact me at my personal email id: [email protected]
or at our official Website: www.rhbroms.com
Click to expand...
Click to collapse
Please Click on Thanks button if this tutorial by me had helped you for some extent !!!
Click to expand...
Click to collapse
Table of Contents:
1. Monkeyrunner
2. What all we need before we get it started?
3. How to setup monkeyrunner in Eclipse?
4. How to write and execute monkeyrunner Script?
5. Limitations of monkeyrunner
monkeyrunner
1.monkeyrunner
monkeyrunner is a automation tool which provides us to conduct BlackBox testing on android applications.
The monkeyrunner tool provides a Python API for writing programs that control an Android device or emulator from outside of Android code.
With monkeyrunner, you can write a Python program that installs an Android application or test package, runs it, sends keystrokes to it, takes screenshots of its user interface, and stores screenshots on the workstation.
The monkeyrunner tool is primarily designed to test applications and devices at the functional/framework level and for running unit test suites, but you are free to use it for other purposes.
2.What all we need before we get it started?
We need the below:
1. Windows 7/8 OS
2. Java 6
3. Eclipse
4. Android device running min android version 2.3.4*
5. Python
6. Jython
7. Application to be tested
*Are not mandatory.
DOWNLOADS:
SimpleCalc app sourcecode: SimpleCalc
3.How to setup monkeyrunner in Eclipse?
1. First download Python from this site: http://www.python.org/getit/
2. Second download Jython.jar file from this site: http://www.jython.org/downloads.html
3. Download the Jython Installer from this site: https://wiki.python.org/jython/DownloadInstructions
3. After downloading the above files install Python.
4. Basic Install for Jython:
After downloading Jython installer, either double click the jython_installer-2.5.2.jar or run java with the -jar option
java -jar jython_installer-2.5.2.jar
Click to expand...
Click to collapse
5. Now after completion of this we will move to Eclipse and download PyDev from Eclipse market place as shown below:
6. When finished install, Go to Window->Preferences->PyDev->Interpreters
- Jython interpreters : Click [new...] and got o the path where you have installed Jython. For me it is at C:/jython/jython.jar
- Libraries : Click [New Jar/Zip(s)] and enter your ANDROID_SDK_PATH/tools/lib/monkeyrunner.jar
as shown below:
7. After this Go to Window->Preferences->PyDev->Interpreters->
- Python interpreters : Click [new...] and got o the path where you have installed Python. For me it is at C:/Python33/python.jar
as shown below:
4. How to write and execute monkeyrunner Script?
1. Go to File-> New -> PyDev Project -> Give any project Name and select Jython as shown below:
2. Now right click on the newly created project -> New -> PyDev Module
3. Give any Name to the project but leave the package field empty as shown below:
4. After this Just copy paste the below code:
'''
Created on Dec 11, 2013
@author: RHB
'''
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Installs the Android package. Notice that this method returns a boolean, so you can test
# to see if the installation worked.
device.installPackage('C:/Users/rhb/workspace/SimpleCalc/bin/SimpleCalc.apk')
# sets a variable with the package's internal name
package = 'com.rhb.simplecalc'
# sets a variable with the name of an Activity in the package
activity = 'com.rhb.simplecalc.MainActivity'
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
# Presses the Menu button
device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP)
# Enters the value 12 into the first edit text box
device.type('12')
# clicks on the second edit test box of SimpleCalc application that i have provided at the beginning of the post.
device.touch(87,448,'DOWN_AND_UP')
# Enters the value 3 into the second edit text box
device.type('3')
#Clicks on the multiplication button
device.touch(386,650,'DOWN_AND_UP')
# Takes a screenshot
result = device.takeSnapshot()
# Writes the screenshot to a file
result.writeToFile('C:/Users/rhb/workspace/SimpleCalc/shot1.png','png')
Click to expand...
Click to collapse
5. Before executing the above code make sure that you have installed the SimpleCalc app to your device. To do this you can use the below adb command:
adb install SimpleCalc.apk
Click to expand...
Click to collapse
7. To execute this we need to do some customization as explained below:
7a. Go to Run-> External Tools -> External Tools Configurations... . as shown below:
7b. Now select Location as monkeyrunner.bat. Select your working Directory and also write arguments as shown below:
8. Click on Run button and you are good to go
got error while execution
Hi,
I am new to android testing,
i have followed all above steps and it was perfect. but while executing same code i got an error.
Please guide me how to solve.
error occured while executing
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)
Thanks
foodland said:
Hi,
I am new to android testing,
i have followed all above steps and it was perfect. but while executing same code i got an error.
Please guide me how to solve.
error occured while executing
Can't open specified script file
Usage: monkeyrunner [options] SCRIPT_FILE
-s MonkeyServer IP Address.
-p MonkeyServer TCP Port.
-v MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)
Thanks
Click to expand...
Click to collapse
Enclose your argument statement with double quotes ( " " )
MonkeyRunner, MonkeyDevice in ecllipse error
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
MonkeyRunner, MonkeyDevice
Error occurred in eclipse, due to the above two commands. Please help me solving the issue
How to Drag in Monkey Runner
Not Able to drag using monkey Runner Please see what i have done wrong
device.drag((420,1090), (420,1490),6.0, 520)
Local path doesnt exist error
Hello,
When i am running the above script as you showed, I get this error "Local path doesnt exist". do i need to place apk file in the pyhton project?
how to draw circle or square using monkey runner script ?
Related
Yep:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
It's official you can run X-Windows and your choice of GUI (Gnome, KDE, IceWM etc on an Android device!
Screenshots are below!!
Here are instructions about running X-Windows and more specifically the LXDE Desktop GUI on the G-1.
LXDE is an energy saving and extremely fast and performing desktop solution. It works well with computers on the low end of the performance spectrum such as new generation netbooks and other small mobile computers
While IceWM, performance-wise runs the fastest - LXDE is also pretty good, and just plain 'prettier!
I have included options for either Desktop in the instructions below.
Prerequistes; Debian Shell instructions here: http://www.androidfanatic.com/cms/community-forums.html?func=view&catid=9&id=251
Also if your 'debian.img' file is a little small you may want to resize it - instructions here:
http://www.androidfanatic.com/cms/community-forums.html?func=view&catid=9&id=1610
You need three basic packages:
From the Android OS:
Download VNCviewer for Android from our repo here:
http://www.androidfanatic.com/cms/unofficial-app-repo.html?func=fileinfo&id=16
or from google here:
http://code.google.com/p/android-vnc-viewer/
Now copy the .apk file to your sdcard and then run 'Apps installer' from the Market to install that.
From the terminal, boot your debian shell and then type:
apt-get install tightvncserver (return)
apt-get install lxde (return)
or if you want a really basic desktop use IceWM:
apt-get install icewm (return)
Now you need to setup your vncserver
at the prompt type:
export USER=root (return)
vncserver (return)
This will create an x-windows session and a startup file
in the /root/.vnc/ directory. Vncserver will also ask you to set up two passwrds. You will need the first password to log in, but just say no to the second password.
The next thing to do is to kill the session you just started: vncserver -kill :1
This is so you can edit the startup file to set it up correctly.
go to /root/.vnc
type
nano xstartup
comment out the line for xsession:
#/etc/X11/xsession
add these two lines:
icewm &
lxsession
or if you decided to go for IceWM instead:
icewm &
xterm
save the file (trackball then 'o', and exit nano (trackball then 'x'.
Then restart an x windows session by vncserver ( you should kill it after you are done with x-windows later on).
This next bit does some housekeeping and sets up the VNC service each time you boot your debian shell - saves messing about everytime!
Now back inside your debian prompt you need to edit your /root/.bashrc file
cd /root
nano .bashrc
Add the following near the top of the file:
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 480x320
(this sets your resolution - you can change this if you will be connecting via your computer).
save the file (trackball then 'o', and exit nano (trackball then 'x'.
Type 'exit' to exit the Debian shell.
reboot the phone.
Once rebooted go into Terminal and boot yor Debian shell.
Press the HOME button to revert back to the Android OS while leaving your Debian shell running.
Open androidVNC from your android programs menu.
Connect to 'localhost' port '5901' and enter your password.
Viola, you now have XWindows running on your phone. Obviously you can connect to your phone's new desktop GUI with a VNC viewer from your computer too jsut enter it's ip address instead of localhost.
To make the cursor work with your finger:
Press the MENU button on your device and select 1:1 then just press the trackball ONCE!
Now whenever you want a proper x-windows Desktop GUI right there on your phone, just run the debian shell with 'bootdeb' and it sets up your vncserver. Then just press home to leave it running and get back to your android menu, where you can choose to VNC directly onto it.
Cool eh?
When you are finished just exit androidVNC, if you want to get back to your Debian shell, HOLD DOWN the home key to bring up your running processes and switch to it.
What the heck, you could even install GNOME or KDE but it may be a little slow! I can't be arsed to try it, but if you can, be sure to let us know how it goes.
Your videos and photos of your device running X are welcomed. As usual if you like this, use the SHARE button below.
Click to expand...
Click to collapse
Excellent news!
thanks for sharing this here
so what does this mean exactly?
just a windows-like gui?
what about my android gui? what happens there?
d3rrty1 said:
so what does this mean exactly?
just a windows-like gui?
what about my android gui? what happens there?
Click to expand...
Click to collapse
X11 runs as a daemon (or service) in the background on most *nix machines (android, now included) and windows machines using cygwin, etc.
You can connect to it locally or over the network.
As of yet, there has been no native GUI implementation of the X client on android, but we can now run a VNC server and connect to that (locally on the android phone or over the netowork with a computer, etc) using a VNC client.
So, as-is, this runs independently from your android gui and does not affect it at all.
alapapa said:
X11 runs as a daemon (or service) in the background on most *nix machines (android, now included) and windows machines using cygwin, etc.
You can connect to it locally or over the network.
As of yet, there has been no native GUI implementation of the X client on android, but we can now run a VNC server and connect to that (locally on the android phone or over the netowork with a computer, etc) using a VNC client.
So, as-is, this runs independently from your android gui and does not affect it at all.
Click to expand...
Click to collapse
so it's essentially setting up a "fake" vnc while connecting to it at the same time since it is the local network (i.e. your phone)? do i still have full access to all of my apps?
We've had this in another thread for a month or so now.
d00m said:
We've had this in another thread for a month or so now.
Click to expand...
Click to collapse
Interesting, because this is relatively new public news. Cheers to the spread of knowledge.
gmaster1440 said:
Interesting, because this is relatively new public news. Cheers to the spread of knowledge.
Click to expand...
Click to collapse
that's what i was thinking... i do think d00m meant more along the lines of VNC though... i wasn't asking about VNC, so it is partially my fault for not being clearer... i meant what exactly x11 did/does
gmaster1440 said:
Interesting, because this is relatively new public news. Cheers to the spread of knowledge.
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?t=472204
X11 is Linux's GUI server
I tried to follow along but the instructions to move the busybox.bin to /data/busybox does not work. I read up on the original thread and its instructions to install busybox but it does not work.
I keep getting "/data/busybox is a directory" error msg. Any ideas?
wergeld
Im getting a grey screen in VNC. Anyone know what might be a cause?
Im guessing it has to do with editing those last 2 files. I installed LXDE.
wergeld said:
I tried to follow along but the instructions to move the busybox.bin to /data/busybox does not work. I read up on the original thread and its instructions to install busybox but it does not work.
I keep getting "/data/busybox is a directory" error msg. Any ideas?
wergeld
Click to expand...
Click to collapse
if you have any of jf's modified rcXX images, (which you more than likely do..) you already have busy box nd don't need the other one
Okay. Yes I have JF 1.43 running now.
I went ahead with the rest of the install of the debian image.
I then get to the point where it says to type in "bootdeb" and I do that.
Now I get the ASCII penguin YAY!
But then it gets past the
INIT: Debian booting...
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: cannot execute /bin/bash: No such file or directory
....extra umount errors for FUN!
Reverted back to Android console
#
Okay, so now what?
wergeld
Okay. Yes I have JF 1.43 running now.
I went ahead with the rest of the install of the debian image.
I then get to the point where it says to type in "bootdeb" and I do that.
Now I get the ASCII penguin YAY!
But then it gets past the
INIT: Debian booting...
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: cannot execute /bin/bash: No such file or directory
....extra umount errors for FUN!
Reverted back to Android console
#
Okay, so now what?
wergeld
K, I have 1.43 running.
I now get an error after I type in "bootdeb":
chroot: cannot execute /bin/bash: No such file or directory.
This error occurs after the penguin ASCII art and the starting of the AutoMounter.
Any ideas?
wergeld
wergeld said:
Okay. Yes I have JF 1.43 running now.
I went ahead with the rest of the install of the debian image.
I then get to the point where it says to type in "bootdeb" and I do that.
Now I get the ASCII penguin YAY!
But then it gets past the
INIT: Debian booting...
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: cannot execute /bin/bash: No such file or directory
....extra umount errors for FUN!
Reverted back to Android console
#
Okay, so now what?
wergeld
Click to expand...
Click to collapse
Try
modprobe ext2
then type
bootdeb
That worked for me
now just wondering.. how to remove all of this if i decide to?? remove debian and everything that was installed?
apt-get install error
Whenever I apt-get install any app i get the same "Reading package lists... Error!" "E: Unable to parse packagge file /var/lib....." "E: The package lists or status file could not be parsed or opened."
Any ideas on how to fix?
apt-get update
Smokuevo said:
apt-get update
Click to expand...
Click to collapse
Still getting the same "unable to parse file /var/lib/apt/lists/ftp.de.debian.org_debian_dist_lenny_main_binary-armel_Packages" error
Here's a little script to push a file to the root of your sdcard, by right-clicking on the file and selecting "Send to Android"
I wrote it because I copy zip files to my sdcard a lot, and don't like mounting usb storage.
Updated: If the file is an apk file, you have the option to install it or just copy it to your sdcard.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
It uses adb.exe from the Android SDK. It's quite basic, but I guess could be adapted or made more complex quite easily.
Instructions
------------
1. Adding the right-click context menu
Place the pushfile.vbs file somewhere safe on your system.
Edit the .reg file so that the path to the vbs file is correct.
Double click on the .reg file, and accept the changes to the registry.
2. Edit pushfile.vbs
Open up the vbs file using Notepad.
If you already have adb.exe on your system (it's part of the Android SDK), edit line 6 of the file so that it points to your existing adb.exe
If your path has spaces, use double quotes around the whole file path, e.g --> ""C:\Program Files\Android SDK\tools\adb.exe""
Save the file and exit.
If you don't have the Android SDK, copy the adb.exe in the zip file into C:\windows\system32
Edit line 6 of pushfile.vbs so that it looks like this:
Code:
adb = "C:\windows\system32\adb.exe"
Save the file and exit.
Click to expand...
Click to collapse
The download is at the bottom of this post.
Linux users
Create this script in ~/.gnome2/nautilus-scripts/
Call it something sensible like "Send\ to\ Android". Just edit the path to your adb.
Code:
#!/bin/sh
export adb=~/AndroidSDK/tools/adb
export tmp=/tmp/.out
for arg
do
if [ `echo $arg | awk -F "." {'print $2'}` = "apk" ]; then
zenity --question --text="Do you want to install $arg?" --no-wrap --ok-label="Install" --cancel-label="Push to sdcard" --title="Question"
if [ "$(echo $?)" == "0" ]; then
$adb install -r "$arg" 1>> $tmp 2>> $tmp
export result=$(tail -n1 $tmp)
zenity --info --text="$result"
else
$adb push "$arg" /sdcard/ 1>> $tmp 2>> $tmp
export result=$(tail -n1 $tmp)
zenity --info --text="$result"
fi
else
$adb push "$arg" /sdcard/ 1>> $tmp 2>> $tmp
export result=$(tail -n1 $tmp)
zenity --info --text="$result"
fi
done
[ -f $tmp ] && rm -f $tmp
Now you can push files to /sdcard or install apk's by using right-click - scripts - Send to Android
Doesnt work with me, when i click for a file to be sent it says " this file does not have a program associated with it for performing this action". What have i done wrong!?
Sounds like your file association with vbs files is messed up ...
What happens when you just double click on the pushfile.vbs file? If the file association is working you should get an error about incorrect usage.
I too get the same problem, but launching the vbs script tells me about incorrect usage, and to drag a file into the script
EDIT: works now, I forgot to double one of the many slashes in the path to the vbs file
Thanks
U have to edit the reg file, too! There must be contained the pusfile.vbs location
Works very well!Many many thanks for this!
Is pushing faster then the transfer with mounting?
How it is with Folders? Did it replace or dit it include? I mean i have a folder that is called Music. So if i upload a new folder named Music will the old one be replaced or will it be updated with the new files?(Overwrite existing for example)
taylor162 said:
Doesnt work with me, when i click for a file to be sent it says " this file does not have a program associated with it for performing this action". What have i done wrong!?
Click to expand...
Click to collapse
ok so try opening regedit:
hkey_classes_root
*
shell
push to sdcard
commands
Double click on Default, and edit the value in there to point to your vbs file.
xtcislove said:
Works very well!Many many thanks for this!
Is pushing faster then the transfer with mounting?
How it is with Folders? Did it replace or dit it include? I mean i have a folder that is called Music. So if i upload a new folder named Music will the old one be replaced or will it be updated with the new files?(Overwrite existing for example)
Click to expand...
Click to collapse
Not really faster, but more convenient.
You can highlight a selection of files and push them all to /sdcard/ , but can't do folders yet. I might modify it and put out another version.
Yup works for me too! Thanks a lot!
This will make a little more comfortable my life. Thank you!
Script was run on the first try...
THis is gold - thanks a lot for this! Now I can transfer files and still have access to my apps installed on SD! SO I can uninstall Auto Mount app from my device now...
cool. works fine on my win7 64
worked ok on windows7. On my xp, it gives this attached
Can you post that line here? The error means it isn't terminated properly.
Installing it is a pain. I'll try to make it easier tomorrow
Sent from my HTC Desire using XDA App
Updated the original post with a Linux version of the script.
@k800 I welcome any suggestions on simplifying things!
really cool, thanks a lot.
Works fine on Win 7x64, easy and useful.
thanks St0kes work at treat here thanks
st0kes said:
Updated the original post with a Linux version of the script.
@k800 I welcome any suggestions on simplifying things!
Click to expand...
Click to collapse
Well, I have an idea about a full-fledged context menu extension for ADB. I'll line out the features later
Sent from my HTC Desire using XDA App
Cool, thanks! Works fine in WinXP here.
Updated: Now if you right-click an apk file and use 'send to Android' (or push to sdcard) you have the option to install it.
Anyone that already installed this, just replace your script with the one below:
Code:
' Nothing below this line needs to be changed
' ###########################################
On Error Resume Next
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
WindowStyle_Hidden = 0
args = WScript.Arguments.Count
' start the adb server
if Not oFSO.FileExists(adb) Then
msgbox "Could not find " & adb , vbExclamation , "Error"
wscript.quit
Else
oShell.run "%comspec% /c " & adb & " start-server" , 0 , True
End If
If args < 1 then
msgbox "Incorrect usage - drag your files on to this script to sign them.", vbexclamation, "Incorrect usage"
wscript.quit
end If
Target = WScript.Arguments.Item(0)
TargetFileName = oFSO.GetFileName(Target)
'make a temp file to capture the output
sTempFile = oShell.ExpandEnvironmentStrings("%TEMP%") & "\" & oFSO.GetTempName
Const OpenAsASCII = 0
Const FailIfNotExist = 0
Const ForReading = 1
oFSO.CreateTextFile(sTempFile)
set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist, OpenAsASCII)
If oFSO.GetExtensionName(Target) = "apk" Then
Continue = msgbox ("Do you want to install " & TargetFileName & "?" & vbCRLF & vbCRLF & "Press No if you want to push the apk to your sdcard.", vbYesNoCancel + vbQuestion , "Question")
If Continue = vbYes Then
sExe = adb & " install -r " & """" & Target & """"
oShell.run "%comspec% /c " & sExe & " > " & sTempFile & " 2>&1" , 0 , True
ElseIF Continue = vbNo Then
sExe = adb & " push " & """" & Target & """" & " /sdcard/"
oShell.run "%comspec% /c " & sExe & " > " & sTempFile & " 2>&1" , 0 , True
Else
wscript.quit 'user pressed cancel
End If
Else
sExe = adb & " push " & """" & Target & """" & " /sdcard/"
oShell.run "%comspec% /c " & sExe & " > " & sTempFile & " 2>&1" , 0 , True
End If
adbOutput = fFile.ReadLine
fFile.Close
if oFSO.FileExists(sTempFile) Then
oFSO.DeleteFile(sTempFile)
End If
MsgBox "ADB says:" & vbCRLF & vbCRLF & adbOutput, vbInformation , "Result"
This guide is a great example of how to hack a third-party, closed-source application using apktool and smali. The first goal is to fix an annoying UI lag bug in Words With Friends by inserting a call to Thread.yield() at the top of a tight loop before acquiring a global lock. The second goal is to turn off the advertisements that display after every move.
Table of Contents
1. Install Words With Friends from Google Play
2. Extract the APK file from device onto PC
3. Decompile the APK file
4. Edit Smali: add Thread.sleep() to animation loop
5. Edit Smail: remove addActivity() call for ads
6. Reassemble the APK file
7. Sign the Reassembled APK File
8. Zipalign the reassembled APK file
9. Uninstall Words With Friends from the device
10. Install the fixed Words With Friends APK to the device
Appendix A: Troubleshooting
1. Install Words With Friends from Google Play
Words With Friends is a free application provided by Zynga and is available for install from the Google Play store. Simply search for Words With Friends and install it. More information about the app is available at http://www.wordswithfriends.com.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2. Extract the APK file from device onto PC
In order to modify the Words With Friends application the APK file needs to be obtained. There are several different ways to extract an APK file from your device. The method outlined here is using Astro File Manager from the Google Play store.
Install Astro File Manager from the Google Play store
Launch Astro File Manager from home screen
Select "Application Backup" *
Checkmark "Words Free"
Click "Backup"
Copy the Words With Friends APK file from /sdcard/backups/apps to your PC
* If the screen does not have an "Application Backup" item but rather goes straight into the file browser, open the menu and select "Application Backup" from the there instead.
Astro File Manager will create the folder "backups/apps" on the SDCard if it does not exist and put the Words With Friends APK file in it. The file name may vary, and in my case it was "Words Free-4811.apk".
If you have root access to your device, it may be easier to simply copy the APK file from /data/app to /sdcard and then copy it off the device from the SDCard. To do this I like to use a program called "Terminal Emulator", which can be installed from the Google Play store. Then you can just run the "su" command followed by "cp /data/app/com.zynga.words-1.apk /sdcard" to copy the APK file to the SDCard.
3. Decompile the APK file
The next step is to decompile the Words With Friends APK file using "apktool". The apktool application is freely downloadable from http://code.google.com/p/android-apktool and requires the Android SDK and Java Development Kit (JDK) to be installed. The steps that follow assume that the directory with the "apktool" command is in the PATH environment variable and may be called without having to give the absolute path. I will not cover the steps to install the Android SDK nor apktool here, as there are numerous good instructions on the Internet. The apktool application works on Windows, Mac, and Linux. I will be using Ubuntu Linux 12.04 64-bit (not that it really matters!).
Open a terminal/command prompt into the directory where the Words With Friends APK file is located. In my case, the name of the APK file was "Words Free-4811.apk", but I have renamed it to "WordsWithFriends-original.apk" for simplicity.
Run the following command to decompile the APK. The "-d" command-line argument decompiles the application in "Debug mode". I am not entirely sure what this does, but many instructions recommend its usage. Since it has worked for me, I use it unconditionally. If you get any errors with this commoand, try removing "-d" to see if that works.
apktool decode -d WordsWithFriends-original.apk decoded
This command will create a directory named "decoded" with the decompiled contents of the APK.
4. Edit Smali: add Thread.sleep() to animation loop
One of the bugs in Words With Friends is that there is a tight loop that spins, acquiring the graphics lock, checking if there are any animations to draw, then performing the animations if there are any. The problem is that sometimes this thread "thrashes" or "spins", causing the UI of the application to become temporarily unresponsive. This bug is especially noticable when a blank tile is played: after selecting the letter for the tile, the app appears to hang for several seconds. The fix for this is simple: put a call to Thread.yield() at the top of the loop before acquiring the graphics lock.
To fix this, open the file decompiled/smali/com/zynga/words/ui/game/as.smali in a text editor. Find the "run" method and then the line that follows that looks like:
iget-object v0, p0, Lcom/zynga/words/ui/game/as;->c:Landroid/view/SurfaceHolder;(for me this was at line 136). The two lines above it should be ":try_start_0" and ".line 2569" ("2569" may be different). Insert the following line *above* the ".line 2569" line:
invoke-static {}, Ljava/lang/Thread;->yield()V
Save the changes to the file then exit.
5. Edit Smail: remove addActivity() call for ads
Do you ever get annoyed at the advertisements that are displayed after each move you make? Although this may not be legal, it is quite simple to stop those ads from displaying. All you need to do is remove the command that displays them.
To do this, open the file decompiled/smali/com/zynga/toybox/ads/f.smali in a text editor. Find the line with the text "startActivity" (for me this was line 181) and either delete it or add a '#' as the first character of the line (to turn it into a comment). Then, comment or delete the ".line" line immediately above the startActivity line. Save the changes to the file then exit.
6. Reassemble the APK file
Now we need to rebuild the APK file from the modified smali sources. To do this, run the following apktool command:
apktool build -d decompiled WordsWithFriends-unsigned.apk
This should create the APK file WordsWithFriends-unsigned.apk in the current directory.
7. Sign the Reassembled APK File
Before the modified APK file can be loaded onto a device it must be signed. The instructions below are adapted from the official "Signing Your Applications" page at http://developer.android.com/tools/publishing/app-signing.html.
If you are already setup for APK signing, then this paragraph may be ignored. Otherwise, run the following command to create a code signing key:
keytool -genkey -keystore keystore -alias MyReleaseKey -keypass password -storepass password -keyalg RSA -keysize 2048 -validity 10000This will create a file named "keystore" in the current directory, protected by the password "password". Obviously, this is a terribly insecure password, so I wouldn't recommend using this key for anything else (unless you choose a better key). If you use different values for the -keystore, -alias, -keypass, or -storepass be sure to make the corresponding adjustments to the instructions that follow.
Run the following command to sign your APK file:
jarsigner -keystore keystore -storepass password -keypass password -sigalg MD5withRSA -digestalg SHA1 -signedjar WordsWithFriends-signed.apk WordsWithFriends-unsigned.apk MyReleaseKey
Of course, replace the values of the -keystore, -storepass, -keypass, and MyReleaseKey with the corresponding values on your system.
This should create a file named WordsWithFriends-signed.apk in the current directory, which is the signed version of the modified application.
8. Zipalign the reassembled APK file
Although it is not strictly required, as a performance increase the signed APK file can be "zipaligned". Simply run the following command:
zipalign 4 WordsWithFriends-signed.apk WordsWithFriends.apk
This will create a file named "WordsWithFriends.apk" in the current directory which is both signed and zipaligned. This is the "final" APK file that is ready to be installed.
9. Uninstall Words With Friends from the device
Since the modified APK file is signed with a different key than the one used to sign the APK that was installed from Google Play, the Android OS will refuse to load the modified APK. So before loading it Words With Friends must be uninstalled from the device. This can either be done from the device (eg. from the home screen or Settings -> Applications screen) or by connecting the device to the computer via the USB cable and running the following command:
adb uninstall com.zynga.words
10. Install the fixed Words With Friends APK to the device
Finally, install the signed and (optionally) zipaligned APK to the device connecting the device to the PC via the USB cable and running the following command:
adb install WordsWithFriends.apk
And you're done! Enjoy a better Words With Friends experience.
Appendix A: Troubleshooting
If you encounter any problems, check this section before reporting it.
A1. Cannot sign into Words With Friends using Facebook
It seems that sometimes after replacing the Words With Friends application from Google Play with the custom one that Facebook authentication does not work. Specifically, when the Words With Friends application starts up and prompts for either a Facebook account or email address to sign in, when Facebook is selected it briefly starts loading the Facebook page then returns to the Words With Friends application without having logged in.
This may be because the signature on the APK has changed. The workaround is to uninstall the Facebook application, log into Words With Friends with Facebook, then re-install the Facebook application from Google Play. This will cause Words With Friends to use the facebook.com web page to log in instead of the Facebook application that is installed locally, which does not check APK signatures.
A2. Words With Friends no longer updates from Google Play
Yep, that's unavoidable. To upgrade you will need to go through this entire process again, first uninstalling the modified Words With Friends and starting over with installing from Google Play.
A3. adb install fails with error "INSTALL_PARSE_FAILED_NO_CERTIFICATES"
If "adb install" fails with the error "INSTALL_PARSE_FAILED_NO_CERTIFICATES" then be sure that you are attempting to install the signed APK, as the OS will refuse to load unsigned APKs.
If you are using JDK 7 (as opposed to JDK 6 or 5), which can be tested by running "javac -version" then make sure to include "-sigalg MD5withRSA -digestalg SHA1" in the command-line arguments to jarsigner. The default signing algorithm changed in JDK 7, requiring that these arguments be explicitly specified (see http://developer.android.com/tools/publishing/app-signing.html#signapp for details)
Here's a basic guide on how to port, since some people were asking:
Prerequisites:
Windows 8 (non-RT) development machine
Visual Studio 2012 (Don't know if express will work, but evaluation editions exist here: http://www.microsoft.com/visualstudio/eng/downloads)
dll-to-lib tool (http://forum.xda-developers.com/showthread.php?p=36597774)
Part 1: Getting necessary libs:
(1) On your Windows RT device, copy the .dll files in C:\Windows\System32 to some directory on your development machine (We'll call it C:\rtdev\dlls).
(2) Create a directory on your development machine for the libs (we'll call it C:\rtdev\libs)
(3) Extract the dll-to-lib to your lib directory
(4) Open powershell (run powershell.exe) and navigate to the libs directory
(5) run the lib script against the dlls ("./dll-to-lib.ps1 C:\rtdev\dlls).
(6) If you've never run a powershell script before, you might get a signing error. You can type "Set-ExecutionPolicy Unrestricted" to run the script. Please be aware of the security implications if you choose to do this.
(7) You now have a bunch of libs that tell the linker what functions are available in the DLLs on the Windows RT device. Copy the libs that you need to "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\lib\arm". DO NOT OVERWRITE ANY EXISITNG LIBS (repeat: DO NOT OVERWRITE ANY EXISITNG LIBS OR YOU MAY HAVE TO REPAIR/REINSTALL VS) You'll probably have to change the security permissions if you want to copy to this directory, or copy as an administrator.
Part 2: Fixing the compiler.
The compiler won't let you build desktop apps due to a configuration setting. Fortunately, some people at stack overflow figured this out:
http://stackoverflow.com/questions/11151474/can-arm-desktop-programs-be-built-using-visual-studio-2012
Basically, edit:
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\ARM\Microsoft.Cpp.ARM.Common.props
to include:
<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>
before </PropertyGroup>
Part 3: Building a Win32 Hello World app.
Now that we have the libs out of the way, lets build a basic hello world app.
(1) Start Visual Studio 2012.
(2) Create a new project, select Visual C++ (might be under other languages) and pick Win32 Project.
(3) In the wizard, select "Console Application", and press "Finish".
(4) Replace the program body with some text that prints hello world:
#include "stdafx.h"
#include <stdio.h>
int _tmain(int argc, _TCHAR* argv[])
{
printf("Hello World!");
return 0;
}
(5) Add the ARM configuration settings in configuration manager. Goto Build>Configuration Manager, and under "Active Solution Platform" click on Win32 and click New. Select "ARM" under "Type or select the new platform", and press "OK".
(6) Select the "Release" configuration and build the solution (F6). With some luck, some win32 ARM binaries should appear in the ARM subdirectory of your project.
Part 4: Porting Apps
Now that your compiler works, you can port apps over. Most apps that have a VC++ project should port fine just by adding the ARM configuration.
Some apps will have manually set \MACHINE:x86, in which case you will have to change that in the linker options. Also, ARM doesn't support no dynamic rebase, so if you get that error, turn of \DYNAMICBASE:NO in the linker options.
A lot of cross-platform apps will use 'nmake' or the like. For the most part, these apps can be cross compiled using the VS 2012 ARM Cross Tools - you can find that in your start menu- In Windows 8 just type "ARM" and it should show up.
Also some interesting issues might experience:
You might encounter missing symbols from __imp_XXXX or the like from the linker. If it looks like a Win32 function, you just need to explicitly add the .lib (in project properties under Linker->Input->Additional Dependencies, type the name of the lib, which you need to also copy to the VC\lib\arm directory as above. Some common libs include "gdi32.lib" "shell32.lib" and "ole32.lib". You can usually find the .lib under the msdn references: for example this entry for GetUserName http://msdn.microsoft.com/en-us/library/windows/desktop/ms724432(v=vs.85).aspx tells us we can find GetUserName in Advapi32.lib. Also the A and W suffixes just represent the ANSI and unicode version of these functions.
When compiling big libraries like Qt, you might run into some problem about BLX fixups, since relative jumps on arm are limited (23 bits?) I guess they didn't create fixup islands in the MSVC compiler, but I found if you set \INCREMENTAL:NO, that should fix the problem most of the time. Otherwise you might have to add an \ORDER file and manually order things. See stack overflow topic for more details: http://stackoverflow.com/questions/11478055/lnk2013-error-fixup-overflow
Another serious pitfall.. no in-line assembly support in the MS ARM compiler. So you'll have to write in your assembly in a .S file and link to it.
...hopefully this helps someone - happy coding!
no2chem said:
A lot of cross-platform apps will use 'nmake' or the like. For the most part, these apps can be cross compiled using the VS 2012 ARM Cross Tools - you can find that in your start menu- In Windows 8 just type "ARM" and it should show up.
Click to expand...
Click to collapse
I have found with some nmake projects you need to add
Code:
/D _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
to your CFLAGS otherwise cl complains about not being able to build desktop arm executables even with the change made to visual studio
& : The term 'dumpbin.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At C:\rtdev\libs\dll-to-lib.ps1:62 char:25
+ $unprocesseddef = &$dumpbin /exports $dllfullpath
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (dumpbin.exe:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Exception calling "Matches" with "1" argument(s): "Value cannot be null.
Parameter name: input"
At C:\rtdev\libs\dll-to-lib.ps1:65 char:5
+ $matches = [System.Text.RegularExpressions.MatchCollection] $regex.Matches($ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
Click to expand...
Click to collapse
Thank you for the tutorial, i currently facing issues on step 5, it seems the script can't access the dumpbin.exe, any suggestion ?
rheza02 said:
Thank you for the tutorial, i currently facing issues on step 5, it seems the script can't access the dumpbin.exe, any suggestion ?
Click to expand...
Click to collapse
You should be running the script on your development machine with visual studio installed
lilstevie said:
You should be running the script on your development machine with visual studio installed
Click to expand...
Click to collapse
i'm running it in my development machine with visual studio 2012 installed, Any idea ?
rheza02 said:
i'm running it in my development machine with visual studio 2012 installed, Any idea ?[/QUOTE
Do you have VS2012 express? Possibly the script will not work if you don't have vs2012 express. Also you need to have $VS110COMNTOOLS set, but VS2012 install should set that for you.
Click to expand...
Click to collapse
To be more clear, you may want to try running the tool from the Visual Studio command line, not just bog-standard CMD (unless you want to set a bunch of environment variable sand such by hand). You should be able to invoke the script by typing powershell <scriptname>
cmd.exe : The system cannot find the path specified.
Click to expand...
Click to collapse
This is the first error when i'm trying to run the script.
rheza02 said:
This is the first error when i'm trying to run the script.
Click to expand...
Click to collapse
looks like you don't have powershell installed. are you running an older version of windows? You can download it here http://www.microsoft.com/en-us/download/details.aspx?id=34595
I'm running windows 8, i can't see any value inside path in my environment variable, do you think it gonna be problem ?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
rheza02 said:
I'm running windows 8, i can't see any value inside path in my environment variable, do you think it gonna be problem ?
Click to expand...
Click to collapse
PATH is under system variables not user variables, have you tried opening powershell from the start screen, and executing the script from within powershell directly?
lilstevie said:
PATH is under system variables not user variables, have you tried opening powershell from the start screen, and executing the script from within powershell directly?
Click to expand...
Click to collapse
same error.
GoodDayToDie said:
To be more clear, you may want to try running the tool from the Visual Studio command line, not just bog-standard CMD (unless you want to set a bunch of environment variable sand such by hand). You should be able to invoke the script by typing powershell <scriptname>
Click to expand...
Click to collapse
it's the same thing, i only have a lot of 1kb files with different name in my libs folder. any suggestion guys ?
Thanks
----------------------------
nvm, I thinks it's working now.
no2chem said:
(6) Select the "Release" configuration and build the solution (F6). With some luck, some win32 ARM binaries should appear in the ARM subdirectory of your project.
Click to expand...
Click to collapse
I keep getting these 3 errors. What's happening?
Thanks...
Edit - the ARM subfolder of the project is empty, which I'm guessing it shouldn't be. How do we fix that?
How do i compile my visual studio project for arm ?, there is no arm option in my build configuration.
Read the OP. You have to select "New" from the "Active solution platform" dropdown and ARM should appear...
Sent from my SCH-I535 using xda app-developers app
jtg007 said:
I keep getting these 3 errors. What's happening?
Thanks...
Edit - the ARM subfolder of the project is empty, which I'm guessing it shouldn't be. How do we fix that?
Click to expand...
Click to collapse
Hm, did you overwrite any of the libs in your VS folder? That might be a problem.. hopefully you have a backup...
jtg007 said:
Read the OP. You have to select "New" from the "Active solution platform" dropdown and ARM should appear...
Sent from my SCH-I535 using xda app-developers app
Click to expand...
Click to collapse
As i said earlier, there is no Arm option under Active Solution Platform > new. any idea ?
no2chem said:
Hm, did you overwrite any of the libs in your VS folder? That might be a problem.. hopefully you have a backup...
Click to expand...
Click to collapse
Yes, I did. Several files had the same name and I replaced them all...
Argh.
Sent from my SCH-I535 using xda app-developers app
jtg007 said:
Yes, I did. Several files had the same name and I replaced them all...
Argh.
Sent from my SCH-I535 using xda app-developers app
Click to expand...
Click to collapse
Yikes. I added some instructions warning people not to overwrite.
ALL ABOUT ANDROID SOFTWARE DEVELOPMENT KIT\ANDROID VIRTUAL DEVICE(SDK\AVD)
What we are going to learn?
What is Android SDK?
Installing SDK
Creating and Managing AVDs
Configuring ADB on your Computer
Root your Android Emulator
Thats It!
Part 1 - What is Android SDK?
Android Software Development Kit (abbreviation Android SDK) is an application which allows users to run and manage Virtual Android Emulator.
The Android Software Development Kit (SDK) includes a comprehensive set of development tools. These include a debugger, libraries, a handset emulator based on QEMU, documentation, sample code, and tutorials. Currently supported development platforms include computers running Linux (any modern desktop Linux distribution), Mac OS X 10.5.8 or later, Windows XP or later. The officially supported integrated development environment (IDE) is Eclipse using the Android Development Tools (ADT) Plugin, though IntelliJ IDEA IDE (all editions) fully supports Android development out of the box, and NetBeans IDE also supports Android development via a plugin. Additionally, developers may use any text editor to edit Java and XML files, then use command line tools (Java Development Kit and Apache Ant are required) to create, build and debug Android applications as well as control attached Android devices (e.g., triggering a reboot, installing software package(s) remotely).
Enhancements to Android's SDK go hand in hand with the overall Android platform development. The SDK also supports older versions of the Android platform in case developers wish to target their applications at older devices. Development tools are downloadable components, so after one has downloaded the latest version and platform, older platforms and tools can also be downloaded for compatibility testing.
Android applications are packaged in .apk format and stored under /data/app folder on the Android OS (the folder is accessible only to the root user for security reasons). APK package contains .dex files (compiled byte code files called Dalvik executables), resource files, etc.
Source :- Wikipedia
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Click to expand...
Click to collapse
Part 2 - Installing SDK and AVD Manager
Make sure you have JAVA Installed.....otherwise NOTHING will work...
WINDOWS
1. Download the SDK setup from here > http://developer.android.com/sdk/index.html
2. Install the SDK and choose a short directory to install (C:\....).
3. After you have installed your SDK, Open It and Check Mark the following package :- Tools
4. Wait for it to Download...It will take some time...Be patient...
Click to expand...
Click to collapse
MAC
Go here to get a guide on HOW TO INSTALL SDK ON MAC
Click to expand...
Click to collapse
Here is a video Guide too
Click to expand...
Click to collapse
LINUX
Go here to get a guide on HOW TO INSTALL SDK ON LINUX
Click to expand...
Click to collapse
Part 3 - Creating and Managing AVDs
1. Go to your android-sdk directory and start/run "SDK Manager.exe"
2. Select the platform that you want to download.
3. Click on "Install X Packages" where "X" is the no. of packages you have selected to download.
4. After downloading has finished which will take around 30 minutes on a descent speed internet select "Tools" from the Main Menu bar
at the top of the window and select Manage AVDs..........
5. A New window will open which is the AVD MANAGER.
6. In the Android Virtual Devices tab SELECT "New" to create a new AVD.
7. Enter the following things:
AVD NAME: Type the desired name that you want for your AVD
Device: Select the AVD resolution as per the device options
Target: Select the Android version you downloaded
CPU/ABI: Select Intel Atom (x86) for 32-bit and ARM (armeabi-v7) for 64-bit.
Keyboard: Check this box if you want to use your keyboard in the AVD
Skin: Check this box if you want to get the hardware buttons
Front Camera: Use this option if you have a webcam and want to use it in the AVD
Back Camera: Use this option if you have a webcam and want to use it in the AVD
Memory Options
RAM: Set this to 768 (maximum for Windows user) or 1024 (maximum for Ubuntu users
VM Heap: Set this to 100
Internel Storage: Set this to 4 and Select "GiB" from this drop down list from side by.
SD Card: Select "Size" and Enter 4 and Select "GiB" from this drop down list from side by.
Emulation Options
Snapshot: Just check mark this option. (Not really neccessary)
Use Host GPU: Check mark this option if you want to use the computers graphics.
*****NOTE: REMEMBER THESE TWO OPTIONS ("SNAPSHOT" and "USE HOST GPU") CANNOT BE USED SIMULTANEOUSLY. IT WILL GIVE YOU AN ERROR.*****
7. Now click OK and wait for few seconds. It will come up with a dialog box which will show you the details of the AVD you created and a message that your AVD has been created.
8. Running the AVD
Highlight the AVD you have created and click "Start..." on the left of the window.
and ENJOYYYY......
Click to expand...
Click to collapse
Part 4 - Configuring ADB on your Computer
Configuring ADB (Android Debug Bridge) on your Windows allows you to run adb from anywhere. Hence you always do not have to "cd" to the android-sdk directory.
1. Right click on "My Computer" and select "Properties".
2. Go to "Advanced system settings" and open "Environment Variables".
3. Now under System Variables, click "New"
and enter the following details:-
Variable name: Type in ADB.....
Variable Value: Type here the path of your ADB preceeded by a ";" (SEMI-COLON)
FOR EG: If the path to your ADB is (by default) "C:\Program Files\Android\android-sdk\platform-tools\adb.exe"
THEN YOUR variable path would be :" ;C:\Program Files\Android\android-sdk\platform-tools\adb.exe "
AND CLICK "OK".....
4. After having done with this Search for "Path" in System Variables.
5. Double click on it to edit "Variable Value" and add these lines at the end of it:-
;<PATH_TO_YOUR_ADB> where "<PATH_TO_YOUR_ADB>" is the directory where your ADB is located.
6. Save all these changes by clicking "OK".... and you are done .........
NOW YOU CAN TYPE "adb" ANYWHERE IN CMD AND IT WILL RECOGNIZE IT AS A PROGRAM....
Click to expand...
Click to collapse
Part 5 - Root Your Android Emulator
Want to get more fun on your Android Emulator.....
GET IT ROOTED....
NOTE: YOU MUST HAVE ADB CONFIGURED....... I HAVE TESTED THIS ROOTING METHOD ON API LEVEL 16 ( JELLY BEAN 4.1.2) AND IT WORKS ABSOLUTELY FINE NOT SURE ABOUT OTHERS.....
1. Download the ROOT package from here.
2. Extract the package to somewhere like desktop.
3. Browse to your android-sdk/tools directory and Hold Shift and then right click to get an Advanced Menu. Click on "Open Command Window Here" and type the following command:-
Code:
emulator -avd <YOUR_AVD_NAME> -partition-size 512
NOTE:- DO NOT CLOSE THE COMMAND PROMPT WINDOW OTHERWISE THE EMULATOR WILL CLOSE
4. Now go to Desktop and again hold Shift and right click and Select "Open Command Window Here" and type the following commands one by one:-
Code:
adb connect 127.0.0.1:5554
adb root
adb remount
adb push Superuser.apk /system/app/
adb push su /system/bin/su
adb push su /system/sbin/su
adb push su /system/xbin/su
adb shell chmod 6755 /system/bin/su
adb shell chmod 6755 /system/sbin/su
adb shell chmod 6755 /system/xbin/su
adb kill-server
adb start-server
YOHO............... We are now rooted haha
Click to expand...
Click to collapse
Want to know anything more....Just post it here.....and I'll help you back....
Have I missed something....Please remind me....
Hi
Thanks for this, exactly what i was looking for.
But I find that after I have expanded the /system partition when i restart the AVD it starts with a 211M sized partition. unless i start it from the command line.
Is there any way to change the ini file or the avd manager to start it with 512M /system ?
Also the SU didn't work, I had to grab one of my working phone.. (there was a hex error code)
/system/bin/sh: /system/xbin/su: not executable: magic 7F45
actually spoke way to early no I find the /system partition doesn't save a cross reboots
last edit.
found http://www.ehalm.at/avd-4.3-gapps.php?l=en
has a pre built 4.3 system img with all the goodies installed
Hello and thanks for your OP.
Do you have the binaries for Intel? Intel emulators being way faster, I'd rather root an intel AVD than use ARM.
Also, is there a way to make SU survive reboots? It's very annoying to have to repeat those steps each time.
error: device not found
Thanks for this guide. Had me thinking of how to connect a AVD to adb since there is no USB to physically plug in.
I did try the loopback address, with the right port, but that is as far as I have got:
Code:
[email protected]:~/Build/android-sdk-linux/tools$ sudo adb connect 127.0.0.1:5554
[sudo] password for joel:
connected to 127.0.0.1:5554
[email protected]:~/Build/android-sdk-linux/tools$ sudo adb root
error: device not found
[email protected]:~/Build/android-sdk-linux/tools$ sudo adb devices
List of devices attached
[email protected]:~/Build/android-sdk-linux/tools$
Is there anything I am doing wrong? I know your guide (mostly) is for windows, but it would seem strange for me to emulate Android in an emulated Windows environment (running Debian GNU/Linux v7).
UPDATE: Figured it out, once I used the ./adb command in platform-tools.