Recently, I encountered the following problems when using robolectric unit test:
It has been reported that the resource class cannot be found, so it needs to be added to gradle under the app (the code is manually typed, there may be an error, sorry)
testOptions{
unitTests{
includeAndroidResources = true
}
}
After adding the above code, there is an error in the title, specifically android.test.monitor2… This can’t be found. Each time sync takes a long time, and then report the same error. Refer to the following link article, but it doesn’t help me much.
Ask colleagues for help. After comparing our configurations, we found that the gradle version references are different (gradle/wrapper/gradle wrapper. Properties). The previous references are:
distributionUrl:=https\://service.gradle.org/distributions/gradle-5.4.1-all.zip
Mine is taken directly from the company mapping Maven library. It is a local reference with a lower version:
distributionUrl:=../../../../tools/gradle-4.1-all.zip
I changed the gradle configuration according to her configuration and synced again. The problem was solved.
Read More:
- Monitoring session to determine whether the user is online or not
- [Solved] Error:Cannot determine path to ‘tools.jar‘ library for 17
- How to Solve IntelliJ IDEA Error: Cannot determine path to ‘tools.jar‘ library for 17 (C:\Program Files\Java\jd…
- Reason: failed to determine a suitable driver class [Solved]
- BeanDefinitionStoreException: Failed to read candidate component class probably due to a new Java
- [Solved] JAVA Web Error: startup failed due to previous errors
- How to Solve Error: Your ApplicationContext is unlikely to start due to a @ComponentScan of the default package.
- Android solution Java.util.concurrent.ExecutionException: com.Android.ide.common.process.ProcessException: exception
- [Solved] Error attempting to get column ‘xxxx_time‘ from result set. Cause: java.sql.SQLFeatureNotSupportedEx
- Android studio compilation failed: java.util.concurrent.ExecutionException: com.android.ide.common.process.Process
- Flutter: How to Fix Android module can’t recognize flutter SDK source code
- [Solved] HttpMessageNotReadableException: JSON parse error: Unrecognized field “xxxx“
- Android Studio Error: Error:moudle not specified [How to Solve]
- Tensorflow Error TypeError: Fetch argument XXXX has invalid typeXXXX,must be a string or Tensor
- Android activity Fail to Switch to androidx AppCompatActivity Error
- [Solved] AndroidStudio Error: Could not initialize class com.android.sdklib.repository.AndroidSdkHandler
- Android Studio Cannot resolve symbol [How to Solve]
- Android Compile Error: “SSL error when connecting to the Jack server. Try ‘jack-diagnose‘”
- [Solved] android Execution failed for task ‘:app:processDebugManifest‘
- [Solved] Android project Compile error: error processing kotlin-stdlib-1.6.0.jar