1

hello im using android studio and i want to integrate roboelectric here is my 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'

heree is my error of build

Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve org.robolectric:robolectric:4.0-alpha-2.

Open File Show Detailsenter image description here

Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve org.robolectric:robolectric:4.0-alpha-2. Open File Show Details

enter image description here

2 Answers2

1

You're trying to load a snapshot version. You probably want the release version.

Simply change the testImplementation line to:

testImplementation 'org.robolectric:robolectric:3.8'

If you know what you're doing and are sure you want to use the snapshot version (which is potentially unstable and not recommended unless absolutely necessary) you'll have to add a couple more things.

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
    testCompile "org.robolectric:robolectric:4.0-alpha-3-SNAPSHOT"
}
Sub 6 Resources
  • 1,674
  • 15
  • 31
0

In my case gradle offline mode was enable

Be sure to disable gradle offline mode in settings. Steps to disable gradle offline mode

  1. Go to File > Settings
  2. Select Gradle under **Build, Execution & Deployment*
  3. Uncheck Offline work under Global Gradle Settings
  4. Click Apply button

In offline mode gradle will not download library and will give same error even if you are connected to internet.

Deep Nishad
  • 181
  • 1
  • 2
  • 7