Skip to content

Instantly share code, notes, and snippets.

@JakeWharton
Created July 19, 2014 00:17
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save JakeWharton/e8a3685feb6a94b23393 to your computer and use it in GitHub Desktop.
Save JakeWharton/e8a3685feb6a94b23393 to your computer and use it in GitHub Desktop.
Adding support-annotations jar to a Java module.
apply plugin: 'java'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
for (File file : sdkHandler.sdkLoader.repositories) {
project.repositories.maven {
url = file.toURI()
}
}
dependencies {
compile 'com.android.support:support-annotations:20.0.0'
compile 'com.google.guava:guava:17.0'
compile 'com.squareup:javawriter:2.5.0'
testCompile 'junit:junit:4.11'
testCompile 'com.google.testing.compile:compile-testing:0.5'
}
@fabiocarballo
Copy link

Hi! Is there any way I can use this? My build.gradle file doesn't recognize neither the LoggerWrapper nor the SdkHandler. I'm trying to do a java test module based on Robolectric and square's assert-j android, but I need to testCompile the 'com.android.support:support-annotations:20.0.0'

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