Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to find package 'emulator' #137

Open
ghost opened this issue Nov 9, 2021 · 3 comments
Open

Failed to find package 'emulator' #137

ghost opened this issue Nov 9, 2021 · 3 comments

Comments

@ghost
Copy link

ghost commented Nov 9, 2021

I try to run this on an MacBook Pro M1 using Gradle 7.2 and Android SDK Build-Tools 31.0.0 together with the latest Android SDK Command-line Tools.

In Android Studio 2020.3.1 Patch 3 I can start and use the emulator.

But running waitForAndroidEmulator gives me this:

> Task :android:ensureBaseSdkPermissionsForAndroidEmulatorPlugin

> Task :android:installSdkDependenciesForAndroidEmulatorPlugin
Loading package information...                                                  
Loading local repository...                                                     
[                                       ] 3% Loading local repository...        
[                                       ] 3% Fetch remote repository...         
[=                                      ] 3% Fetch remote repository...         
[=                                      ] 4% Fetch remote repository...         
[=                                      ] 4% Fetch remote repository... Fetching
[=                                      ] 4% Downloading sys-img.xml... Fetching
[=                                      ] 4% Downloading sys-img.xml... Validate
[=                                      ] 4% Downloading sys-img.xml... Parse XM
[=                                      ] 4% Downloading sys-img.xml... Fetching
[=                                      ] 4% Downloading sys-img.xml... Validate
[=                                      ] 4% Downloading sys-img.xml... Parse XM
[=                                      ] 5% Downloading sys-img.xml... Parse XM
[==                                     ] 5% Downloading sys-img.xml... Parse XM
[==                                     ] 6% Downloading sys-img.xml... Parse XM
[==                                     ] 7% Downloading sys-img.xml... Parse XM
[===                                    ] 8% Downloading sys-img.xml... Parse XM
[===                                    ] 8% Computing updates... Parse XML:    
[===                                    ] 8% Computing updates...               
[===                                    ] 10% Computing updates...              
                                                                                
[===                                    ] 10% Computing updates...              Warning: Failed to find package 'emulator'

> Task :android:installSdkDependenciesForAndroidEmulatorPlugin FAILED
> Task :android:addAdditionalSdkRepositoriesForAndroidEmulatorPlugin

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':android:installSdkDependenciesForAndroidEmulatorPlugin'.
> Process 'command '/Users/stefan/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 12s

My configuration:

androidEmulator {

    emulator {
        name("pixel_api_31")
        device("pixel_4")
        sdkVersion(31)
        abi("arm64")
        includeGoogleApis(true)
    }

    enableForAndroidTests(true)
    avdRoot(file("~/.android/avd"))
    headless(false) // true for CI
    additionalEmulatorArguments(listOf("-no-snapshot", "-wipe-data"))
    logEmulatorOutput(true)
}
@quittle
Copy link
Owner

quittle commented Nov 9, 2021

Thanks for the bug report. I suspect that Android had renamed the tool, again *shakes fist at sky*. I'll try and take a look at fixing this some time this week.

You may be able to unblock yourself for now by downgrading to an older Android SDK Command-line Tools version.

@quittle
Copy link
Owner

quittle commented Nov 17, 2021

Hmm, I'm not sure what could be going on here. A couple of things might help me debug this for you.

  1. Could you run with the --debug flag to see if you get any more relevant output from the execution? I'm not sure if you will be able to see more about what failed.
  2. If you run /Users/stefan/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager emulator, what happens? Does that succeed in installing the emulator?

@ghost
Copy link
Author

ghost commented Nov 17, 2021

Thank you for looking into this.

Running the command gave me this:

stefan@MBP-von-Stefan ~ % /Users/stefan/Library/Android/sdk/cmdline-tools/latest/bin/sdkmanager emulator
[==========                             ] 27% Downloading emulator-darwin_aarch6

So I guess that emulator problem was temporary.
Maybe some one on Googles site defined that emulator resolves into emulator-darwin_aarch6 for M1 systems in the mean time?

After that the error message changed to Warning: Failed to find package 'system-images;android-31;google_apis;arm64'

With trial & error I found out that arm64 seems to be an illegal value.
For Apple M1 it needs to be abi("arm64-v8a") - it displays arm64 in the GUI, but that seems to be only a short name.

You could improve your plugin by accepting only a range of valid values for the ABI and display the valid values to prevent problems like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant