[GUIDE] How to install Xposed on the official Android emulator - Android Software/Hacking General [Developers Only]

Whether you're using Xposed for modding or reverse engineering, it can be useful to develop your Xposed module on an Android emulator. You might not always have a rooted phone lying around. I noticed there's not a lot of info on how to do it, so here's a guide. This is adapted from my blog, which you can check out if you want to read more info. This post is basically the TLDR.
Note that this is about the official Android emulator, combined with the official version of Xposed. So without further ado, here are the steps:
Preparation​
Create an official Android emulator. Make sure to use Android 8.1 x86, because that's the latest supported version. Do not use an x86_64 image, because there's no Xposed build for that architecture. Name your emulator xposed-emulator. Do not start it yet.
Get the latest Xposed framework zip matching your chosen image. For Android 8.1 x86, select sdk27, and then x86. At the time of writing, the latest is xposed-v90-sdk27-x86-beta3.zip.
Get the Xposed Installer APK from this XDA thread.
Launching the emulator​
See if the emulator command is on your PATH. If it's not, you can find it in the emulator/ folder in your Android SDK directory.
Run emulator -list-avds to check the name of your emulator. Any special characters will be replaced by underscores.
Run emulator -avd xposed-emulator -writable-system to start your emulator.
Wait until the emulator is fully booted up.
Installing the Xposed framework​
This might sound weird, but the first step is to unzip the xposed-v90-sdk27-x86-beta3.zip you downloaded. Then name the unzipped folder something convenient, like xposed.
Navigate to the xposed/META-INF/com/google/android folder, and move the flash-script.sh script all the way to the top level, so that it’s at xposed/flash-script.sh.
Drag the xposed folder and drop it onto your running emulator. This will copy the folder to the emulator’s Download folder.
Now open a new terminal window, and run adb root, followed by adb shell.
Change the directory to the xposed directory you copied over by running cd /sdcard/Download/xposed.
Now run the install script with sh flash-script.sh. This should complete without errors.
Installing the Xposed Installer app​
Install the Xposed Installer APK by dragging it, and dropping it onto your running emulator.
Finalizing the installation​
Shut down the emulator by clicking and holding its power button, and selecting "Power off".
Start it again using the same command as before: emulator -avd xposed-emulator -writable-system.
Open the Xposed Installer app. It should say that Xposed is active.
I hope this was helpful. Again, if you would like to read more, be sure to check out my blog. Also don't hesitate to ask any questions in this thread.

Thank you for your useful article. I went through all the steps mentioned. Of course, I use the nox emulator. In the last step when run this command :
sh flash-script.sh
i get some error:
sed: not found
head: not found
At first, I paid attention to the message that says to use a different version, and I tested all the other versions, but I still got the same error.
I am using Android version 5.1.1 on nox and I just downloaded version 22 - x86. The same thing that the Xposed Installer declares.
{
"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"
}

majixoorf said:
Thank you for your useful article. I went through all the steps mentioned. Of course, I use the nox emulator. In the last step when run this command :
sh flash-script.sh
i get some error:
sed: not found
head: not found
At first, I paid attention to the message that says to use a different version, and I tested all the other versions, but I still got the same error.
I am using Android version 5.1.1 on nox and I just downloaded version 22 - x86. The same thing that the Xposed Installer declares.
View attachment 5762117
Click to expand...
Click to collapse
Interesting, I wasn't aware of Nox. The install script is complaining that the sed and head commands do not exist on your emulator, so I'm assuming that Nox doesn't include those. You can try to use something like this to install busybox: https://github.com/SmartPack/BusyBox-Installer, but note that I have no experience with this. Busybox includes many commands, most likely including sed and head.
The "Wrong platform" error is likely a false-positive and can be ignored. The install script tries to use the (missing) commands in a function that checks the platform. This fails, and so it incorrectly reports that the platform is arm, the default value.

Related

[TOOL]QtADB (AndroidManager for Linux, Windows and MacOS)

hello,
QtADB is window app based on adb.it lets you to copy,remove etc your files and apps from PC and Android Phone
This app is under developing so be tolerant for any bug...
visit QtADB website: http://qtadb.wordpress.com/
Features:
1. File manager
-copying files and dirs between phone and computer
-removing files and dirs
-creating new dir
-and other
2. App manager
-installing apps
-removing apps
-creating backup of apps with data
-restoring backups of apps with data
3. Shell
-opens android shell
4. Screenshot
-take screenshot of your device
-save screenshot to png file
5. Fastboot
-flash bootloader, radio and recovery
-boot recovery
6. Recovery
-nandroid backup/restore
-wipe data
-flash rom
-wipe battery stats
-fix uid mismatches
7. Reboot
-to bootloader
-to recovery
-normal reboot
8. Settings
-set font used by app
-set starting paths (or remember paths on exit)
-and other
9. Automatically detects phone (device, fastboot and recovery mode)
it requires installed AndroidSDK and busybox on phone (so and root)
linux and macOS version reguires installed Qt libraries(libqtgui4, libqt4-declarative and libqt4-network 4.7 version)(install it from synaptic or some similar app)
if you have connected phone but the file list is empty run with root permisions:
1)adb kill-server
2)adb start-server
or:
create file:
gksudo gedit /etc/udev/rules.d/51-android.rules
and insert this line:
SUBSYSTEM=="usb", SYSFS{idVendor}=="0bb4", MODE="0666"
Ive got HTC Magic with Cyan6 and im testing everything on this. QtADB should work with every phone with busybox
if you have any suggestions/questions or you found any bug please let me know
{
"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"
}
More screenshots on official site
I am not responsible for damage done to your phone while using QtADB.
DOWNLOAD FROM OFFICIAL SITE
Do You miss fome feature that QtADB doesn't have? please post Your idea here: http://qtadb.uservoice.com/forums/87039-general
[size=+2]DO YOU HAVE SOME PROBLEMS WITH QTADB? PLEASE READ FAQ FIRST[/size]
If You like QtADB please consider donation:
What language is the windows version written in? Are the libraries able to be referenced from VS?
both versions are in c++ and this is the one source code compiled under windows and linux. it requires Qt libraries for VS
ps.i would like to add some screenshots but i have no permissions:/
where do i put the librays stuff?? im confused.... nvm i think i got it...
ok it says my phones connected for like 5seconds.. then it tells me to connect my phone.??
Nice app thanks!
wow this is AWESOME! thank you!
Looking good! Android management apps are really coming out of the woodwork now
I've attached a screenshot of my own Android manager 'Spot'
Crashes when i try to access a directory on the phone. Win 7 x64 and HTC Desire.
At the beginning, it looks great to use, but then I tried to open any directory, it crashed and forced close
it crashes after 2 - 3 seconds after opening
Windows 7 Pro - HTC Magic 1.5 with Sens UI - official
Acidmax: i dont know why you are having this issues.maybe its because you are using 64bit system...(i will support 64bit when app will be done)
cryshop: what phone?what OS?is phone rooted?which dir are you trying to open (on sdcard/in system).give me something information
crysu_x: "it crashes" has many meanings...what do you see?what error is appearing?what busybox do you have?you have to be more specific
the new version with new upgrades and fixes is almost ready so be patient
Works great for what i've used it for so far. Thank you sir.
@7ymekk : I'm using Windows 7 32bit and rooted HTC Legend.
I tried to open /system folder on the phone.
you know what??if you want to use my app please wait couple of days...i will end my new version and if you'll have the same issue i'll investigate it
how do you install it with ubuntu?
download first attach from first post and install libqtgui4 from synaptic
Hi, this is giving me segfault. I have installed both Sdk and libqtgui4. when i run "adb devices" i can see my tattoo attached.
I run the app, it asks me for the sdk path , then i point it to the "tools" subfolder under the sdk folder and then it segfaults.
This occurs even if i run it with root privileges.
Am i doing anything wrong?
Thanks in advance
if you are expecting some help you have to be more specific! what distro, what phone...the more informations-the better
7ymekk said:
if you are expecting some help you have to be more specific! what distro, what phone...the more informations-the better
Click to expand...
Click to collapse
Oops,
I'm working under Ubuntu 10.04 with a htc tattoo phone.
maybe this evening i will upload new version with screenshots and a lot improvements so i recommend to wait a little if you still will have those problems i will look into this

[BINARY] GNU Nano editor v2.2.6 for Android

I have managed to successfully cross-compile GNU Nano editor 2.2.6 to run on Android and decided to share it here.
Please note that you need to set up terminfo (if your ROM doesn't have it already), by running:
Code:
export TERMINFO=/system/etc/terminfo
export TERM=linux
Unfortunately, it doesn't fully work through adb shell due to the fact that [enter]-key can't be used (this is a bug of adb shell).
It works flawlessly over ssh, although.
{
"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"
}
EDIT: Fully working version is here.
You will need this patch to fix the enter key:
https://github.com/Evervolv/android...b568f0b417c1fe3fe8597c600bdbcda4837013f.patch
Great! Thanks for the information. :good:
As soon as I have time for that I will apply the patch and release a new binary.
bgcngm said:
Great! Thanks for the information. :good:
As soon as I have time for that I will apply the patch and release a new binary.
Click to expand...
Click to collapse
You are welcome.
I guess you will like this patch too:
http://www.faircode.eu/freexperia/update/terminfo.patch
(I have composed it for CM9, but I guess you known how to modify it, when needed)
Edit: use git apply instead of patch
how do i install this in my phone?
ARM cross-compiling how-to
Assuming a toolchain is already present on the build environment, here are the instructions on how to cross-compile Nano 2.2.6 for ARM devices:
Set the path to C compiler:
Code:
export CC=~/toolchain/bin/arm-none-linux-gnueabi-gcc
After you have unpacked the sources change to the source directory:
Code:
cd nano-2.2.6
Now configure the source:
Code:
./configure --host=arm-none-linux-gnueabi
To compile the sources (statically) type this:
Code:
make LDFLAGS=--static
Here is the fully working version of Nano 2.2.6 for Android (without the [enter]-key bug). Enjoy. :victory:
Great job!
I went ahead and packaged this in a flashable zip for people, it also adds a script to /sbin so you can (temporarily) use nano from the recovery console in AROMA Filemanager during that recovery session.
http://forum.xda-developers.com/showpost.php?p=47402916&postcount=133
Good idea! Thank you.
@bgcngm Any way to fix the output when used through AROMA Filemanager's Terminal Console? Scrolling borks things.
Mention me back when you get the chance.
bgcngm said:
I have managed to successfully cross-compile GNU Nano editor 2.2.6 to run on Android and decided to share it here.
Please note that you need to set up terminfo (if your ROM doesn't have it already), by running:
Code:
export TERMINFO=/system/etc/terminfo
export TERM=linux
Unfortunately, it doesn't fully work through adb shell due to the fact that [enter]-key can't be used (this is a bug of adb shell).
It works flawlessly over ssh, although.
EDIT: Fully working version is here.
Click to expand...
Click to collapse
How do I exit Nano in the android Terminal emulator
Edit: I found out hacker's keyboard's ctrl key helps with this problem
If anyone has this issue, let me help out:
In Windows, running nano and vim through ADB returns weird characters on the terminal, and you need ansicon.
Or better use ConEmu.
That's right. It is documented on the internet, that Ansicon is a requirement for Windows if you use command prompt. As you say, better go with a good terminal emulator.
@bgcngm will u update it to v2.4.2 plz?
Just tried to install through CWM on Cyanogenmod 10.1 Unofficial for Samsung Infuse, and got "installation aborted." Any idea what my problem might be?
The .zip that is available is not to be installed from recovery and that's why you are not able to do it.
osm0sis said:
@bgcngm Any way to fix the output when used through AROMA Filemanager's Terminal Console? Scrolling borks things.
Click to expand...
Click to collapse
bgcngm said:
The .zip that is available is not to be installed from recovery and that's why you are not able to do it.
Click to expand...
Click to collapse
Fixed both of these issues and compiled nano 2.5.0.
http://forum.xda-developers.com/showthread.php?p=64247691#post64247691
If you are a termux user and want to install a nano or vi or any other binaries of termux in Andriod su mode. Here is the link to Termux superuser.
Give it a star if it was helpful !!!
bgcngm said:
ARM cross-compiling how-to
Assuming a toolchain is already present on the build environment, here are the instructions on how to cross-compile Nano 2.2.6 for ARM devices:
Set the path to C compiler:
Code:
export CC=~/toolchain/bin/arm-none-linux-gnueabi-gcc
After you have unpacked the sources change to the source directory:
Code:
cd nano-2.2.6
Now configure the source:
Code:
./configure --host=arm-none-linux-gnueabi
To compile the sources (statically) type this:
Code:
make LDFLAGS=--static
Click to expand...
Click to collapse
How to do this on termux? @bgcngm I got the latest 6.4 tarball.

[Q] Access to root and system directory (without rooting and plugging the smartphone)

Hi everyone,
First of all, sorry for my English. I am currently working on an OVAL (oval.mitre.org) project which main goal is to determine if an Android device (smartphone, PDA..) is vulnerable or not , according to its system settings and installed applications. To make it quick and simple, the OVAL application that I am working on should be able of gather all system settings by reading all configuration files of the smartphone, and then analyze this information to determine if the device is secure. Since I have not yet a smartphone, I use Android SDK and some Android X86 images with VirtualBox.
Once one emulator is started, I run adb shell so I can read all files under / . Among them, some interesting configuration files are located under /system, for example. All of them are read-only, that's not a problem since I just have to collect information. I think that some settings can change from one Android version to another, but I will treat this problem later.
Code:
[email protected]:~$ adb shell
# ls
acct
cache
config
d
data
default.prop
dev
etc
init
init.goldfish.rc
init.rc
mnt
proc
root
sbin
sdcard
sys
system
ueventd.goldfish.rc
ueventd.rc
vendor
My question is the following: suppose we now have a real smartphone, that we can't root and/or plug (USB) to a laptop: is it still possible to access to / (or to /system) to gather system information? Is there another way? Maybe by entering in recovery mode (I can't test for the moment because, as I said, I have not smartphone and it seems to be impossible with emulator) ?
Thank you for your attention and for your help !
McFarah (I know, it looks like English-speaking name, but I'm french )
Anything you can do in an ADB shell you can do in Terminal Emulator on the device also. [Android Terminal Emulator - Google Play]
It is essentially the same as an ADB shell, but running on the device itself. All the same commands will work.
There are also plenty of file browsers which I think should be able to read those files without root (I can't test as my phone it rooted, but I believe most file browsers e.g. Solid Explorer, MiFile Explorer, ES File Explorer etc. should be able to do this).
EDIT: For example:
{
"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"
}
(screenshot of terminal emu running same command as you quoted in your post)
EDIT: Also, it looks like you are running as root in the ADB shell output you posted above. The prompt appears to be a #, which indicates root. The normal prompt is $.
Hi SifJar
Thank you for your answer. I have already used Terminal Emulator, this is a good tool, that's right. I have not really experimented with browsers yet.
I have forgotten to say that, but ideally, the application should be able to perform her task without reposing on others external applications. Maybe I would rather write an Android application dedicated to the OVAL application myself, and add some automatisms: the Android application gathers all system and installed applications settings and feeds the OVAL application with that. Do you think this is a good solution?
Thanks
Sorry, I just assumed you wanted a solution for running the same commands you could over ADB on the device itself.
Yes, I believe you can easily call any of these commands from an app as well. I don't know exactly how one would do that, I'm not a developer but I'm sure it's fairly straight forward.
From a little googling, it seems you'd use something like this in your code:
Code:
Process process = Runtime.getRuntime().exec("su");
(replacing su with whatever command you wanted to run e.g. ls)
A few links that might be helpful:
http://saurabh-nigam.blogspot.co.uk/2010/10/running-android-native-code.html
http://stackoverflow.com/questions/...-a-system-command-from-an-android-application
https://code.google.com/p/market-enabler/wiki/ShellCommands
It must be said that I have not been very clear in my previous post!
Anyway, thanks a lot fot your helpful answers and the links, I will go into that in depth, and I will post again if I experiment some troubles. By the way, xda-developers forum is a very good one.
Have a nice day,
Mc Farah

[HOWTO] Setup Linux shell on Windows | Allows Windows to run Linux commands!

Want to do something like this on your Windows OS?
{
"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"
}
Fear not, in this tutorial, you will learn on how to install a linux shell on your Windows OS!
To install a linux shell on Windows, there's a few solutions solutions that I usually prefer:
Msysgit
Cygwin
Powershell
In this tutorial, Msysgit is the program that will be installed as apart from giving you a linux shell, it gives you access to do git related things(clone a repo, fork repo) which is a very good plus
So, here's it, we'll install a linux shell on our Windows OS and have fun with it later on
Msysgit Installation:
1. Click here and download the latest version of msysgit(The latest version of the time of writing is 1.8.0 http://code.google.com/p/msysgit/downloads/detail?name=Git-1.8.0-preview20121022.exe&can=2&q=)
2. Open the installer and you will see something similar to this and click Next to continue
3. After that, you will be shown the gpl license as per shown below and click Next to continue
4. You will be prompted the location to install msysgit at. Click Next to continue
5. You will be prompted for additional settings, click Next to continue.
6. You will be prompted for the startup menu, click Next to continue.
7. You will be prompted for the path environment, select Use Git Bash only and click Next to continue.
8. You will be prompted for the line ending adjustment. Select Checkout as-is, commit Unix-style line endings and click Next to continue.
9. The installer will install the required files.
10. The installation has finished! Untick ReleaseNotes.rtf and click Finish to end the installation.
How to use:
1. Right click on an empty space at your desktop and click Git Bash.
2. Type your linux "hackish" commands!
The command that is used in the first screen shot is ls -la(directory listing with the file permissions of each file).
There's a lot of commands that you can play with, like echo, cat, uname, which, grep, sed, and many many more!
NOTE #1: For the best compatibility, cygwin would be preferred as it has a very complete set of linux commands built-in but Msysgit is less hassle to setup and it allows you to mingle around with Git once the setup is done which is a very good thing
NOTE #2: Msysgit is not preferred as a shell to create anything advanced like roms or kernels as the features that are available at mysysgit is rather limited(but it is enough for most users like us ).
There will be more tutorials which are related to Git and Linux will be made in the future, so read up fast and stay tuned for more contents! :fingers-crossed:

Android Studio Stuck on Loading Project

I was working in Android Studio and accidentally locked my Android Folder containing the Sdk, I re gave myself the permissions and unlocked it but when I try to reopen my android project it stays stuck on loading project.
{
"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"
}
I have tried restarting my computer(linux) and running ./studio.sh but it is still not loading.
I am also seeing in the terminal:
2021-03-19 12:48:57,346 [ 56749] WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=com.android.tools.idea.apk.issues.SetupIssueReporter)
first, glad to see you use programming on linux, i encourage you continue using it and learn it
that "WARN", is normal when starting studio from command line.
check in ~/HOME/AndroidStudioProjects directory, (if you allowed android studio to install location for projects in ~/HOME/AndroidStudioProjects, and in ~/HOME directory check if you have "Android" directory, there is located Sdk tools.
check permissions for directories, just check this website , cd (open directory, terminal command) to ~/HOME/AndroidStudioProjects;
Code:
~/HOME/AndroidStudioProjects
, and check permissions via
Code:
ls -l
, or
Code:
cd AndroidStudioProjects
to get deeper into, to list project directories you have, and check their permissions, they need to have write, and read permissions for owner at least
And replace ~/HOME, with your name you use in linux, if command don't work, so not to get confused there
indestructible master said:
first, glad to see you use programming on linux, i encourage you continue using it and learn it
that "WARN", is normal when starting studio from command line.
check in ~/HOME/AndroidStudioProjects directory, (if you allowed android studio to install location for projects in ~/HOME/AndroidStudioProjects, and in ~/HOME directory check if you have "Android" directory, there is located Sdk tools.
check permissions for directories, just check this website , cd (open directory, terminal command) to ~/HOME/AndroidStudioProjects;
Code:
~/HOME/AndroidStudioProjects
, and check permissions via
Code:
ls -l
, or
Code:
cd AndroidStudioProjects
to get deeper into, to list project directories you have, and check their permissions, they need to have write, and read permissions for owner at least
And replace ~/HOME, with your name you use in linux, if command don't work, so not to get confused there
Click to expand...
Click to collapse
Thanks so much for you help and encouragement for programming with linux!
I checked the permissions of the folder and am seeing:
Code:
drwxrwxr-x
Which I think means that I have permissions for this folder.
yjay18 said:
I was working in Android Studio and accidentally locked my Android Folder containing the Sdk, I re gave myself the permissions and unlocked it but when I try to reopen my android project it stays stuck on loading project.
View attachment 5254367
I have tried restarting my computer(linux) and running ./studio.sh but it is still not loading.
I am also seeing in the terminal:
2021-03-19 12:48:57,346 [ 56749] WARN - Container.ComponentManagerImpl - Do not use constructor injection (requestorClass=com.android.tools.idea.apk.issues.SetupIssueReporter)
Click to expand...
Click to collapse
I keep reading a lot of posts when I first get into trouble. This is how I once reached this website ( https://kodlogs.net/329/android-studio-stuck-on-installing-apk ) and got the desired solution. You can read this post as well as visit here. I think it will be very useful for you

Categories

Resources