code-push 测试步骤

Debug环境对应Staging模式,Release包对应Production环境

 

一,Staging环境下测试

1,在build.gradle中根据buildtype类型配置debug和release包对应的codepush key。

 buildTypes {

        release {

            buildConfigField "String", "CODE_PUSH_KEY", '"SynaFTIpUVcU8yY1EGJVRIOfyl234JzaZfEDl"'

            minifyEnabled enableProguardInReleaseBuilds

            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

            signingConfig signingConfigs.config

        }

        debug {

            buildConfigField "String", "CODE_PUSH_KEY", '"Yjf0au0JPRq5ww1TMTo7bgrCSZCy4JzaZfEDl"'

            signingConfig signingConfigs.config

        }

    }

 

2,cd到项目的根目录,执行以下命令打JSBundle包,不管是debug包还是release包命令都是这个,没有影响。

react-native bundle --platform android --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest  android/app/src/main/res/ --dev false

 

3,在studio中选择Build -> export singed apk 选择debug模式打包。

 

4,将debug模式的签名包发送到手机安装。

 

5,安装完成后,到js文件中做一些修改操作。

 

6,修改完后,命令行发布更新

 

code-push release-react ZSKQAndroid android  (ZSKQAndroid为code-push中add的app名称)

 

二、Production环境测试

 

 1,cd到项目的根目录,执行以下命令打JSBundle包,不管是debug包还是release包命令都是这个,没有影响。

react-native bundle --platform android --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest  android/app/src/main/res/ --dev false (将图片资源放到res目录)

 

react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle  --assets-dest android/app/src/main/assets   (将图片资源放到assets目录)

 

 

2,执行build -> export signed apk生成release的apk包,发送到手机安装。

 

3,到js文件中做一些修改

 

4,修改完成后执行  code-push release-react ZSKQAndroid android -d Production 进行发布更新 (推送android目录)

code-push release zskq-android ./assets 2.0.1 --deploymentName Production  (只推送assets目录)

 

5,重启app后自动下载更新。服务器在美国,有时更新不是很及时,要过几分钟才生效。 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在 APP center 中配置 React Native Pushcode,需要按照以下步骤进行操作: 1. 在 APP center 中创建一个新项目,并将其与你的 GitHub 或 Bitbucket 仓库关联。 2. 在你的 React Native 项目中安装 App Center Push SDK。可以使用以下命令: ``` npm install appcenter-push --save ``` 3. 在项目中添加以下代码,以初始化 App Center Push SDK: ```javascript import AppCenterPush from 'appcenter-push'; componentDidMount() { AppCenterPush.setListener({ onPushNotificationReceived: function (pushNotification) { console.log('Push notification received:' + pushNotification.message); } }); AppCenterPush.getInitialNotification().then(notification => { console.log('Initial notification:' + notification); }); } ``` 4. 在 App Center 中创建推送通知。可以通过以下步骤完成: - 在 App Center 中单击“推送”选项卡。 - 点击“新建”按钮。 - 输入通知的标题和正文。 - 选择要接收通知的应用程序。 - 选择要接收通知的设备。 - 点击“发送”按钮。 5. 在应用中测试推送通知。可以使用以下命令向应用发送推送通知: ``` curl -X POST \ -H "Content-Type: application/json" \ -H "X-API-Token: YOUR_API_TOKEN" \ -d '{ "notification_content": { "name": "test notification", "title": "test notification title", "body": "test notification body" }, "notification_target": { "type": "devices_target", "devices": ["YOUR_DEVICE_ID"] } }' \ https://api.appcenter.ms/v0.1/apps/YOUR_ORGANIZATION/YOUR_APP/push/notifications ``` 这将向设备发送一条测试通知。在应用中接收到通知后,可以在控制台中查看通知的日志信息。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值