Используйте как показано ниже:
dependencies.gradle
* * 1004
ext {
versions = [
// For project configuration
java : JavaVersion.VERSION_1_8,
compileSdk : 28,
targetSdk : 28,
minSdk : 21,
buildTools : '28.0.2',
dokka : '0.9.16',
// For app
kotlin : '1.2.61',
coroutine : '0.24.0',
appCompat : '1.0.0-beta01',
recyclerview : '1.0.0-beta01',
constraintLayout : '2.0.0-alpha1',
cardview : '1.0.0-beta01',
browser : '1.0.0-beta01',
androidKtx : '1.0.0-beta01',
dagger : '2.16',
firebaseCloudMessage : '17.1.0',
firebaseAnalytics : '16.0.3',
playServices : '15.0.1',
exoPlayer : '2.8.2',
flexbox : '1.0.0',
material : '1.0.0-beta01',
room : '2.0.0-beta01',
lifecycle : '2.0.0-beta01',
rxKotlin : '2.2.0',
rxAndroid : '2.0.2',
moshi : '1.6.0',
okhttp : '3.11.0',
timber : '4.7.1',
threeTenABP : '1.1.0',
rxBinding : '2.1.1',
fresco : '1.10.0',
kotshi : '1.0.4',
frescoImageViewer : '0.5.1',
markwon : '1.1.0',
aVLoadingIndicatorView: '2.1.3',
glide : '4.8.0-SNAPSHOT',
// For wearable
wear : '2.3.0',
playServicesWearable : '15.0.1',
supportWearable : '27.1.1',
// For testing
junit : '4.12',
truth : '0.42',
espresso : '3.1.0-alpha4',
mockito : '2.21.0'
]
libraries = [
.....
.....
// For testing
junit : "junit:junit:${versions.junit}",
espressoCore : "androidx.test.espresso:espresso-core:${versions.espresso}",
espressoIntents : "androidx.test.espresso:espresso-intents:${versions.espresso}",
roomTest : "android.arch.persistence.room:testing:${versions.room}",
truth : "com.google.truth:truth:${versions.truth}"
]
}
А build.gradle(project...
:
buildscript {
apply from: rootProject.file('dependencies.gradle')
repositories {
jcenter()
google()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-rc02'
classpath 'com.google.gms:google-services:4.1.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
apply from: rootProject.file('dependencies.gradle')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
А build.gradle(Module...
:
apply plugin: 'com.android.application'
repositories {
jcenter()
}
android {
compileSdkVersion 28
defaultConfig {
applicationId "ww.ww.ww"
minSdkVersion 16
targetSdkVersion 28
versionCode 13
versionName "2.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
....
}
....
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:2.0.0-alpha2'
implementation 'com.android.support:exifinterface:28.0.0-rc02'
implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
implementation 'com.android.support:recyclerview-v7:28.0.0-rc02'
implementation 'com.android.support:cardview-v7:28.0.0-rc02'
implementation 'com.android.support:design:28.0.0-rc02'
implementation 'com.android.support:support-vector-drawable:28.0.0-rc02'
implementation 'com.android.support:multidex:1.0.3'
//espresso
testImplementation libraries.junit
testImplementation libraries.truth
androidTestImplementation libraries.espressoCore
androidTestImplementation libraries.espressoIntents
...
}
Обратите внимание на эту строку:
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"