Created
November 25, 2019 08:06
-
-
Save TurpIF/5a529a668b28c88407b873b055cc4945 to your computer and use it in GitHub Desktop.
Gradle Android project with tests in dedicated subproject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Lib build file | |
android { | |
buildTypes { | |
release { | |
minifyEnabled true | |
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Top-level build file where you can add configuration options common to all sub-projects/modules. | |
buildscript { | |
repositories { | |
google() | |
jcenter() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:3.5.2' | |
// NOTE: Do not place your application dependencies here; they belong | |
// in the individual module build.gradle files | |
} | |
} | |
allprojects { | |
repositories { | |
google() | |
jcenter() | |
} | |
} | |
subprojects { | |
apply plugin: 'com.android.library' | |
android { | |
compileSdkVersion 27 | |
defaultConfig { | |
minSdkVersion 16 | |
targetSdkVersion 27 | |
versionCode 1 | |
versionName "1.0" | |
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" | |
} | |
compileOptions { | |
sourceCompatibility 1.8 | |
targetCompatibility 1.8 | |
} | |
} | |
dependencies { | |
implementation 'com.android.support:appcompat-v7:27.1.1' | |
} | |
} | |
task clean(type: Delete) { | |
delete rootProject.buildDir | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Tests build file | |
android { | |
defaultConfig { | |
multiDexEnabled true | |
} | |
} | |
dependencies { | |
implementation project(path: ':lib') | |
testImplementation 'junit:junit:4.12' | |
androidTestImplementation 'com.android.support.test:runner:1.0.2' | |
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' | |
androidTestImplementation group: 'org.mockito', name: 'mockito-android', version: '3.1.0' | |
androidTestImplementation group: 'org.assertj', name: 'assertj-core', version: '3.14.0' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment