您好,我正在使用android studio,并且我想集成roboelectric,这是我的build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
///////////
applicationId "com.inducesmile.androidmapdrawroute"
///////////////
applicationId "com.application.zarbagaskazay.colivoiturage"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
dependencies {
///////////////////////firebase//////////
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
///////////////////
implementation 'com.android.support:multidex:1.0.0'
implementation 'com.dropbox.core:dropbox-core-sdk:3.0.8'
implementation 'com.google.code.gson:gson:2.8.4'
implementation "com.github.danielnilsson9:color-picker-view:1.4.0@aar"
implementation 'com.android.support:palette-v7:27.1.1'
implementation 'com.android.volley:volley:1.0.0'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
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'
implementation 'com.android.support:gridlayout-v7:27.1.1'
////////// google directions //////////////////////////////// google directions //////////////////////
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.maps.android:android-maps-utils:0.4+'
///////////////////////// card view ////////////////
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'org.robolectric:robolectric:4.0-alpha-2'
}
apply plugin: 'com.google.gms.google-services'
这是我的构建错误
Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve org.robolectric:robolectric:4.0-alpha-2.
无法解析':app @ releaseUnitTest / compileClasspath'的依赖关系:无法解析org.robolectric:robolectric:4.0-alpha-2。 打开文件 显示详细信息
答案 0 :(得分:1)
您正在尝试加载快照版本。您可能需要发行版本。
只需将testImplementation
行更改为:
testImplementation 'org.robolectric:robolectric:3.8'
如果您知道自己在做什么,并且确定要使用快照版本(该快照版本可能不稳定,除非绝对必要,否则不建议使用),您将不得不添加更多内容。
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
testCompile "org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT"
}
答案 1 :(得分:0)
就我而言,启用了分级离线模式
确保在设置中禁用Gradle离线模式。禁用Gradle离线模式的步骤
在离线模式下,gradle不会下载库,即使您已连接到Internet,也会给出相同的错误。