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
- In XCode, in the project navigator, right click
Libraries
➜ Add Files to [your project's name]
- Go to
node_modules
➜ fw-rn-aliface
and add RNFwRnAliface.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNFwRnAliface.a
to your project's Build Phases
➜ Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- 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
- 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')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:
compile project(':react-native-fw-rn-aliface')
Usage
import RNFwRnAliface from 'react-native-fw-rn-aliface';
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/
https://www.jianshu.com/p/091a68ea1ca7/
签名: http://www.voidcn.com/article/p-bgrartlo-zw.html
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",
"npm:sync": "curl -i https://registry.npmjs.org/fw-rn-aliface",
"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')
}