c59f2c72
白云
项目初始化
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# react-native-fw-rn-aliface
## Getting started
`$ npm install react-native-fw-rn-aliface --save`
### Mostly automatic installation
`$ react-native link react-native-fw-rn-aliface`
### Manual installation
#### iOS
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `fw-rn-aliface` and add `RNFwRnAliface.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNFwRnAliface.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<
#### Android
1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.feewee.aliface.RNFwRnAlifacePackage;` to the imports at the top of the file
- Add `new RNFwRnAlifacePackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-fw-rn-aliface'
project(':react-native-fw-rn-aliface').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fw-rn-aliface/android')
```
3. Insert the following lines inside the dependencies block in `android/app/build.gradle`:
```
compile project(':react-native-fw-rn-aliface')
```
## Usage
```javascript
import RNFwRnAliface from 'react-native-fw-rn-aliface';
// TODO: What to do with the module?
RNFwRnAliface;
```
## 构建文档
#### 1.构建项目
```
https://www.jianshu.com/p/091a68ea1ca7/
https://youngjuning.js.org/2019/06/react-native-create-library%E4%B8%AD%E6%96%87%E6%96%87%E6%A1%A3/
|
c59f2c72
白云
项目初始化
|
52
53
54
55
56
57
58
59
60
61
62
63
|
```
#### 2.修改package.json
```
{
"name": "fw-rn-aliface",
"version": "1.0.0",
"description": "阿里人脸活体检测",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"npm:publish": "npm --registry https://registry.npmjs.org/ publish",
|
c59f2c72
白云
项目初始化
|
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
"pod:lint": "export LANG=en_US.UTF-8 && pod lib lint TXIm.podspec",
"pod:install": "cd ios && export LANG=en_US.UTF-8 && pod install"
},
"keywords": [
"aliface"
],
"repository": {
"type": "git",
"url": "git@gitlab.feewee.cn:FEV2/fw-rn-aliface.git"
},
"homepage": "http://gitlab.feewee.cn/FEV2/fw-rn-aliface",
"author": "baiyun",
"license": "MIT",
"dependencies": {
"prop-types": "^15.7.2"
},
"peerDependencies": {
"react": "16.9.0",
"react-native": "0.61.5"
}
}
```
####3.修改build.gradle文件
```
apply plugin: 'com.android.library'
apply plugin: 'maven'
apply plugin: 'signing'
buildscript {
repositories {
mavenLocal()
google()
jcenter()
maven() {
url '/usr/local/node/lib/node_modules/react-native/android'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
}
}
repositories {
mavenLocal()
google()
jcenter()
maven {
url '/usr/local/node/lib/node_modules/react-native/android'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
signing {
sign configurations.archives
}
dependencies {
compileOnly 'com.facebook.react:react-native:+'
compileOnly files('src/main/assets')
}
```
|