Skip to content

Instantly share code, notes, and snippets.

@Morgazmo
Created May 22, 2018 07:39
Show Gist options
  • Save Morgazmo/0d814a47f23d2abebf79913a3b1090f6 to your computer and use it in GitHub Desktop.
Save Morgazmo/0d814a47f23d2abebf79913a3b1090f6 to your computer and use it in GitHub Desktop.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
// Define versions in a single place
ext {
// Sdk and tools
// Support library and architecture components support minSdk 14 and above.
minSdkVersion = 14
targetSdkVersion = 26
compileSdkVersion = 26
buildToolsVersion = '26.0.2'
// App dependencies
supportLibraryVersion = '26.1.0'
guavaVersion = '22.0-android'
junitVersion = '4.12'
mockitoVersion = '1.10.19'
powerMockito = '1.6.2'
hamcrestVersion = '1.3'
runnerVersion = '1.0.1'
rulesVersion = '1.0.1'
espressoVersion = '3.0.1'
// Architecture Components dependencies
roomVersion = "1.0.0"
archLifecycleVersion = "1.0.0-rc1"
}
/*
* Workaround for https://code.google.com/p/android/issues/detail?id=182715
*
* The Android Gradle plugin is creating DataBindingExportBuildInfoTasks for the instrumentation
* APK that generates from the app APKs layouts. This creates duplicate classes in the app and
* instrumentation APK which leads to
* java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation
* on older devices.
*
* The workaround is to get the DataBindingExportBuildInfoTasks tasks for the instrumentation APK
* and delete the files right after it creates them.
*/
subprojects {
tasks.withType(com.android.build.gradle.internal.tasks.databinding.DataBindingExportBuildInfoTask) { task ->
if (task.name.endsWith("AndroidTest")) {
task.finalizedBy(tasks.create("${task.name}Workaround") << {
task.output.deleteDir()
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment