Android使用React Native 出现的问题
来源:互联网 发布:淘宝上的死飞耐用吗 编辑:程序博客网 时间:2024/03/28 19:24
如何嵌入:
参考
react native 学习笔记—-将react native嵌入到Android原生应用
Android原生嵌入React Native 过程中遇见的各种坑
在Android原生中嵌入React Native,进而React Native调用原生
一、原生Android嵌入React Native出现问题
1. 添加以下配置时出现的问题
compile 'com.facebook.react:react-native:+
问题:
Error:Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (3.0.0) and test app (2.0.1) differ. See http://g.co/androidstudio/app-test-app-conflict for details.
解决:
在app的gradle文件中添加以下代码
configurations.all { resolutionStrategy.force 'com.google.code.findbugs:jsr305:3.0.0' }
2.android 6.0 会出现权限问题调试
android 6.0 permission denied for this window type
添加权限判断
if (Build.VERSION.SDK_INT >= 23) { if(!Settings.canDrawOverlays(this)) { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); startActivity(intent); return; } else { //绘ui代码, 这里说明6.0系统已经有权限了 Intent intent = new Intent(MainActivity.this,MyReactActivity.class); startActivity(intent); } } else { //绘ui代码,这里android6.0以下的系统直接绘出即可 Intent intent = new Intent(MainActivity.this,MyReactActivity.class); startActivity(intent); }
二、使用原生组件出现的问题
1.
`MGWebView` has no propType for native prop `MGWebView.accessibilityLabel` of native type `String`If you haven't changed this prop yourself, this usually means that your versions of the native code and JavaScript code are out of sync. Updating both should make this error go away.
原因:js中封装的对应js缺少基础的属性
如下 添加 …View.propTypes,
'use strict';import { PropTypes } from 'react';import { requireNativeComponent, View } from 'react-native';var iface = { name: 'MGWebView', propTypes: { url: PropTypes.string, html: PropTypes.string, ...View.propTypes, },};module.exports = requireNativeComponent('MGWebView', iface);
0 0
- Android使用React Native 出现的问题
- Android React Native的使用细节问题
- 解决 react-native run-android 出现 gradle下载慢问题
- React-native android 启动遇到的问题
- React Native Android Navigator的使用
- react native 打包出错之 Gradle打包出现的问题
- 在windows开发react-native android应用程序出现的错误
- react-native run-android时,出现的小错误
- react-native android问题贴
- react native viewpager 使用问题
- 使用react-native进行android App开发过程所遇到的问题集锦
- React&React-Native的实践的问题
- React Native遇到的问题
- React Native的一些问题
- react-native遇到的问题
- Andorid 10 个最常见的 React Native Android 问题
- mac 搭建react-native环境,无法run-android的问题
- react-native开发Android启动白屏的问题
- Android 手机获取手机通讯录(按时间排序)
- Mybatis详解
- 【JavaWeb-8】JSP原理、3大命令、6大动作、9大对象、4大域对象、EL表达式、JSTL的几个标签
- leetcode之137. Single Number II(C++解法 哈希表计数)
- 工厂模式Factory
- Android使用React Native 出现的问题
- Struts工作原理和入门小实例
- 保存数据时结束编辑
- 机器学习(2.7.2)数据知识积累——概率论-超几何分布
- Linux下查找特定时间创建的文件
- 云服务中消灭小黄图的大宝剑---X次元口袋
- JNDI学习总结(三)——Tomcat下使用Druid配置JNDI数据源
- redis常用命令
- jQuery之$(document).ready()使用介绍