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

Plugin expects an availability of the Android SDK #300

Open
smidf opened this issue Apr 7, 2022 · 2 comments
Open

Plugin expects an availability of the Android SDK #300

smidf opened this issue Apr 7, 2022 · 2 comments

Comments

@smidf
Copy link

smidf commented Apr 7, 2022

Expected behaviour

The Gradle Configuration phase is completed without error in an environment without the Android SDK.

Actual behaviour

The Shot plugin uses com.android.build.gradle.BaseExtension.getAdbExe property in afterEvaluate block.

...
Caused by: com.android.builder.errors.EvalIssueException: SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '<PROJECT_ROOT>/local.properties'.
	at com.android.builder.errors.IssueReporter.reportError(IssueReporter.kt:109)
	at com.android.builder.errors.IssueReporter.reportError$default(IssueReporter.kt:105)
	at com.android.build.gradle.internal.SdkLocator.getSdkLocation(SdkLocator.kt:239)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy.loadSdkComponents(SdkDirectLoadingStrategy.kt:97)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy.init(SdkDirectLoadingStrategy.kt:92)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy.access$init(SdkDirectLoadingStrategy.kt:46)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy$components$2.invoke(SdkDirectLoadingStrategy.kt:71)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy$components$2.invoke(SdkDirectLoadingStrategy.kt:70)
	at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy.getComponents(SdkDirectLoadingStrategy.kt:70)
	at com.android.build.gradle.internal.SdkDirectLoadingStrategy.loadedSuccessfully(SdkDirectLoadingStrategy.kt:178)
	at com.android.build.gradle.internal.SdkLoadingStrategy.getAdbExecutable(SdkLoadingStrategy.kt:29)
	at com.android.build.gradle.internal.SdkComponentsBuildService$VersionedSdkLoader$adbExecutableProvider$1.call(SdkComponents.kt:189)
	at com.android.build.gradle.internal.SdkComponentsBuildService$VersionedSdkLoader$adbExecutableProvider$1.call(SdkComponents.kt:189)
	at org.gradle.api.internal.provider.DefaultProvider.calculateOwnValue(DefaultProvider.java:66)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
	at org.gradle.api.internal.provider.TransformBackedProvider.calculateOwnValue(TransformBackedProvider.java:64)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
	at org.gradle.api.internal.provider.MappingProvider.calculateOwnValue(MappingProvider.java:55)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
	at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:128)
	at org.gradle.api.internal.provider.DefaultProperty.calculateValueFrom(DefaultProperty.java:26)
	at org.gradle.api.internal.provider.AbstractProperty.doCalculateValue(AbstractProperty.java:133)
	at org.gradle.api.internal.provider.AbstractProperty.calculateOwnValue(AbstractProperty.java:127)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.calculateValue(AbstractMinimalProvider.java:103)
	at org.gradle.api.internal.provider.FlatMapProvider.calculateOwnValue(FlatMapProvider.java:50)
	at org.gradle.api.internal.provider.AbstractMinimalProvider.get(AbstractMinimalProvider.java:84)
	at com.android.build.gradle.BaseExtension.getAdbExecutable(BaseExtension.kt:423)
	at com.android.build.gradle.BaseExtension.getAdbExe(BaseExtension.kt:430)
	at com.android.build.gradle.BaseExtension$getAdbExe.call(Unknown Source)
	at com.karumi.shot.AdbPathExtractor.extractPath(AdbPathExtractor.groovy:9)
	at com.karumi.shot.ShotPlugin.configureAdb(ShotPlugin.scala:57)
	at com.karumi.shot.ShotPlugin.$anonfun$apply$1(ShotPlugin.scala:50)
...

Steps to reproduce

  1. Integrate Shot plugin
  2. "Hide" Android SDK (delete local.properties file and unset ANDROID_HOME or ANDROID_SDK_ROOT environment variables)
  3. Run ./gradlew

Version of the library

Shot Gradle plugin in version 5.13.0

@tobiasKaminsky
Copy link
Contributor

We have the same problem, when we try to run renovate:

ommand failed: ./gradlew --console=plain --dependency-verification lenient -q --write-verification-metadata sha256,pgp help

FAILURE: Build completed with 3 failures.

1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':app'.
> SDK location not found. Define a valid SDK location with an ANDROID_HOME environment variable or by setting the sdk.dir path in your project's local properties file at '/tmp/renovate/repos/github/nextcloud/android/local.properties'.

(e.g. nextcloud/android#12496)

Disabling the plugin would work, but also defeats the purpose of dependency metadata a bit.

@tobiasKaminsky
Copy link
Contributor

I just checked and it seems that it is "only" needed for adb.
https://github.com/pedrovgs/Shot/blob/master/shot/src/main/groovy/com/karumi/shot/AdbPathExtractor.groovy#L9

It could be changed that first is checked if ADB exists in $PATH.
(I doubt this will help in my case, but at least then a separate adb installation is possible).

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

No branches or pull requests

3 participants