Commit fad87138 authored by xhx's avatar xhx

打包设置

parent e858e003
......@@ -41,11 +41,7 @@ class App extends Component {
// 交互传值
handleInjectJavascript = (data) => {
console.log('send message: ',data)
// const injectJavascriptStr = `(function() {
// window.WebViewBridge.onMessage(${JSON.stringify('hello,vue2!!! ')});
// })()`;
// this.webView.injectJavaScript(injectJavascriptStr);
console.log('send message: ', data)
const injectJavascriptStr = `(function() {
window.WebViewBridge.onMessage(${JSON.stringify(data)});
})()`; // 拼接 数据 为 方法
......@@ -116,8 +112,8 @@ class App extends Component {
// 加载时强制使用loading转圈视图,注意如果为true,在低性能下,webview可能会加载失败,显示为空白
startInLoadingState={false}
// webview加载错误页面
// source={ {uri: 'http://www.baidu.com/'} } // 网络路径
source={ {uri: 'http://192.168.1.60:1200'} } //本地路径
source={{uri: 'http://47.114.159.142:8983'}} // 网络路径
// source={{uri: 'http://192.168.1.60:1200'}} //本地路径
/>
{ this.state.show ?
(
......
# template
## 项目安装
需要 react-natvie 环境, [环境配置](https://reactnative.cn/docs/environment-setup), 完成后执行
```
yarn
```
......@@ -38,6 +39,21 @@ function onMessage() {
// code...
}
```
### 安卓打包
android 文件下设置 local.properties 文件, 内容如下, sdk.dir 为 sdk 文件位置
```
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=C\:\\Users\\33\\AppData\\Local\\Android\\Sdk
```
打包主要流程见 [react-native 安卓打包](https://reactnative.cn/docs/signed-apk-android)
### 相机文档
[react-native-camera](https://react-native-camera.github.io/react-native-camera/docs/api)
......
......@@ -153,6 +153,14 @@ android {
keyAlias 'androiddebugkey'
keyPassword 'android'
}
release {
if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
storeFile file(MYAPP_RELEASE_STORE_FILE)
storePassword MYAPP_RELEASE_STORE_PASSWORD
keyAlias MYAPP_RELEASE_KEY_ALIAS
keyPassword MYAPP_RELEASE_KEY_PASSWORD
}
}
}
buildTypes {
debug {
......@@ -161,7 +169,8 @@ android {
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
// signingConfig signingConfigs.debug
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
......
......@@ -9,6 +9,7 @@
<application
android:name=".MainApplication"
android:usesCleartextTraffic="true"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
......
......@@ -26,3 +26,8 @@ android.enableJetifier=true
# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.75.1
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=testnft
MYAPP_RELEASE_KEY_PASSWORD=testnft
......@@ -27,5 +27,10 @@
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./src/assets/fonts/"
]
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment