android - 将 React Native 代码集成到现有的 android 项目中
问题描述
将 react native 代码集成到现有的 android 项目中,遇到以下错误。
引起:java.lang.IllegalAccessError:方法'void androidx.core.net.ConnectivityManagerCompat.()
我们正在尝试将 react native 项目添加到现有的 android 应用程序中。使用以下参考链接:
https://medium.com/mindorks/react-native-integration-with-existing-app-f2757c2e672d
. 从 Android Main 活动切换到 Reactnative 活动时,我们得到以下异常
原因:java.lang.IllegalAccessError:方法 'void androidx.core.net.ConnectivityManagerCompat.()' 无法访问类 'com.facebook.react.modules.netinfo.NetInfoModule'('com.facebook.react. modules.netinfo.NetInfoModule`
. 请建议。
解决方案
您链接到的指南已有 3 年历史,在那段时间里,RN(以及 Android、Gradle 等)发生了很多变化。
你可以试试这个指南:https ://blog.usejournal.com/integrating-react-native-with-existing-android-apps-efficiently-3b39f2e061bd吗?几周前我用过它,它对我有用。
推荐阅读
- meteor - 当我将 Meteor 从 1.6.1.3 更新到 1.7 时,网络浏览器无法再正确加载
- scipy - 某物与自身的余弦距离是多少?
- routing - Flutter 通过 Route 和 Drawer 导航屏幕:使用 Pop、PushNamed 或 PushReplacementNamed
- amazon-web-services - 如何使用 AWS TransferManager 从 S3 下载多个 ZIP 文件
- ios - Swift - 枚举采用整数并确定范围
- python - 阻止rect移动moveip pygame
- c - 用C语言将二进制文件读入HashTable
- python - Phaser 2 不使用 Django 将图像加载到游戏中
- fabricjs - Fabricjs 文本选择模式或编辑模式
- mysql - 我的 spark sql 查询或数据框在哪里执行?