Fixed
Status Update
Comments
gg...@google.com <gg...@google.com> #2
Can you please attach the full logcat output to this bug, so we can take a look?
ra...@gmail.com <ra...@gmail.com> #3
Yes of course. Here the full logcat. Tested on multiple devices for example Moto G5, Samsung A5 and Nexus 5 (but custom rom)
gg...@google.com <gg...@google.com> #4
I've tested it today also on the Nexus 5X (Dev Preview 4) and Nexus 5 without custom rom.
gg...@google.com <gg...@google.com> #5
Thanks! I will try to see if I can reproduce it on a device. What's interesting though is that the permission seems to be already granted to the package. If you look at your log cat output, right before the exception there is this line: "I/GrantPermissionCallable: Permission: android.permission.WRITE_EXTERNAL_STORAGE is already granted!". What GPC does is to verify that the permission was actually granted for the target context (app under test). One thing that would be interesting if you could run "adb shell pm dump <package> | grep permission" after you ran the tests and paste the outputs here. Thanks.
ni...@gmail.com <ni...@gmail.com> #6
Hi sorry for the late response:
I get the following respone from the command:
requested permissions:
android.permission.INTERNET
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_EXTERNAL_STORAGE
android.permission.RECORD_AUDIO
android.permission.SET_ALARM
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.WAKE_LOCK
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_FINE_LOCATION
install permissions:
android.permission.RECEIVE_BOOT_COMPLETED: granted=true
android.permission.INTERNET: granted=true
android.permission.ACCESS_NETWORK_STATE: granted=true
android.permission.WAKE_LOCK: granted=true
runtime permissions:
android.permission.WRITE_EXTERNAL_STORAGE: granted=true
android.permission.RECORD_AUDIO: granted=true
ACTIVITY MANAGER URI PERMISSIONS (dumpsys activity permissions)
time="26.9.2017, 18:55" type=MOVE_TO_FOREGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.ManagePermissionsActivity
time="26.9.2017, 18:56" type=MOVE_TO_BACKGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.ManagePermissionsActivity
time="26.9.2017, 19:14" type=MOVE_TO_FOREGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
time="26.9.2017, 19:14" type=MOVE_TO_BACKGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
time="26.9.2017, 19:20" type=MOVE_TO_FOREGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
time="26.9.2017, 19:20" type=MOVE_TO_BACKGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
So it seems that the permission is granted. But I get all the time the exception.
I get the following respone from the command:
requested permissions:
android.permission.INTERNET
android.permission.WRITE_EXTERNAL_STORAGE
android.permission.READ_EXTERNAL_STORAGE
android.permission.RECORD_AUDIO
android.permission.SET_ALARM
android.permission.RECEIVE_BOOT_COMPLETED
android.permission.WAKE_LOCK
android.permission.ACCESS_NETWORK_STATE
android.permission.ACCESS_FINE_LOCATION
install permissions:
android.permission.RECEIVE_BOOT_COMPLETED: granted=true
android.permission.INTERNET: granted=true
android.permission.ACCESS_NETWORK_STATE: granted=true
android.permission.WAKE_LOCK: granted=true
runtime permissions:
android.permission.WRITE_EXTERNAL_STORAGE: granted=true
android.permission.RECORD_AUDIO: granted=true
ACTIVITY MANAGER URI PERMISSIONS (dumpsys activity permissions)
time="26.9.2017, 18:55" type=MOVE_TO_FOREGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.ManagePermissionsActivity
time="26.9.2017, 18:56" type=MOVE_TO_BACKGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.ManagePermissionsActivity
time="26.9.2017, 19:14" type=MOVE_TO_FOREGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
time="26.9.2017, 19:14" type=MOVE_TO_BACKGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
time="26.9.2017, 19:20" type=MOVE_TO_FOREGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
time="26.9.2017, 19:20" type=MOVE_TO_BACKGROUND package=com.google.android.packageinstaller class=com.android.packageinstaller.permission.ui.GrantPermissionsActivity
So it seems that the permission is granted. But I get all the time the exception.
dy...@gmail.com <dy...@gmail.com> #7
I experienced the same issue using Rules 1.0.1 on Nexus 5X running Android 8.0
I found a workaround for this issue where I also grant the 'Manifest.permission.READ_EXTERNAL_STORAGE' permission and then things work as expected.
So instead of:
GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
I use:
GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE);
The issue could be (this is just my guess):
'GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)' only grants write permission. However, when requesting the write permission using the Android system dialog both the write and read permissions are granted. This is also the expected behaviour as described in the Manifest.permission class:
https://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGE
"Any app that declares the WRITE_EXTERNAL_STORAGE permission is implicitly granted this permission."
I found a workaround for this issue where I also grant the 'Manifest.permission.READ_EXTERNAL_STORAGE' permission and then things work as expected.
So instead of:
GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE);
I use:
GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.READ_EXTERNAL_STORAGE);
The issue could be (this is just my guess):
'GrantPermissionRule.grant(Manifest.permission.WRITE_EXTERNAL_STORAGE)' only grants write permission. However, when requesting the write permission using the Android system dialog both the write and read permissions are granted. This is also the expected behaviour as described in the Manifest.permission class:
"Any app that declares the WRITE_EXTERNAL_STORAGE permission is implicitly granted this permission."
dy...@gmail.com <dy...@gmail.com> #8
Experienced same problem after updating hockey sdk to version 5.0.3.
After investigating I found that hockey sdk declares following in AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
While my app main library just defines following in AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Fixed by changing main library manifest to following:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="replace" />
After investigating I found that hockey sdk declares following in AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
While my app main library just defines following in AndroidManifest.xml:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Fixed by changing main library manifest to following:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
tools:node="replace" />
[Deleted User] <[Deleted User]> #9
Experience same problem with Manifest.permission.READ_CONTACTS and android.Manifest.permission.WRITE_CONTACTS permission
co...@gmail.com <co...@gmail.com> #10
Fix will be available in 1.0.2-alpha2
ma...@gmail.com <ma...@gmail.com> #11
I am also experiencing the same issue with Manifest.permission.ACCESS_FINE_LOCATION
ma...@gmail.com <ma...@gmail.com> #12
How do I import 1.0.2-alpha2 into my project?
ma...@gmail.com <ma...@gmail.com> #13
When should we expect a build of 1.0.2-alpha2 with this fix?
Description
Version used: 3.0.1
What steps will reproduce the problem?
1. Put an AppCompatTextView in your UI with android:textAllCaps="true" and android:text="Low Stock" in your XML (I'm using android:id="@+id/lowStockTV")
2. Launch your activity through a Test. AppCompatTextView will be shown as "LOW STOCK"
3. Check that that view has text with Espresso in the following way:
onView(withId(R.id.lowStockTV))
.check(
matches(withText("LOW STOCK"))
)
How are you running your tests (via Android Studio, Gradle, adb, etc.)? Android Studio
What is the expected output?
The expected output is obtaining a valid ViewInteraction with no throw (AssertionFailedWithCausedError)
What do you see instead?
AssertionFailedWithCausedError with message:
'with text: is "LOW STOCK"' doesn't match the selected view.
Expected: with text: is "LOW STOCK"
Got: "AppCompatTextView{id=2131296406, res-name=lowStockTV, visibility=VISIBLE, width=1002, height=57, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=android.widget.LinearLayout$LayoutParams@5155c10, tag=null, root-is-layout-requested=false, has-input-connection=false, x=39.0, y=39.0, text=Low Stock, input-type=0, ime-target=false, has-links=false}"
if I use:
onView(withId(R.id.lowStockTV))
.check(
matches(withText("Low Stock"))
)
it works perfectly, I get my ViewInteraction, but that's not why I see in my UI