I am using Espresso for instrumentation testing and running them on Android Preview P Emulator.
I have 5 test cases in my test class out of which one test is failing when running the test suite and getting the error below.
Detected problems with API compatibility
Whereas the failing test case is passing when run individually and not in suite.
Since the dialog gets displayed on the view which says Detected problems with API compatibility
, I am getting no matching view found in hierarchy exception along with the above mentioned error.
Changing targetSdkVersion to 28 (previously was 27) made the problem disappear. I assume for most of the cases this won't be a valid solution but in my case, it allowed to go forward with my project.
Referencing to docs: In Android P, this dialog showing
Detected problems with API compatibility
Why this dialog is being shown?
Reason: Your code hit the
dark greylist
What are dark greylist apis? Such apis that are not permissible to call by other apps, In my case i was using the startSoftAp method that was dark grey listed. Removing that call vanished the dialog.
How will you find?
In your logcat -> verbose -> Search("Accessing hidden")
LOGCAT RESULT
Accessing hidden method:Landroid/net/wifi/WifiManager:startSoftAp(Landroid/net/wifi/WifiConfiguration;)Z (dark greylist, reflection)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With