I want to install an ARM .apk onto a x86 Android emulator. It already works with libhoudini and Genymotion. Now I want to use libhoudini with docker-android.
I already tried the solution from How to flash zip on Genymotion programmatically (extracting the shell script and pushing it via adb to the emulator inside Docker), but this didn't work either because unzip/zip is not supported.
This is the current Dockerfile:
FROM budtmo/docker-android-x86-6.0
COPY ./app/outputs/apk/release/app-release-unsigned.apk .
COPY ./arm-translation.tar .
COPY ./setup.sh .
COPY ./flash-archive.sh .
RUN chmod 777 setup.sh
What is the best way to run an ARM .apk on a x86 emulator inside Docker?
Related
I downloaded AOSP on Ubuntu, made changes and built it for x86_64 (lunch aosp_x86_64-eng).
The changes are in package android.media.
Can I test the changes on the emulator on Ubuntu? Do I need to build the emulator?
(I am not using Android Studio. I build AOSP and start the emulator on the command line.)
Option 1: the framework and push the jar
make framework
adb root
adb remount
adb sync
adb reboot
Option 2:
Full make and flash via fastboot
I am using AOSP emulator for testing my code.
I downloaded the android10_release source code of AOSP in my pc.
Then used the following commands
source build/envsetup.sh
set_stuff_for_environment
lunch aosp_x86_64-eng
make -j6
emulator
now after running these commands I am successfully able to run emulator in my pc
OS of my pc is Ubuntu 18.04
I also installed many libraries for working with AOSP like jdk-8, python, curl, repo, git, and other stuff as per described in AOSP website
I am abe to see my emulator running in terminal by executing following commands
$ adb devices
List of devices attached
emulator-5554 device
I am also able to install my apk in this emulator by executing following commands
$ adb install myapp.apk
and it gets installed and I can see it in emulator
Now coming to my question
Why this emulator not showing in Android studio in devices
Even when I troubleshoot the adb connections in android studio it shows my emulator running but not showing in available devices.
Or connect to it via network adb connect localhost:5555 - port number is one higher than emulated device serial (in default case emulator-5554).
Then it is visible in Android studio and it works without issues.
solution that works for me (tried on two different machines):
$ cd aosp
$ repo init -u https://android.googlesource.com/platform/manifest -b android-10.0.0_r29
...
$ repo sync
...
$ . build/envsetup.sh
$ lunch sdk_phone_x86
$ m -j16
waiting for aosp to build
$ emulator &
$ adb devices
List of devices attached
emulator-5554 device
$ adb connect localhost:5555
connected to localhost:5555
$ adb devices
List of devices attached
emulator-5554 device
localhost:5555 device
start Android Studio (tested with 3.5.3 & 3.6.0)
In the devices list I see: "unknown Android SDK build for x86" with a little green dot next to it.
When I click on Run or Debug everything works
Finally after doing a lot of research I got to know that if I want to use Emulator of AOSP in Android Studio so I need to follow this guide
Sharing AVD system images for others to use with Android Studio
Follow these instructions to share your AVD system images with others. They can use your AVD system images with Android Studio to develop and test apps.
Make additional sdk and sdk_repo packages:
$ make -j32 sdk sdk_repo
This creates two files under aosp-master/out/host/linux-x86/sdk/sdk_phone_x86:
sdk-repo-linux-system-images-eng.[username].zip
repo-sys-img.xml
Host the file sdk-repo-linux-system-images-eng.[username].zip somewhere accessible to your users, and get its URL to use as the AVD System Image URL.
Edit repo-sys-img.xml accordingly:
Update <sdk:url> to your AVD System Image URL.
See sdk-sys-img-03.xsd to learn about other updates to the file.
Host repo-sys-img.xml somewhere accessible to your users, and get its URL to use as the Custom Update Site URL.
To use a custom AVD image, do the following in the SDK Manager:
Add the Custom Update Site URL as an SDK Update Site.
This adds your custom AVD system image to the System Images page.
Create an AVD by downloading and selecting the custom AVD system image.
This link is helpful for reference
Create avd from AOSP to use in Android Studio and also share with others
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 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 want to use Adobe Flash in the development of Android applications. But how do I install flash on the emulator so that I can test my software with flash?
To install the AIR runtime on the emulator:
adb -e install -r Runtime_Emulator_Froyo_20100930.apk
from this site:
http://flashsimulations.com/2010/10/19/developing-android-applications-with-adobe-air/
download the adodeflash player file(.apk) and install using the command adb install filename /sdcard/
I tried this using comadobeflashplayer-1.apk, but it crashes the emulator browser. I was able to uninstall thanks to this helpful link:
http://forum.androidcentral.com/lg-optimus-s/43187-installing-flash-10-1-optimus-s.html
I did not put it on the sdcard (which is the -s option)
There might be some configuration option for the avd that allows it to run, but that's speculation.
Install flash procedure for AVD
Download appropriate flash apk file from : http://helpx.adobe.com/flash-player/kb/archived-flash-player-versions.html#flash_player_archives
Make sure yours PATH environment includes path to /SDK/platforms-tools (or wherever your adb program is)
Then open commandline (terminal or cmd.exe), and run following command
adb install FLASH.APK
This install flash APK to android virtual machine (as any other APK application package)
But let me warn you, FLASH does not work in webView, and I tried all answers from this portal.
In the Android browser, browse to http://get.adobe.com/flashplayer and it should redirect you to the Android Flash install.