Espresso --> Java.lang.SecurityException: test fails due to Package does not belong to <process> : <p>I have an Android Espresso code that attempts to click a button and it fails with a security error.</p>

<p>This is the Espresso command:</p>

<pre><code>Espresso.onData(Matchers.allOf(Matchers.is(Matchers.instanceOf(Preference.class)), withKey(PreferenceKey.pref_custom_server_base_url.toString()), withSummaryText(Configurations.DEFAULT_SERVER_URL))).check(matches(isCompletelyDisplayed()));
</code></pre>

<p>This is the error I am receiving:</p>

<pre><code>java.lang.SecurityException: Package xxx.xxx.test does not belong to 10095
at android.os.Parcel.readException(Parcel.java:2004)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
at android.content.ContentProviderProxy.call(ContentProviderNative.java:651)
at android.provider.Settings$NameValueCache.getStringForUser(Settings.java:1924)
at android.provider.Settings$Global.getStringForUser(Settings.java:10362)
at android.provider.Settings$Global.getString(Settings.java:10351)
at android.provider.Settings$Global.getFloat(Settings.java:10695)
at android.support.test.espresso.base.DefaultFailureHandler.getGlobalSetting(DefaultFailureHandler.java:178)
at android.support.test.espresso.base.DefaultFailureHandler.getSetting(DefaultFailureHandler.java:154)
at android.support.test.espresso.base.DefaultFailureHandler.getTransitionAnimationScale(DefaultFailureHandler.java:124)
at android.support.test.espresso.base.DefaultFailureHandler.isAnimationAndTransitionDisabled(DefaultFailureHandler.java:112)
at android.support.test.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:69)
at android.support.test.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:52)
at xxx.xxx.test.instruments.failure.ScreenshotFailureHandler.handle(ScreenshotFailureHandler.java:36)
at android.support.test.espresso.ViewInteraction.waitForAndHandleInteractionResults(ViewInteraction.java:312)
at android.support.test.espresso.ViewInteraction.desugaredPerform(ViewInteraction.java:167)
at android.support.test.espresso.ViewInteraction.perform(ViewInteraction.java:110)
at android.support.test.espresso.DataInteraction$DisplayDataMatcher$1.apply(DataInteraction.java:206)
at android.support.test.espresso.DataInteraction$DisplayDataMatcher$1.apply(DataInteraction.java:203)
at android.support.test.espresso.DataInteraction$DisplayDataMatcher.&lt;init&gt;(DataInteraction.java:223)
at android.support.test.espresso.DataInteraction$DisplayDataMatcher.&lt;init&gt;(DataInteraction.java:198)
at android.support.test.espresso.DataInteraction$DisplayDataMatcher.displayDataMatcher(DataInteraction.java:241)
at android.support.test.espresso.DataInteraction.makeTargetMatcher(DataInteraction.java:143)
at android.support.test.espresso.DataInteraction.check(DataInteraction.java:137)
at xxx.xxx.test.steps.ChangeServerUrlSteps.checkSettingsSaved(ChangeServerUrlSteps.java:112)
at xxx.xxx.test.steps.Prerequisites.serverConfigPrerequisites(Prerequisites.java:38)
at ✽.Given I am connected (features/001_login.feature:8)
</code></pre>

<p>Any idea why this may happen?
Thanks!
The code runs on Emulators and Cloud devices with the same error.</p>
