I have downloaded android source code and made some changes to
dalvik/vm/interp/Jit.cpp. I have built the source code using
$source build/envsetup.h
$lunch full-eng
$make -j4
The build was successful. Now when I start the emulator by
$out/host/linux-x86/bin/android list targets
$out/host/linux-x86/bin/android create avd -n virtual - t target_api
$out/host/linux-x86/bin/emulator -avd virtual
the emulator starts but when I check the libdvm.so file properties in emulator using
$adb shell
#cd system/lib
#ls -l lidvm.so
the file creation date is 2011-12-14. I thought that the emulator is
starting on standard android 4.0.3 api (where libdvm.so might have
been created on that date). Now I want to make the emulator start with my
newly built code (that is I want to see the changes I made in dalvik
source code in the emulator). How could I possibly achieve this?
Thanks.
Related
I need to include existing android emulator with the changes included in it (qcow2 files) in the docker image.
Sequencing:
1) Create an emulator through the Android Studio
2) Run it with the -writable-system option
emulator -avd xposed -writable-system
3) Make the necessary changes (Xposed installation, some xposed modules, data recording on the SD card and so on). All of these changes writing to qcow2 files (system.img.qcow2, sdcard.img.qcow2, etc.)
4) Stop the emulator
5) Archive it
cd /home/user/.android/avd && tar -cvzf xposed.tar.gz .
6) In the docker file:
ADD xposed.tar.gz /root/.android/avd
7) In xposed.ini change absolute path to the emulator instance
path=/root/.android/avd/xposed.avd
When try to run the emulator inside the docker - the qcow2 files with changes are recreated instead of used existing. :(
I get the same android-sdk tools and emulator versions, the same JDK and so on.
Also trying to change paths in harware-qemu.ini to the new one (/root/.android/avd/xposed/....) but no luck.
Some information about system and docker:
1) Android version 23 (6.0) x86 google_apis image
2) Run docker command:
sudo docker run -d -p 5900:5900 -p 5555:5555 --privileged -v /dev/kvm:/dev/kvm --name xposed xposed
3) Run android emulator command:
usr/local/android-sdk/emulator/emulator -avd xposed -noaudio -no-window -gpu off -verbose -qemu -usbdevice tablet -vnc :0
I really don`t know what to do. It is real, one time a have a luck, I get it and it was working great, but I lost this state and now nothing happens :(
By the way, in normal behavior I will get an error, like:
avd\system.img.qcow2,read-only: Could not open backing file: Could not open .....
But now no errors, it just override my files :(
I had the same problem when copying the emulator from the host to a docker container: the emulator inside docker would always start (in the best case) clean as after a factory reset, ignoring all my changes. This is how I solved the problem:
I started the emulator inside the docker container and I installed everything I needed (Xposed, custom apks etc.) while the emulator was running in docker.
After the emulator was setup the way I wanted, I turned if off and copied the /root/.android/avd/<emulator name> directory from the docker container to the host computer (by using docker cp command). This way I obtained a backup copy of the emulator with all the custom settings that can be used with docker.
I built a new docker image containing all the sdk stuff and tools needed to run the emulator and I added to the image the /root/.android/avd/<emulator name> directory previously saved. Now when I start a docker container from the new image I have a working emulator with all the settings I need.
Bonus tip: if you want to use the snapshot feature of the emulator, you have to commit the changes in the container to a new image (see docker commit command) and then use that new image, simply copying the avd directory will not work in this case and your snapshot will always be ignored.
I am trying to run a emulator from the Android source by loading the goldfish kernel with some of my configuration changes. Though I found a lot of questions on this, but could not find my answer.
1. I downloaded the android source.
2. I also successfully built my goldfish kernel. Now I can see the zImage in the /goldfish/arch/arm/boot folder.
After this I tried running this emulator by referring to a lot of similar questions.
Building Android from source - emulator and AVDs, Running emulator after building Android from source, How to compile android goldfish 3.4 kernel and run on emulator. But unfortunately didn't solve my problem. When I try to run the emulator with :
./emulator -debug init -kernel Thepath/goldfish/arch/arm/boot/zImage -avd firstAvd -wipe-data
I get an error that AVD is not found. I then found this blog, https://yaapb.wordpress.com/2012/09/22/build-a-custom-android-emulator-image/ where it says to first make the emulator from the source tree by the following commands:
$ source build/envsetup.sh
$ lunch full-eng
$ make -j4
$ emulator -wipe-data &
Then to run the emulator with my modified kernel, I need to run :
$ cd ${ANDROID_BUILD_TOP}
$ emulator -kernel ~/workspace/android/goldfish/arch/arm/boot/zImage -wipe-data &
Though I am trying to do this, the process of creating the emulator with the make command is taking hours. 7% in 90 mins till now. So in the mean time I wanted to know if anyone can tell me that to run an emulator with my kernel, do I need to first create an emulator from the source? Also, I dont find the system.img, ramdisk.img files in the android source tree. Is it normal or I ge them when I create an emulator?
**
EDIT
**
I would also like to know if I can run the emulator without the make -j4. The Android source tree also includes the SDK. Can I run the Emulator from the SDK. If yes, how? The google official docs say to run the following command form the /tools folder in the sdk. But there is no tools folder in the sdk folder.
After you have built the sources, you should not run build process once again in order to use the emulator. Simply go to the folder with your AOSP code and run the following commands:
$ cd ${ANDROID_BUILD_TOP}
$ source build/envsetup.sh
$ emulator -kernel ~/workspace/android/goldfish/arch/arm/boot/zImage -wipe-data &
The command source build/envsetup.sh will add additional commands to your shell, and you should be able to run emulator without building it one more time from scratch.
I have downloaded Android Open Source Project and build it in Linux from command line. All are fine. I can use the emulator.
I installed also Eclipse and AVD via eclipse. Now I want to use the open source emulator that I build from command line. How can I do that?
Mahbub
From the shell in which you build AOSP you can run emulator and it will start an emulator which it built as part of AOSP along with the system image created in your AOSP build. You can also use the SDK provided emulator by passing it command line arguments for the kernel, init RAM disk, system partition and data partition.
I have built the Android source for the emulator. I need to add sdcard to this emualtor.
Following are the commands, I use after the first full build:
source build/envsetup.sh
lunch 1
mmm packages/apps/MyApp/
adb sync
adb remount
However, I am unable to see the emulator in /mnt/sdcard path
What are the steps or commands, I need to use, in order to create an sdcard, when I use the emulator(with the commands above) built from Android source code.
I have been stuck with this issue for sometime. Any help is much appreciated.
after executing
$ make -j4
execute
$ mksdcard -l mySdCard 1024M mySdCardFile.img
and then
$ emulator -sdcard mySdCardFile.img
You have to go to the Android Virtual Device Manager, create your own or use an existing one and click the "Edit" button.
Then add some MB to your virtual SD Card.
Once started you can go to DDMS tab, then File Transfer tab and SDCard folder ;)
I have downloaded and compiled Android source code per instructions on Android source website (http://source.android.com/source/building.html)
I chose
$ lunch full-eng
an emulator engineering build and everything has compiled just fine.
Then it says to launch the image inside an emulator just type:
The emulator is added to your path automatically by the build process. To run the emulator, type
$ emulator
Well, not sure it is added to the path. Typing emulator does not do anything.
However if I go to
out/host/darwin-x86/bin/emulator
emulator: ERROR: You did not specify a virtual device name, and the system
directory could not be found.
If you are an Android SDK user, please use '#<name>' or '-avd <name>'
to start a given virtual device (see -help-avd for details).
So I am confused ... at this point do I have to create an AVD ?
How do I create an AVD for this image exactly ?
Has anyone done this on MAC can they supply me with some instructions ?
Thanks
I'm not sure if there is any difference on osx, but it is a common error on Linux. After you build the whole AOSP, the building process will add the <AndroidBase>/out/host/<host-arch>/bin/emulator into the PATH, but after you restart your computer or open another session, emulator will no longer be in the path.
To fix the "You did not specify a virtual device name, and the system
directory could not be found" error, you can explicitly set ANDROID_PRODUCT_OUT to point to your disk image directory. In general, the disk image directory would be <AndroidBase>/out/target/product/generic. So
$export ANDROID_PRODUCT_OUT=<ANDROID BASEDIR>/out/target/product/generic/
would help.
Actually, you can run
. build/envsetup.sh
setpaths
It will do a similar work for you.
I build with aosp_x86_64-eng and have verified that the following will launch the emulator in a new terminal window:
cd /[your AOSP WORKING_DIRECTORY]
source build/envsetup.sh
lunch aosp_x86_64-eng
cd $ANDROID_PRODUCT_OUT
emulator