AOSP x86_64 Emulator not visible in Android Studio - android

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

Related

Testing changes made to AOSP code (package android.media) on an emulator

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

Nativescript emulator installation headaches

I've been trying to get emulators to work for NativeScript on my brand new clean Windows 10 laptop for three days and nothing is working.
To be more accurate, I think I was able to get the 'emulator-5554' to launch, but it doesn't not load the Groceries app.
I have all the Angular requirements installed since I also build Angular SPAs and they work fine. I read and followed all these articles, and I still can't get emulators to work.
I even installed GenyMotion, but it is not detected. I have not installed Android Studio since I'll be developing with Visual Studio Code, so I used the Android CLI to install the SDK.
https://docs.nativescript.org/start/general-requirements
https://docs.nativescript.org/start/introduction
https://docs.nativescript.org/start/cli-basics
https://docs.nativescript.org/tooling/android-virtual-devices?_ga=2.188319272.1221867054.1547512018-618552819.1547075699
https://docs.nativescript.org/start/quick-setup
https://docs.nativescript.org/start/ns-setup-win - this was my primary emulator setup
I have also read many SO posts and none have solved my problem.
Is there some documentation somewhere that is simple and clear, with step by step instructions on how to get emulators installed that will work with Nativescript? What am I missing?
BTW, when I connect my Samsung Galaxy S8 Active phone to my laptop, it's not recognized by the tns device command either.
I can't believe it's this difficult to get emulators to work. I also can't believe that the Nativescript documentation has left this information out of their instructions.
This might not be the answer most are looking for, but this is what was wrong with my installation and this is how I fixed it:
I noticed that the docs all had $./advmanager [someArg] and I had to be sudo for commands to execute. So I ran sudo chown -R myUser:myUser /usr/local/android thus changing all owner:group permissions from root to myUser.
then I could run ./avdmanager create.... (full command below) without having to be superuser
restarted Nativescript Sidekick
I know this is kinda stupid, but I worked out that if the AVD was created as root, the Sidekick program running as myUser could not see and access it. This was confirmed when I ran avdmanager list avd as sudo and got a result, but after changing my files' ownership from root to myUser, nothing was listed from the same command.
I recreated my virtual devices (AVDs) as a normal user and Sidekick was able to see them.
edit: the actual line I ran to create the AVD (because I see a lot of variation in these):
$ ./avdmanager create avd --name Pixel -k "system-images;android-28;google_apis;x86" --device "pixel"?
The uppercase and lowercase "pixel"s come from one entry from the output of
$./avdmanager list
id: 17 or "pixel"
Name: Pixel
OEM : Google
---------
Do this "create" step for each device you want to emulate.
Install Android Studio and open it. Then (without starting a new project) click on:
Configure --> AVD Manager.
There you can create virtual devices, which will be recodnized by NativeScript Sidekick and its virtual device launcher.

Android emulator not working(black screen and offline) for open source project

I followed instructions here to build an open source android project(aosp-2.3.x).
After I finish building the project with:
. build/envsetup.sh
lunch aosp_arm-eng
make -j16
emulator
I can see a black screen emulator and two warning messages:
Could not automatically detect an ADB binary.
Some emulator functionality will not work until a custom path to ADB
is added in the extended settings page.
Running an x86 based Android Virtual Device (AVD) is 10x faster.
We strongly recommend creating a new AVD.
and in my terminal it shows:
emulator: WARNING: system partition size adjusted to match image file (2050 MB > 200 MB)
emulator: WARNING: encryption is off
when I run adb devices, it shows:
List of devices attached
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
emulator-5554 offline
The emulator works in Anroid Studio, but not from the terminal when I tried to build the open source android project, is there any suggestions on how to fix this issue?
I got the same problem like this, try to uninstall android phone driver (check on remove driver and restart pc) then go on search "universal adb driver", download and setup it, it works for me, hope for you too!
PS C:\Users\Nguyen\AppData\Local\Android\sdk\platform-tools> adb devices
List of devices attached
xxxxxxxxxxxxxxxxxx device

Open Android Device in Genymotion from Expo XDE gives error

I am using Expo XDE version 16.0.0 and I would like to test my app in the Android emulator. I am on a mac. I have installed Genymotion and have started the emulator as the expo.io (https://docs.expo.io/versions/v16.0.0/guides/genymotion.html) docs describes but I get the following error. I have no idea of what it means or how to fix it.
Couldn't start project on Android: could not install smartsocket. listener: Address already in use ADB server didn't ACK * failed to start daemon * error: cannot connect to daemon
I hope someone can help me on this one?
In my case the solution was this on an Ubuntu 17.04
sudo apt remove android-tools-adb
adb kill-server
adb start-server
it's possible you have adb and android-tools-adb installed
After having spent a day figuring it out, I decided to go with using the Android emulation within genymotion. This is for Ubuntu (16.04).
Download Android Studio & go into Tools > Android > AVD Manager.
Download the SDK for whichever device & Android version you are going
to use.
Once downloaded, test the emulator is functional by clicking
on the green play icon under 'actions' (far right in Virtual Devices
screen).
Open genymotion, settings > ADB > 'use custom Android SDK
tools'. Select folder /*/Android/Sdk (wherever Android sdk is
installed)
Test by clicking on 'Start' in main genymotion screen.
Open Expo XDE, load up the project & 'ctrl+d' to load on android
device. It will start the installation of expo app.
vividresponse here worked for me even on linux (he made it on OSX and I see it works for windows too).
Basically, you must check the versions of adb. Like:
adb version
And (using you real path)
/opt/android-sdk/platform-tools/adb version
If they differ, replace /usr/bin/adb (first one) with the second one.
Other important things are that you must set the correct genymotion SDK. And make sure sdk & sdk tools must be present in the PATH variable.

android problems sending app to emulator from using terminal

I have launched an emulator with a:
android avd
(although the android developers site said do it from platform-tools, i did it from tools because the android command was there ,and not in platform-tools). Anyway the AVD manager appeared and I started one, and it launched just fine.
Then I tried to send my app to the emulator so (following the android developers instructions) I do a:
adb install /newApp.apk
the command prompt jumps to the next line and just blinks.....when i check the emulator nothing has changed...where am i going wrong???
Once you have started the emulator try
adb devices
to check if you can see it
List of devices attached
emulator-5554 device
then you can proceed with the install
adb install <path-to>/newApp.apk
Something looks strange about that path. If the apk is in the same directory you are launching the command from then you don't need that '/'. If this is a linux machine it would be './' for the same directory unless your apk is all the way up on root but that would be bad :)

Categories

Resources