react native 0.595 在安卓9.0版 release包无法联网

原因安卓9.0开始对于http 无法直接联网 需要加配置文件 类似于 ios需要配置一样

解决方案
在这里插入图片描述
在这里插入图片描述

在安卓文件下加入配置网络文件
具体代码如下 在 src main 中的 res创建xml文件夹 下创建network_security_config.xml文件
内写代码

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config cleartextTrafficPermitted="true" />
</network-security-config>

在 src main 下的 androidManifest.xml 文件中加入代码

 <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:networkSecurityConfig="@xml/network_security_config"   加这一行
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">

就可以了然后打包 妥妥的

发布了8 篇原创文章 · 获赞 3 · 访问量 3353
展开阅读全文

react-nativerelease本闪退

07-10

我在用react-native进行项目打包的时候,我的debug模式在真机中能够运行,在release模式下运行时闪退,我在Android studio中查看logcat的时候,出现下面代码?请问是什么原因导致的? ``` 07-10 19:05:07.446 12390-12436/? E/ReactNativeJS: undefined is not an object (evaluating 's.View.propTypes.style') 07-10 19:05:07.455 12390-12436/? E/ReactNativeJS: Application Lova has not been registered. Hint: This error often happens when you're running the packager (local dev server) from a wrong folder. For example you have multiple apps and the packager is still running for the app you were working on before. If this is the case, simply kill the old packager instance (e.g. close the packager terminal window) and start the packager in the correct app folder (e.g. cd into app folder and run 'npm start'). This error can also happen due to a require() error during initialization or failure to call AppRegistry.registerComponent. 07-10 19:05:08.012 1003-1271/? E/WifiStateMachine: ConnectedState (when=-5ms what=131155 arg1=5!CMD_RSSI_POLL 5 0 "11223344" ac:c1:ee:3c:82:dd rssi=-51 f=2412 sc=60 link=65 tx=0.5, 0.0, 0.0 rx=0.3 bcn=0 [on:0 tx:0 rx:0 period:2983] from screen [on:0 period:-2082616660] gl hn u24 rssi=-46 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0 07-10 19:05:08.015 1003-1271/? E/WifiStateMachine: L2ConnectedState (when=-8ms what=131155 arg1=5!CMD_RSSI_POLL 5 0 "11223344" ac:c1:ee:3c:82:dd rssi=-51 f=2412 sc=60 link=65 tx=0.5, 0.0, 0.0 rx=0.3 bcn=0 [on:0 tx:0 rx:0 period:3] from screen [on:0 period:-2082616657] gl hn u24 rssi=-46 ag=0 hr ticks 0,0,0 ls-=0 [56,56,56,56,61] brc=0 lrc=0 get link layer stats 0 ``` 我的注册文件从如下所示: ``` import { AppRegistry } from 'react-native'; import App from './App'; AppRegistry.registerComponent('Lova', () => App); ``` 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览