Skip to content

Instantly share code, notes, and snippets.

@xinthink
Last active July 4, 2016 19:47
Show Gist options
  • Save xinthink/b893b236f6f3bbb32285 to your computer and use it in GitHub Desktop.
Save xinthink/b893b236f6f3bbb32285 to your computer and use it in GitHub Desktop.
Using ig-json-parser in android studio gradle build script.
apply plugin: 'com.android.library'
ext {
generatedSourcesDir = file 'gen/main/java'
}
android {
compileSdkVersion XX
buildToolsVersion "XX"
defaultConfig {
minSdkVersion XX
}
sourceSets {
main {
java {
srcDir generatedSourcesDir
}
}
}
}
// generate json parsers http://bit.ly/ZgSkOh
tasks.withType(Compile) {
doFirst {
// regenerate all files
if (generatedSourcesDir.exists()) {
generatedSourcesDir.deleteDir()
}
generatedSourcesDir.mkdirs()
}
options.compilerArgs += [
'-processor',
'com.instagram.common.json.annotation.processor.JsonAnnotationProcessor',
'-s',
generatedSourcesDir
]
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.instagram:ig-json-parser-processor:0.0.4+'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment