npm install -g react-native-create-library
使用react-native-create-library创建项目,并指定平台
react-native-create-library --package-identifier com.test.toast --platforms android,ios toast
重命名下项目
mv toast react-native-toast
使用AndroidStudio打开项目
打开build.gradle,根据自己配置修改,这里我贴出下我自己的
buildscript {
repositories {
jcenter()
google()//这里加上,不然会报错,别问为什么,问就自己查
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"