I have switched my app to target API 27 and now it can\'t be granted WRITE_EXTERNAL_STORAGE permission -- grantResult is always -1.
Somewhere along the line, you are picking up that android:maxSdkVersion="18" attribute. My guess is that it is coming from a library. Check the "Merged Manifest" tab in Android Studio, when you are editing your own manifest. It will have details of what is contributing the various elements and attributes.
android:maxSdkVersion has the effect of removing your element on higher Android SDK versions, at least in terms of how runtime permissions work.
Since you need this permission for all versions, adding tools:remove="android:maxSdkVersion" on the element should revert the android:maxSdkVersion="18" and give you what you expect.