Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grant Permissions Rule errors out while connecting to UiAutomation #332

Open
rahul-narkhede opened this issue Aug 7, 2020 · 1 comment

Comments

@rahul-narkhede
Copy link

I keep getting these errors for few of my automation tests. Most of the times, on re-running the tests, it works fine again

java.lang.RuntimeException: Error while connecting UiAutomation
	at android.app.UiAutomation.connect(UiAutomation.java:239)
	at android.app.Instrumentation.getUiAutomation(Instrumentation.java:2045)
	at android.app.Instrumentation.getUiAutomation(Instrumentation.java:2002)
	at androidx.test.runner.permission.UiAutomationShellCommand.<init>(UiAutomationShellCommand.java:65)
	at androidx.test.runner.permission.PermissionRequester.addPermissions(PermissionRequester.java:92)
	at androidx.test.rule.GrantPermissionRule.grantPermissions(GrantPermissionRule.java:100)
	at androidx.test.rule.GrantPermissionRule.grant(GrantPermissionRule.java:94)
	at com.example.package.tests.BaseTest.<init>(BaseTest.java:40)
	at com.example.package.tests.ReportFragmentTest.<init>(ReportFragmentTest.java:22)
	at java.lang.reflect.Constructor.newInstance0(Native Method)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at androidx.test.runner.AndroidJUnit4.run(AndroidJUnit4.java:104)

I am granting permissions in the following manner

public GrantPermissionRule grantPermissionRule = GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_PHONE_STATE, Manifest.permission.READ_EXTERNAL_STORAGE);

Any help in this regards will be appreciated.

@Dpkpadhy
Copy link

did you got any solution for the above problem ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants