My app has <uses-permission android:name="android.permission.WAKE_LOCK" />
added to the AndroidManifest.xml
. However calls to acquire the lock PowerManager.PARTIAL_WAKE_LOCK
crash the app on Oreo devices.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myapplication/com.example.myapplication.MainActivity}: java.lang.SecurityException: Neither user 10094 nor current process has android.permission.WAKE_LOCK.
Your app is probably using a new version of ACRA library. In new the version they added
<uses-permission android:name="android.permission.WAKE_LOCK" android:maxSdkVersion="25" />
to the libAndroidManifest.xml
file. Theandroid:maxSdkVersion="25"
is silently merged to main appAndroidManifest.xml
file, hence the app doesn't haveWAKE_LOCK
permission on Oreo devices. The solution is addtools:node="replace"
to your uses-permission declaration.For example
<uses-permission android:name="android.permission.WAKE_LOCK" tools:node="replace" />
.Update: in recent versions of ACRA library that unfortunate "feature" has been removed.