Android command line tools not installing correctly? - android

I'd like to start developing a react-native app, and to do that I need an emulator. I am on an Ubuntu virtual machine, so I figured just using the command line tools would be fine. After fumbling around for a bit I ran
$ANDROID_HOME/bin/sdkmanager --include_obsolete --update
and
$ANDROID_HOME/bin/sdkmanager "platform-tools" "platforms;android-26"
Both returned "done" pretty quickly.
I tried to create an image to load up in the emulator...
$ANDROID_HOME/bin/avdmanager create avd --name "testbed" -k "system-
images;android-26;x64"
Error: Package path is not valid. Valid system image paths are:
And no system images are listed. How do I download system images properly?

Related

Android command line tools Panic Android_SDK_root broken

For our QA team we need to provide an Android emulator without Android Studio.To do this I used the line tools command provided by Google.
I made this folder tree
kit-emulator
-android-sdk
-avd
in the android-sdk subfolder I put the line tools command folder and from this folder using the sdkmanager I download the sdk with this command
sdkmanager --sdk_root=C:\Users\EBERTGU\Desktop\kit-emulator\android-sdk platform-tools emulator platforms;android-30 system-images;android-30;google_apis;x86_64
The download goes smoothly.
The avd folder is designed to accommodate the newly created emulator. For that I use the avdmanager of command line tools with the following command
avdmanager create avd -n "a350" -k "system-images;android-30;google_apis;x86_64" -p "C:\Users\EBERTGU\Desktop\kit-emulator\avd\a350" -f -d "pixel_4_xl"
The emulator is created in the a350 folder contained in the avd folder. You may be wondering what's wrong then. It's s the launch of the emulator.
When I start the emulator with the command emulator #350 I have this error
PANIC: Cannot find AVD system path. Please define ANDROID_SDK_ROOT
Error which is explained by itself. So I set my environment variable ANDROID_SDK_ROOT to C:\Users\EBERTGU\Desktop\kit-emulator\android-sdk
I restart the commande line prompt and start again to start the emulator this time I got this error
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [C:\Users\EBERTGU\Desktop\kit-emulator\android-sdk]!
Now I don't understand why it doesn't work. I searched and opened the emulator ini file inside I found the line
image.sysdir.1=android-sdk\system-images\android-30\google_apis\x86_64\
In despair I changed it to
image.sysdir.1=C:\Users\EBERTGU\Desktop\kit-emulator\android-sdk\system-images\android-30\google_apis\x86_64\
And when I try to start the emulator with the modified image.sysdir.1 line it works !
Anyone have an explanation of why launching doesn't work with base value for image.sysdir.1 and environment variable?
Thank you a lot
Have a nice day
Shindra Guillaume
I found the solution, it was the generation of the emulator from the avdmanager in the bin folder of command tools lines. Just put the files at the root of command tools lines in a subfolder and the system image is properly configured to match that of the root SDK

Which of the following android package is emulator

I am trying to setup react native without android studio by following this. Below are the packages that it asks me to install:
sudo /opt/android/tools/bin/sdkmanager "platform-tools" "platforms;android-28" "build-tools;28.0.3" "add-ons;addon-google_apis-google-24"
But the problem is that it is also downloading emulator, which I don't want because I would be running on a real device( It is large as well). I am unable to identify which of the above package is leading to installation of emulator.
Can you please help me so that emulator is not downloaded.
As I have checked for it by dedicating some time, I have found that installing build tools will install emulator as well.

Device list doesn't shows in Android Studio using Flutter

I tried to develop app using Flutter(using Android studio IDE).Add flutter plugin & flutter SDK in studio and Everything is configured but emulator / real time device are not listed. Its shows error like "Unable to list devices: Unable to discover Android devices. Please run "flutter doctor" to diagnose potential issues"
Ref link : https://flutter.io/setup-windows/#android-setup
https://flutter.io/get-started/test-drive/#androidsstudio
configure flutter in terminal to detect Android SDK and Android Studio:
$ flutter config --android-sdk /path/to/android/sdk
$ flutter config --android-studio-dir /path/to/android/studio
then restart Android Studio/Intellij.
source: https://github.com/flutter/flutter-intellij/issues/2113#issuecomment-383412308
If you configure flutter and android sdk both perfectly and you do not show the avd device list in android studio.
It's very simple way to show android emulator device list.
First create a new Android Emulator if already create you run the AVD manager then you can show the instead of emulator name
Before:
https://i.stack.imgur.com/6np0m.png
After:
https://i.stack.imgur.com/fiCYe.png
May be there is no AVD's to list down. And if emulator runnig, intelliJ will grab it.
In Android Studio, you can create a AVD using AVD Manager or using Terminal. Here is how you can do that using Terminal,
First, go to the android sdk installed directory -> tools
and copy the path and in the terminal type cd and paste the path and press enter. Now yo are in the tools directory.
Next, using terminal type:
emulator -list-avds - to list created AVD's(You should be in tools directory to run this command).
If there is a device type emulator -avd <name>. else you can create a one:
type cd bin then,
Use:
avdmanager create avd -n name -k "sdk_id" [-c {path|size}] [-f] [-p path]
As a example:
avdmanager create avd -n Nexus -d 23 -k system-images;android-23;google_apis;x86
Then again go back to tools directory by typing cd .. and type emulator -list-avds. This command will list your created AVD.
To run a AVD type:
emulator -avd <name>
About AVD.
Had the same problem after moving avd's to another disk.
I managed to solve by making ANDROID_HOME system variable to point to the android sdk path.
For mac users,
It was working fine yesterday. In my case I had this in .bash_profile
ANDROID_HOME = Library/Android/sdk
I changed it to,
ANDROID_HOME = /Users/rana.singh/Library/Android/sdk
.bash_profile has
export ANDROID_HOME=/Users/rana.singh/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
It worked.

Android emulator without Studio launch error

I'm trying to install just the Android Emulator on my Mac, not the whole Android Studio.
So far I have:
1) Installed Android-SDK via Homebrew
brew cask install android-sdk
2) Added to my $PATH, and checked I have no other ANDROID related PATHS going on.
export ANDROID_SDK_ROOT="/usr/local/share/android-sdk"
3) In terminal running
$ANDROID_SDK_ROOT
shows
/usr/local/share/android-sdk: is a directory
4) Created a new AVD in with AVDManager.
5) Try to run created AVD and get this error
PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/usr/local/share/android-sdk]!
I also can't run 'emulator' from the command line, I CAN run avdmanager and sdkmanager fine.
I've checked the path which appears to be correct. The AVD is in the location of
/Users/<user>/.android/avd/test.avd
Where could I be going wrong?
I had the same issue on Linux, trying to build a Docker image for the emulator, and finally find out what the reason was by looking at the Android emulator source code.
I installed only the required SDK packages for emulator ("emulator" and one of the "system-images"), but the emulator program check if ANDROID_HOME or ANDROID_SDK_ROOT path contains the "platforms" and "platform-tools" directory, so I installed the "platform-tools" package and one of the "platforms" package and it worked.
Manually create those two empty directories should also be enough.

Jenkins: could not create Android emulator failed to parse AVD config file

I have a Jeknins installation on my local PC. I'm successfully able to integrate Android application code with github and generate .apk file as an artifact.
The problem is in the test case execution. I cannot get the Android emulator to start.
It says:
\sdk/tools/android.bat" create avd -f -a -c 500M -s 480x640 -n hudson_en-US_480_480x640_android-21_armeabi-v7a -t android-21 --abi armeabi-v7a
[android] Could not create Android emulator: Failed to parse AVD config file
Recording test result.
I have already tried this:
Could not create Android emulator: Failed to parse AVD config file
Also, I ran the same create command from command line and it successfully craeted the AVD.
Not a complete answer, but it seems that the andoid Sdk update that came out recently - SDK Tools, Revision 25.3.0 (March 2017) - has made some significant changes.
The Android emulator jenkins plugin uses the android command (/home/jenkins/Android/Sdk/tools/android), but if I copy the commands from the console output and try and run that from the command line on the Jenkins machine I get:
[android] /home/jenkins/Android/Sdk/tools/android create avd -f -a -s HVGA -n hudson_en-US_120_HVGA_7.02 -t 7.02
[android] Could not create Android emulator: Failed to parse AVD config file
and try and run that from the command line on the Jenkins machine I get:
The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
So it seems that from 25.3.0 onwards, the 'android' command is deprecated and has been removed, but the emulator plugin hasn't been updated to reflect this.
As a solution, the best bet seems to be to install an earlier version of the android Sdk that still supports the 'android' command, at least until the plugin is updated.
Try leaving the sdcard field empty.
I ran the command that the android plugin printed out via a shell script and added -v (for verbose) after android.
I then saw that the problem was that it could not create an sdcard.
When not filling in an sdcard size, it worked.

Categories

Resources