I have aready build a emulator with new kernel from source.
And with the built file and source,the project folder is so huge.So,i want to part them off.
Here,i download the sdk tools.
So,i wonder which files does a emulator need at least?such like,system.img and what?
(What's more,i have also build a new kernel,and i want to run the emulator with this new kernel)
thx,in advance!
attached:
After a long time searching,i put the minimal files in a folder like:
:~/droidls
hardware-qemu.img system.img userdata-qemu.img
ramdisk.img userdata.img zImage
And then,i cd to this folder and put the android-sdk-linx/tools path into host os's PATH variable.
At last,I try to use the following command to start the emulator:
emulator -kernel zImage -ramdisk ramdisk.img -sysdir ~/droid -datadir ~/droid -data userdata-qemu.img -system system.img -initdata userdata.img
But it fails.
And with the built file and source,the project folder is so huge.
Please Describle it How the project folder got huge after built it.
So,i wonder which files does a emulator need at least?such
like,system.img and what?
Yes, its nice question. as Per the Official Documentation,
To use the emulator, you first must create one or more AVD
configurations. In each configuration, you specify an Android platform
to run in the emulator and the set of hardware options and emulator
skin you want to use. Then, when you launch the emulator, you specify
the AVD configuration that you want to load.
Each AVD functions as an independent device, with its own private
storage for user data, SD card, and so on. When you launch the
emulator with an AVD configuration, it automatically loads the user
data and SD card data from the AVD directory. By default, the emulator
stores the user data, SD card data, and cache in the AVD directory.
you can Go through the Here For More Description
What's more,i have also build a new kernel,and i want to run the
emulator with this new kernel
For query regarding Running with your New Kernal and running it with your emulator you can Go through Android Kernal Compile and Test with Android Emulator
Hope it Will Help
For running an application on device or emulator Android Package .apk file is needed. A .apk files contains .dex file(files converted to Dalvik byte code), resources files .arsc, Uncompiled resource and AndroidManifest.xml. For more detail see the developer guide document Building and Running.
Related
I am using Nougat 7 emulator and was able to root the emulator. But after rebooting all the changes i made to android /system folder are gone. Is there any way to preserve the /system. My real objective is to install xposed on Nougat 7 android emulator .
When you start the Android emulator the system partition comes from a shared image located in the Android SDK. Search for system.img in the subdirectory system-images/android-??/default
If you want to change something on the system partition I would suggest to do the following:
Copy system.img file
Modify it outside of the emulator (uncompress, mount, modify, recompress, see on this page section "SYSTEM.IMG" for details)
Use the modified system.img to start/create a new AVD instance.
I downloaded a third-party ROM, and I want to run it on the emulator first before flash it into the phone. Here is the contents of cm-11-20140911-NIGHTLY-p3110.zip:
1. boot.img
2. file_contexts
3. META-INF/
4. recovery/
5. system/
I unpacked boot.img using the script unpack-bootimg.pl and get boot.img-kernel, and boot.img-ramdisk.cpio.gz. Then I repacked the system using the make_ext4fs and got system.img.
I created an AVD and execute:
emulator -system ~/cm11/system_new.img -ramdisk ~/cm11/boot.img-ramdisk.cpio.gz -kernel ~/cm11/boot.img-kernel -avd and442
but all I got is nothing, the emulator screen is just black. There is no log message from adb -s emulator-5554.
Now I am confused:
can the third-party ROM be tested by the emulator?
Am I doing the right way?
Yeah, why not.
We can flash a third-party ROM on Android AVD. But first you must know the following things:
1. The Android Emulator is itself a device, like your Moto G or Xperia
2. Every ROM is device-specific (supports a device-specific Kernel)
(on many sites/blogs you got information like you have to replace system.img file from .android\avd\avdname.avd, but it is technically incorrect, because you also require ramdisk.img.)
To do this, you need to create your own AOSP repository by downloading the particular repository and have to build your own .img files)
You can do it in two ways:
replace files system.img and ramdisk.img from location .android\avd\avdname.avd
Build your own AOSP. Before... make in "lunch" select target as: Emulator (like: genericX86), i.e., generate all emulator specific .img files
I have tried many things. It's a bit critical, but interesting. The following links may help you:
To run your cooked ROM on Emulator (link down. Try this, from archive.org).
To Create AOSP Project
I do read relevant topics before asking the question, but none is helpful.
I am using Ubuntu 12.04, the default path of AVD is ~/.android/avd, and I would like to change it, how can I make it?
Thanks for reply.
You can use a symbolic link to change the default path of AVD in Linux.
mv ~/.android/avd ~/.android/avd_bak #take backup of existing images in case you need them
ln -s path/to/my/avd ~/.android/avd
Now whenever you create a new image they will actually be created in the new location. For moving the existing images to the new folder you can follow the steps mentioned in Rajesh's answer
From Android Developer Guide Managing AVDs from the Command Line where the following is stated:
Default location of AVD files
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.
The android tool also creates an <AVD_name>.ini file for the AVD at the root of the .android/avd/ directory on your computer. The file specifies the location of the AVD directory and always remains at the root the .android directory.
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 7 and Vista. If you want to use a custom location for the AVD directory, you can do so by using the -p <path> option when you create the AVD:
android create avd -n my_android1.5 -t 2 -p path/to/my/avd
If the .android directory is hosted on a network drive, we recommend using the -p option to place the AVD directory in another location. The AVD's .ini file remains in the .android directory on the network drive, regardless of the location of the AVD directory.
It should be clear that new AVDs can be created on different location by using the -p <path> option. If you want to move the existing AVDs, you should edit the corresponding .ini files and alter the path= attribute, while making sure that you leave the .ini files in the ~/.android/avd directory. (Just to be safe, make sure you take a backup of the .ini files before you tamper with them)
"I guess not, because the Android SDK & tools do not use any system registry/configuration values."
Also there doesn't seem to be a setting available to enter the path. What a disgrace. It is a disgrace because it is hard coded.
Quick-fix for those win 7 users who were so adventures that upgraded to a colour monitor as against the linux-standard green/amber screen and now dare to look down on command line:
From \Users\ directory copy the .android directory into the C:\Users\ directory.
Apart from the avd directory the rest can be deleted.
Inside the avd directory the yourdevice.avd directory is not necessary.
All you need is the .ini file.
There is also no need to modify the path inside the .ini file either. It points to the right location.
When you create a new device-profile, it is saved to the NORMAL path IE: as before:
\Users\.android\avd
Copy and paste the device's .ini file from \Users\.android\avd directory to the C:\Users\.android\avd directory.
I did some testing, it seems to work.
If there is a problem with this approach, please tell about it.
May I ask the Android SDK developers to do a search for "Microsoft Windows Operating System", for "Graphical User Interface" and for "hardcoding" as it relates to programming practices.
I'm trying to run my android emulator on windows console but I get this error:
emulator: ERROR: Your system directory is missing the 'kernel-qemu' image file.
Please specify one with the '-kernel <filepath>' option
how can I fix this?. thanks for tour time.
----- UPDATE -----
I finally can fix this error. At fisrt, I planned to install android SDK offline rather than using SDK Manager. So I followed up this instruction and downloaded the components I need. Everything is correctly except that when I extract the platform using IZArc the file kernel-qemu which located in /platform/images/ is not extracted. But when I manually choose the file from IZArc and drag it to any folder it's extracted. Maybe this is about IZArc configuration but this error cost me for almost a week!
do you have your kernel image file under
< android >/tools/lib/images/
directory?
but i think your problem is your sintaxis to run the emulator
./emulator -kernel kernel-qemu -system
system.img -ramdisk ramdisk.img
-initdata userdata.img -partition-size 512
I need to patch a file into the system.img file used by the Android emulator, specifically I want to add an ARM binary to the /system/bin directory.
I have this binary pre-compiled and it works in my emulator perfectly, but I can't simply remount system.img as rw and adb push it because the change is non-persistent across reboots. I tried this on a copy of system.img and passing it to the emulator with -system but that was non-persistent to sadly.
In the ideal world I want to modify the "make sdk" process so that the sdk build process automatically includes my binary when it produces system.img. Can this be done?
If this isn't possible, is there anyway of patching it into the image manually?
Thanks a lot.
I was interested in permanently modifying the /system folder and tried unpacking the system.img file which went ok, but I failed to create a new img that the emulator was happy with (using the mkyaffs2 and unyaffs2 tools to extract and create a new system.img).
Instead I found a much easier solution:
Remove everything from the /data/ directory (except lost+found)
Copy the contents of /system into your /data folder
Make your desired changes to /data/
Kill the emulator
You now move your ~/.android/avd/MYANDROID.avd/userdata-qemu.img to ~/system.img (or wherever)
and startup your emulator with your new system image:
emulator -debug all -show-kernel -verbose -avd MYANDROID -no-boot-anim \
-gpu on -partition-size 800 -system [path to your new system.img]
The /data folder is where the userdata-qemu.img file gets mounted.
It gets created the first time the emulator is run and will get recreated if you delete it.
(though your installed apps will disappear).
BY populating it with the contents of the /system folder and then making your desired modifications you have created a replacement for the system.img file.
system.img replace with original one so you need give patches whenever your emulator boots check logcat & then using ADB push you manually push the patches.