Robolectric: Resources$NotFoundException: String resource ID with Android Gradle Plugin 3

后端 未结 8 1669
别那么骄傲
别那么骄傲 2020-12-15 03:08
Android Studio 3.0 Beta2
classpath \'com.android.tools.build:gradle:3.0.0-beta3\'
testCompile \'org.robolectric:robolectric:3.4.2\'

Test class that

相关标签:
8条回答
  • 2020-12-15 03:48

    The Robolectric documentation states that the following configuration should be used with Android Studio 3.x:

    android {
      testOptions {
        unitTests.includeAndroidResources true
      }
    }
    
    0 讨论(0)
  • 2020-12-15 03:50

    In my case the following solved my issue: "Problem is related to android studio. Go to 'Run' -> 'Edit configurations...' and change 'Working directory' value to $MODULE_DIR$

    Run your tests.

    More info here under 'Building with Android Studio'."

    reference: https://github.com/robolectric/robolectric/issues/2653

    0 讨论(0)
提交回复
热议问题