I am having trouble with a NativeScript app I'm building. The issue is specifically on android. As soon as I begin the flow to request a permission the app crashes. I have tried multiple approaches. I have used multiple NativeScript plugins, including nativescript-permissions, ns-permissions and others. All yield the same crash. I have also tried the same process using the android api directly. Here is the code I'm using. I've kept it simple and removed the event delegate to focus on isolating the error.
const androidApp: AndroidApplication = Application.android; try { const result = androidApp.startActivity .shouldShowRequestPermissionRationale("android.permission.WRITE_EXTERNAL_STORAGE"); console.log("permission result", result); androidApp.foregroundActivity.requestPermissions("android.permission.WRITE_EXTERNAL_STORAGE", 1988); } catch (err){ console.log("error requesting permissions", err); } It also causes a crash and I get a JNI error. Here is the output from Logcat when initiate the function:
AttributionSource: android.content.AttributionSource@c62bc705 does not have READ_SYSTEM_GRAMMATICAL_GENDER permission. Claiming ownership of default web profile failed java.lang.IllegalStateException: removeAllCookies must be called on a thread with a running Looper. at com.android.webview.chromium.a.removeAllCookies(chromium-TrichromeWebViewGoogle6432.aab-stable-710306033:43) at fdju.b(PG:129) at fdjr.hv(PG:20) at gjao.s(PG:12) at gjjq.run(PG:110) at fgqo.run(PG:3) at fhyj.run(PG:13) at dntk.run(PG:7) at frax.run(PG:50) at dntb.run(PG:42) at java.lang.Thread.run(Thread.java:1119) at dnum.run(PG:64)