0

I am tring to create an AVD to use for flutter using cmdline-tools. I tried:

avdmanager create avd -n test -k "system-images;android-30;google_apis;x86_64"

It returns:

Error: Package path is not valid. Valid system image paths are:ository...
null

I have already set the ANDROID_SDK_ROOT environment variable, installed the system image of android-30 using sdkmanager and accepted all licences.

for more info:

cd %ANDROID_SDK_ROOT%

C:\Users\ASUS\AppData\Local\Android\Sdk>dir
 Volume in drive C is OS
 Volume Serial Number is 9C47-3391

 Directory of C:\Users\ASUS\AppData\Local\Android\Sdk

08/02/2022  09:44 PM    <DIR>          .
08/02/2022  09:44 PM    <DIR>          ..
08/02/2022  09:08 PM    <DIR>          .temp
09/13/2017  08:55 PM             5,778 android.bat
08/02/2022  03:01 PM    <DIR>          build-tools
08/02/2022  09:02 PM    <DIR>          cmdline-tools
08/02/2022  04:03 PM    <DIR>          emulator
08/02/2022  09:20 PM    <DIR>          emulator-2
08/02/2022  09:44 PM    <DIR>          emulator-3
09/13/2017  08:55 PM           636,928 emulator-check.exe
09/13/2017  08:55 PM           809,984 emulator.exe
08/02/2022  09:38 PM    <DIR>          extras
07/30/2022  03:42 PM    <DIR>          lib
08/02/2022  02:57 PM    <DIR>          licenses
09/13/2017  08:55 PM           239,821 mksdcard.exe
09/13/2017  08:55 PM               947 monitor.bat
09/13/2017  08:55 PM           829,319 NOTICE.txt
08/02/2022  09:44 PM    <DIR>          patcher
07/30/2022  05:42 PM    <DIR>          platform-tools
08/02/2022  09:44 PM    <DIR>          platforms
07/30/2022  11:00 PM    <DIR>          skins
09/13/2017  08:55 PM               138 source.properties
07/30/2022  03:42 PM    <DIR>          support
08/02/2022  03:13 PM    <DIR>          system-images
               7 File(s)      2,522,915 bytes
              17 Dir(s)  157,366,505,472 bytes free

C:\Users\ASUS\AppData\Local\Android\Sdk>tree system-images
Folder PATH listing for volume OS
Volume serial number is 00000237 9C47:3391
C:\USERS\ASUS\APPDATA\LOCAL\ANDROID\SDK\SYSTEM-IMAGES
└───android-30
    ├───google_apis
    │   ├───x86
    │   │   ├───.installer
    │   │   └───data
    │   │       ├───misc
    │   │       │   ├───apns
    │   │       │   ├───emulator
    │   │       │   │   └───config
    │   │       │   └───wifi
    │   │       └───system
    │   └───x86_64
    │       └───data
    │           ├───misc
    │           │   ├───apns
    │           │   ├───emulator
    │           │   │   └───config
    │           │   ├───gceconfigs
    │           │   └───wifi
    │           └───system
    └───google_apis_playstore
        └───x86
            └───data
                ├───misc
                │   ├───apns
                │   ├───emulator
                │   │   └───config
                │   └───wifi
                └───system

I trying to avoid repeating all these installations. I tried running this command sdkmanager --list_installed to check what is installed already so as not to install it again:

[=======================================] 100% Fetch remote repository...

This is weird because I have just downloaded "extras;google;usb_drive". I guess sdkmanager cannot see sdk packages. I checked %User%\.android\repositories.cfg file and it was empty.

Any ideas?

Elletlar
  • 3,136
  • 7
  • 32
  • 38
saad zahem
  • 13
  • 5

1 Answers1

0

I sent everything to recycle bin and installed cmdline-tools again to start from zero point. But this time I avoided errors as I could, Making sure to set environment variables correctly as described here, And but the tools in the correct directory %ANDROID_HOME%\cmdline-tools\7.0 where 7.0 is the version of the tools, we can get it from running sdkmanager --version or from source.properties file.

That worked for me. I tried installing some little stuff and run sdkmanager --list_installed again to get this:

Installed packages:=====================] 100% Fetch remote repository...
  Path       | Version | Description          | Location
  -------    | ------- | -------              | -------
  emulator   | 31.2.10 | Android Emulator     | emulator
  patcher;v4 | 1       | SDK Patch Applier v4 | patcher\v4

I tried manual download and restoring from recycle bin and both worked!

But what was the real problem? Well, It's due to the mess in the sdk directory where I can find many bin folders, so it was a good idea to reset everything. another reason could be the environments variables so thanks to this answer again.

saad zahem
  • 13
  • 5