0

I downloaded from this page the file commandlinetools-linux-9477386_latest.zip I can't find there the android command for creating new projects from command line. I created a few small such projects about 10 years ago. Where is the android command now? It was in the tools directory before.

$ sdkmanager --list
[=======================================] 100% Computing updates...             
Installed packages:
  Path                 | Version | Description                | Location            
  -------              | ------- | -------                    | -------             
  build-tools;31.0.0   | 31.0.0  | Android SDK Build-Tools 31 | build-tools/31.0.0  
  platform-tools       | 34.0.1  | Android SDK Platform-Tools | platform-tools      
  platforms;android-31 | 1       | Android SDK Platform 31    | platforms/android-31
  sources;android-31   | 1       | Sources for Android 31     | sources/android-31  

$ tree -L 5 -d src/
src/
└── Android
    └── SDK
        ├── build-tools
        │   └── 31.0.0
        │       ├── lib
        │       ├── lib64
        │       ├── lld-bin
        │       └── renderscript
        ├── cmdline-tools
        │   ├── latest
        │   │   ├── bin
        │   │   └── lib
        │   └── tools
        │       ├── bin
        │       └── lib
        ├── licenses
        ├── platforms
        │   └── android-31
        │       ├── data
        │       ├── optional
        │       ├── skins
        │       └── templates
        ├── platform-tools
        │   └── lib64
        └── sources
            └── android-31
                ├── android
                ├── androidx
                ├── benchmarks
                ├── com
                ├── java
                ├── javax
                ├── jdk
                ├── jsr166
                ├── junit
                ├── mypackage
                ├── org
                ├── perftests
                └── tck
xralf
  • 3,312
  • 45
  • 129
  • 200
  • 1
    The tools you are searching are no longer compatible with recent Java versions (Java 9+). Finally they seem to be removed from Android SDK – Robert Apr 28 '23 at 23:22

2 Answers2

1

Use the sdkmanager command line to install build tools and platform tools

Once it is completed add the platform-tools and tools directory to PATH

You can manually download platform-tools

You can manually download emulator also

In case tools is missing that means it is obsolete then you need to add --include_obsolete

you can install emulator like this sdkmanager --channel=3 emulator or --channel=0 or --channel=2 or --channel=1 same applicable while installing tools

Example sdkmanager --channel=3 tools --include_obsolete

Another Example

./sdkmanager.bat --channel=3 tools --include_obsolete --verbose

You will get output like this

Info: Preparing "Install Android SDK Tools (revision: 26.1.1)".
Info: "Install Android SDK Tools (revision: 26.1.1)" ready.
Info: Installing Android SDK Tools in C:\MyFiles\android-sdk-windows\tools
[=======================================] 100% Unzipping... tools/support/typos-
Info: "Install Android SDK Tools (revision: 26.1.1)" complete.
Info: "Install Android SDK Tools (revision: 26.1.1)" finished.
Dickens A S
  • 3,824
  • 2
  • 22
  • 45
  • I have this error when writing `$ sdkmanager "tools" Warning: Dependant package with key emulator not found! Warning: Unable to compute a complete list of dependencies. ` – xralf Apr 28 '23 at 18:38
  • `$ sdkmanager "platform-tools"` works but `$ sdkmanager "tools"` doesn't work. – xralf Apr 28 '23 at 18:41
  • `build-tools;latest` or `build-tools;34.0.0` or `platforms;android-33` – Dickens A S Apr 28 '23 at 18:43
  • I don't understand what's wrong. I updated the question, so you can see what is already installed. – xralf Apr 28 '23 at 18:48
  • try like this `sdkmanager --install 'build-tools' 'platform-tools' 'platforms;android-33' 'tools'` – Dickens A S Apr 28 '23 at 18:50
  • or simply do `sdkmanager --install 'tools'` – Dickens A S Apr 28 '23 at 18:52
  • Both end with error message `Warning: Failed to find package 'build-tools'` or `Warning: Dependant package with key emulator not found! Warning: Unable to compute a complete list of dependencies. ` – xralf Apr 28 '23 at 18:53
  • do this `sdkmanager --install 'emulator'` and `sdkmanager --install 'tools'` – Dickens A S Apr 28 '23 at 18:54
  • `$ sdkmanager --install 'emulator' Warning: Failed to find package 'emulator'` – xralf Apr 28 '23 at 18:55
  • try `--channel=3` or `--channel=0` or `--channel=2` or `--channel=1` with above command line, try `--no_https` – Dickens A S Apr 28 '23 at 18:59
  • you can manually download the emulator archive zip file and use `sdkmanager --package_file=package_file` – Dickens A S Apr 28 '23 at 19:01
  • if you are behind proxy you need to use `--proxy_host` and `--proxy_port` – Dickens A S Apr 28 '23 at 19:06
  • I'm not behind proxy, I installed something, but I can't install `tools`. – xralf Apr 28 '23 at 19:08
  • `tools` is obelete use `--include_obsolete` – Dickens A S Apr 28 '23 at 19:17
  • `$ sdkmanager --include_obsolete 'tools' Warning: Dependant package with key emulator not found! Warning: Unable to compute a complete list of dependencies. ` – xralf Apr 28 '23 at 19:23
  • `sdkmanager --install 'tools' --include_obsolete` will be the command, but it is only a warning I think it got installed – Dickens A S Apr 28 '23 at 19:26
  • There is a warning as well. I will paste to the question my directory structure so far. – xralf Apr 28 '23 at 19:29
  • you can install emulator like this `sdkmanager --channel=3 emulator` or `--channel=0` or `--channel=2` or `--channel=1` same applicable while installing tools – Dickens A S Apr 28 '23 at 19:29
  • If tools is obsolete, I could use new alternative instead. Where did you find it and what is new alternative? – xralf Apr 28 '23 at 19:36
  • i found [this](https://stackoverflow.com/a/59907256/653379) and downloaded `sdk-tools-linux.zip`, but don't know where in my directory structure should I unpack it. – xralf Apr 28 '23 at 19:40
  • worst case, Try it from android studio, usually the Sdk located in home folder `C:\Users\username\AppData\Local\Android\Sdk` for linux it will be `~/Android/Sdk` – Dickens A S Apr 28 '23 at 19:58
1

The now obsolete android tool (for replacements per functionality see its documentation) is part of the likewise obsolete Android SDK Tools (replaced by Android SDK Command-line Tools, which you have downloaded).

Nevertheless, the site androidsdkoffline.blogspot.com mirrors everything related to the Android SDK from past and present, inter alia downloads and installation guidance for the obsolete Android SDK Tools.

In short -- To use the android tool you have to downgrade, so:

  1. Remove your installation of the Android SDK Command-line Tools.
  2. Install the (obsolete) Android SDK Tools.

NB: Don't mix up all the "Tools" packages, they all contain different stuff. The very first thing to install is either the old Android SDK Tools or the new Android SDK Command-line Tools. Only then one installs the Build Tools and the Platform Tools. For an overview see the Stackoverflow Post on "Command-Line based Development Environments for Building and Debugging Android Applications".

Krokomot
  • 3,208
  • 2
  • 4
  • 20