2

Attached is my error message that comes up in Android Studio after running the application. I am able to build and run the program on a device without any issues. I was not getting this error until I started targeting API level 26 as per Google's new app requirements. Any suggestions on how to fix the error? Also, will this error cause issues in the future if not addressed?

Error Message

Thanks!

NewUser1213
  • 1,271
  • 2
  • 10
  • 12

2 Answers2

7

Accessing /proc/stat not possible with the API Levels 26 or higher. Google has restricted this to non-system apps. From API Level 26 only system apps can access /proc/stat

More information https://issuetracker.google.com/issues/37140047

Yasiru Nayanajith
  • 1,647
  • 17
  • 20
1

That means you were targeting API < 23 before and you were having app permissions during the install time. Beginning with API 23 (Android 6.0), you have to ask the dangerous permissions at runtime.

This is the reason why your app was running successfully before and the moment you changed it to 26, you started getting errors. You have to ask permissions at runtime using ActivityCompat.requestPermissions(...)

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
  • Thanks, I am actually requesting permissions at run time already for the dangerous permissions. I request permission in the manifest file for RECORD_AUDIO, WRITE_EXTERNAL_STORAGE, READ_INTERNAL_STORAGE, and INTERNET. RECORD_AUDIO & WRITE_EXTERNAL _STORAGE are both considered dangerous so I'm also requesting permission at run time. I am not however for INTERNET or READ_INTERNAL_STORAGE as they are not dangerous. I did notice that READ_INTERNAL_STORAGE isn't on any list for Android 8.0, is this not a permission anymore? Could this be causing the issue? – NewUser1213 Oct 15 '18 at 14:17
  • `READ_INTERNAL_STORAGE` in my opinion is already given to you by Android system and you don't need to specify it beginning with Android 8.0. – CopsOnRoad Oct 16 '18 at 03:11