JakeWharton / sdk-manager-plugin

DEPRECATED Gradle plugin which downloads and manages your Android SDK.
Apache License 2.0
1.41k stars 142 forks source link

Fails on first run, works on second #47

Open cwc opened 9 years ago

cwc commented 9 years ago

I get the output below on the first attempt to build in a clean CI environment. If I run the same command immediately afterward, it works fine. ANDROID_HOME is unset.

jenkins@vagrant-ubuntu-trusty-64:~/android-project-src$ ./gradlew clean build
Android SDK not found. Downloading...
SDK extracted at '/home/jenkins/.android-sdk'. Writing to local.properties.
Build tools 19.1.0 missing. Downloading...
Platform tools missing. Downloading...
Compilation API android-20 missing. Downloading...

FAILURE: Build failed with an exception.

* Where:
Build file '/home/jenkins/android-project-src/TheProject/build.gradle' line: 49

* What went wrong:
A problem occurred evaluating project ':TheProject'.
> failed to find target android-20 : /home/jenkins/.android-sdk

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

BUILD FAILED

Total time: 2 mins 39.025 secs
artem-zinnatullin commented 9 years ago

I think it's okay, seems that Gradle trying to find dependencies before the sdkmanager plugin downloads them, so it will fail the build even if sdkmanager plugin will get required dependencies.

I faced same problem, when I wanted to change appVersion in one of my gradle tasks, but it was initialized by gradle before running any task.. 22 авг. 2014 г. 3:55 пользователь "Cameron Currie" notifications@github.com написал:

I get the output below on the first attempt to build in a clean CI environment. If I run the same command immediately afterward, it works fine. ANDROID_HOME is unset.

jenkins@vagrant-ubuntu-trusty-64:~/android-project-src$ ./gradlew clean build Android SDK not found. Downloading... SDK extracted at '/home/jenkins/.android-sdk'. Writing to local.properties. Build tools 19.1.0 missing. Downloading... Platform tools missing. Downloading... Compilation API android-20 missing. Downloading...

FAILURE: Build failed with an exception.

  • Where: Build file '/home/jenkins/android-project-src/TheProject/build.gradle' line: 49
  • What went wrong: A problem occurred evaluating project ':TheProject'.

    failed to find target android-20 : /home/jenkins/.android-sdk

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2 mins 39.025 secs

— Reply to this email directly or view it on GitHub https://github.com/JakeWharton/sdk-manager-plugin/issues/47.

daj commented 9 years ago

Does anybody know a workaround for this issue? It causes my CI a lot of pain. I think this hits me whenever my cloud based Jenkins provider (CloudBees) creates new slave images.

calren commented 9 years ago

Sam as @daj , I'm seeing this problem and don't know how to resolve it for CI purposes. Any pointers?

daj commented 9 years ago

I posted a workaround that you can use if you hit this issue: http://stackoverflow.com/a/28777153/112705

rohans310 commented 9 years ago

Hi @calren Did you find a workaround? I'm facing this issue on Jenkins.

calren commented 9 years ago

@rohans310 try using https://github.com/JakeWharton/sdk-manager-plugin, it solved my problem

rohans310 commented 9 years ago

@calren I am using this plugin. I get this error -

Build tools 22.0.0 missing. Downloading... Compilation API android-22 missing. Downloading... Support library repository missing. Downloading... Google Play Services repository missing. Downloading... Package resolve took 10253 ms.

FAILURE: Build failed with an exception.

What went wrong: A problem occurred configuring project ':app'. failed to find target android-22 : /usr/local/android-sdk

Seems like it is downloading the dependencies, but still giving me this error. any ideas?

ghost commented 8 years ago

For a few days, I encountered some problems with sdk-manager-plugin on my Jenkins CI.

sdk-manager-plugin failed on ~/.android-sdk directory and sub dirs in Jenkins home. I obviously checked the user rights and the jenkins user execution context. No problem from this part. No problem on my workstation too.

Any idea about this issue?