Application Crashes due to java.lang.SecurityException:

From the Android Documentation:

Security Exception is thrown by the security manager to indicate a security violation.

An example of security violation, is trying to accessing, reading or writing data in android, which your app isn’t allowed to access it by the android security manager possibly due on of the following:

  • Not declaring sufficient permissions
    Permissions are declared in the app’s manifest using the <uses-permission> tag. Almost all components and extensions do this already. But in case it doesn’t, you will need to decompile the APK or AAB and add it manually.
  • The protection level of one of the required declared permissions is dangerous, which means that the user must accept it in the runtime starting from Android 6 ( using the Screen. AskPermission block. ).
    Most of the components asks the user to accept the permission already, but it’s possible you will need to ask it using the mentioned blocks when using some components or extensions.
  • One of the features you use requires your app to be signed as a system app.

An example is:

  • Accessing the user location ( using the location sensor for example or Google Maps), without having the location permissions.
  • Accessing the internet without the internet permission.
  • Reading/Writing files from the device’s storage ( excluding app specific directories which apps have access to it by default )
    Well explained here.
  • And so on..
1 Like