You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1uokun
changed the title
React Native 'java.lang.String android.content.Context.getPackageName()' on a null object reference
android.support.v4.content.FileProvider拓展类在React Native中的执行时机
Apr 18, 2020
在FileProvider中获取MainApplication Context
MainApplication
初始化时会执行所有AndroidManifest.xml
中注册的FileProvider
拓展类,但是在
0.55.4
这个版本之后不会执行。所以
不要通过
FileProvider
获得MainApplication
对象Context这里给了几个方案:
使用RN提供的
getApplicationContext()
在
MainApplication
的onCreate
中初始赋值在自定义package中定义
init
之类的方法将获得的this
存储到静态变量中。常见于第三方UI库
The text was updated successfully, but these errors were encountered: