I'm trying to build android applications with the command line tools in Windows 10.
I was able to install the platform tools and the platform with the sdkmanager with no problem and also accepted all of the licenses.
But when I try to install the build tools using this command
./sdkmanager --sdk_root=C:/Android --verbose "build-tools;27.0.3" it fails and
I get these messages running on verbose:
Info: Parsing C:\Android\cmdline-tools\4.0\package.xml
Info: Parsing C:\Android\platform-tools\package.xml
Info: File C:\Users\PC\.android\repositories.cfg could not be loaded.
Warning: Dependant package with key emulator not found!
Warning: Unable to compute a complete list of dependencies.
I found this question which had the same warning: Error "Dependent package with key emulator not found" while updating Android SDK and tools
But it seems that the emulator package doesn't exist anymore and I don't think it has to do with why I am unable to install the build-tools
Any help will be appreciated.
Open the bin folder
On the location bar at the top, remove everything for it and type cmd
Now type this command:-
sdkmanager.bat "build-tools;latest" --sdk_root=../
After this command, type this command:-
sdkmanager.bat "platforms;android-32" --sdk_root=../
NOTE - Upper command android-32.0.0 is based on the time I am typing this
And this will work in most the cases, or try reinstalling or consider watching the video tutorials on YouTube
Related
It asks me to mark the location of the sdk file in the adb section of the genymotion emulator.
However, android studio is not installed on my computer. Therefore, there is no Android/sdk file in C:\Users\Win10\AppData\Local. In short, do I have to install android studio to use genymotion emulator in vs code program?
Solve the problem by downloading command tool files and running sdkmanager.bat without using android studio.
You can download the android sdk using command lines tools without the use of android studio
Once installed run the sdkManager in a command line tools. The sdkmanager is a command line tool that allows you to view, install, update, and uninstall packages for the Android SDK.
List installed and available packages
sdkmanager --list [options] \
[--channel=channel_id] // Channels: 0 (stable), 1 (beta), 2 (dev), or 3 (canary)
Use the channel option to include a package from a channel up to and including channel_id. For example, specify the canary channel to list packages from all channels.
Install packages
sdkmanager packages [options]
I'm installing Flutter without installing Android Studio by following a youtube guide. and in there, first I install git then installed Flutter via, Git and then installed java and set up JAVA_HOME and other env variables. after that I installed Android SDK Tools and tried to run two of the commands:
[1] sdkmanager.bat "build-tools;28.0.3" --sdk_root=../
[2] sdkmanager.bat "platforms;android-30" --sdk_root=../
The first command sdkmanager.bat "build-tools;28.0.3" --sdk_root=../ returns the following error:
Warning: Dependant package with key emulator not found!
Warning: Unable to compute a complete list of dependencies.
[=== ] 10% Computing updates...
but the second one runs fine.
So please help me resolve the error for command [1]!
You can try "build-tools;31.0.0" .
I did and it worked for me.
Prerequisite
Android SDK is well installed (directory : /Users/gamecube/Library/Android/sdk)
How to reproduce :
Run this command : cordova build android
Run this command to launch android emulator : cordova emulate android --verbose
Expected result
The emulator is launched.
Obtained result
Command finished with error code 0: /Users/gamecube/Desktop/geocars/platforms/android/gradlew cdvBuildDebug,-b,/Users/gamecube/Desktop/geocars/platforms/android/build.gradle
Built the following apk(s):
/Users/gamecube/Desktop/geocars/platforms/android/app/build/outputs/apk/debug/app-debug.apk
No scripts found for hook "before_deploy".
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/gamecube/Library/Android/sdk (DEPRECATED)
Running command: adb devices
Command finished with error code 0: adb devices
Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
at /Users/gamecube/Desktop/geocars/platforms/android/cordova/lib/emulator.js:176:35
at processTicksAndRejections (internal/process/task_queues.js:97:5)
My questions
Why Android Emulator does not work?
and
Why is there this error? :
CordovaError: Could not find either `android` or `avdmanager` on your $PATH! Are you sure the Android SDK is installed and available?
I solved my problem.
How did I do it?
I opened Android Studio, and went to the SDK Manager.
I clicked on the SDK Tools tab, and in the list displayed, I checked: Android SDK Command-line Tools (latest)
I then clicked on Apply (then OK on the pop-up) to download the package in question.
I added the path of avdmanager to PATH in my .bash_profile
I have run source ~ / .bash_profile to refresh
And I launched my command: cordova emulate android --verbose successfully since the emulator has opened well.
Without Android Studio, merely with Android Command Line Tools from Android SDK. Be sure these Android Command Line Tools (such as sdkmanager or avdmanager) are in the PATH, otherwise run them using the full path (for Debian/Ubuntu see this to install Android SDK).
Install the emulador
sdkmanager --install "emulator"
Install the platforms, example for Android API 32 and 33 (Android 12 and 13 respectively):
sdkmanager --install "system-images;android-32;google_apis;x86_64"
sdkmanager --install "system-images;android-33;google_apis;x86_64"
Create the Android Virtual Device (AVD), example:
avdmanager create avd -n emulator32 -k "system-images;android-32;google_apis;x86_64"
Confirm that was installed
avdmanager list avd
Run
cordova emulate android --target=emulator32
I am trying to install and run an Android Virtual Device from the command line on Windows (without Android Studio). I have set up an Android SDK in C:\Android, and successfully created an AVD with the command:
avdmanager create avd -n test -k "system-images;android-26;google_apis_playstore;x86" --abi google_apis_playstore/x86
I have environment variable ANDROID_SDK_ROOT set to C:\Android.
When I try to start the emulator from the command line with:
emulator #test
I get errors:
emulator: ERROR: can't find SDK installation directory
emulator: could not find virtual device named 'test'
I have also tried setting environment variables ANDROID_AVD_HOME and ANDROID_EMULATOR_HOME, and also tried running the AVD specifying sysdir and datadir with the command:
emulator #test -sysdir C:\Android\system-images\android-26\google_apis_playstore\x86 -datadir C:\Android\avd
but I get the same errors.
When I run command avdmanager.bat list avd, I get:
Name: test
Path: C:\Android\avd\test.avd
Target: Google Play (Google Inc.)
Based on: Android API 26 Tag/ABI: google_apis_playstore/x86
Why on earth can't I run the AVD?
I found the problem. Because I was trying to do a minimal Android SDK install via the command line, I did not yet have a platform-tools folder. Not being able to find the platform-tools folder was causing the emulator to display the unhelpful error "can't find SDK installation directory", which really meant "can't find the platform-tools directory".
Once I installed the platform-tools folder with sdkmanager --no_https "platform-tools", the emulator worked. I need --no_https because I'm in a crippled corporate environment.
For future reference, I installed the emulator dependencies (after unzipping sdk-tools-windows-3859397.zip from here) with:
sdkmanager --no_https "system-images;android-26;google_apis_playstore;x86" "platforms;android-26" "platform-tools" "emulator"
With the package "platform-tools", it may also required to install "platforms;android-26" for your Android 26.
Using sdkmanager.bat platforms;android-30 --sdk_root=C:\your_avd_sdk_root to install it.
If still not working, try to run command below:
set PATH=%PATH%;%ANDROID_SDK_ROOT%\emulator
set PATH=%PATH%;%ANDROID_SDK_ROOT%\emulator\bin64
set PATH=%PATH%;%ANDROID_SDK_ROOT%\platform-tools
set PATH=%PATH%;%ANDROID_SDK_ROOT%\cmdline-tools\latest\bin
I was trying to install Android SDK with the help of the SDK command line tools downloaded from the link https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
on my Linux Ubuntu 16.04 PC.
i run the command following command for installation
./android update sdk
but the installation has stopped and gave the following message on terminal
------------------------------------------------------------------------------------------------------------------------------------
The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager
"android" SDK commands can be translated to sdkmanager commands on a best-effort basis.
Continue? (This prompt can be suppressed with the--use-sdk-wrapper command-line argument or by setting the USE_SDK_WRAPPER environment variable) [y/N]: y
Running /home/user/Android/Sdk/bin/sdkmanager --update
Warning: java.net.SocketException: Connection reset
Warning: Failed to download any source lists!
Done
-----------------------------------------------------------------------------------------------------------------------------------
how to solve this error.or suggest me a way to install android sdk on my linux pc without installing android studio.
A bit late, but in the same situation. It looks like this isn't an error, but the way the tools evolved: they are pushing users to use Android Studio if they want the GUI for the sdk manager, it's usable only from the IDE.
You still have the command line available at bin/sdkmanager in this folder from the download, and instructions can be found here, but they are not great, either, so I'll share what I did:
downloaded the latest compressed file from this page (link way down there)
unzipped somewhere (I chose /opt/Android/android-sdk)
created a symlink to add sdkmanager to my path (ln -s /opt/Android/android-tools/bin/sdkmanager ~/.local/bin/sdkmanager)
installed platform tools and build tools for kitkat and up using sdkmanager "platform-tools" "platforms;android-19" "build-tools;19.1.0" (sudo may be needed)
You can check the versions available using sdkmanager --list, and figure what you need to support and download tools for other versions. The download will not show any kind of progress, it'll only tell you it's done after a while.
I suppose it's not a big deal to keep Android Studio installed solely to have access to the sdk manager GUI, but I'll make do with the command line tools. That's very shady of Google, specially to people not really into their hacked up Intellij version.