flutter集成ios和android插件
要集成我们的sdk
首先在我们的flutter项目中添加插件路径
flutter_razer_plugin:
path: /Users/tiny/Desktop/flutter_razer_plugin
1.首先创建flutter_plugin,然后在ios Classes同级目录下导入Razer_IoT_SDK,同时在flutter_razer_plugin.podspec中配置
s.ios.vendored_frameworks = ‘Frameworks/Razer_IoT_SDK.framework’
s.vendored_frameworks = ‘Razer_IoT_SDK.framework’
##该pod依赖的系统library,多个用逗号隔开
s.frameworks = ‘CoreBluetooth’,’Foundation’
s.libraries = ‘c++’
然后在使用android studio运行,这样ios会自动pod,然后使用Xcode运行在SwiftFlutterRazerPlugin中编写ios插件代码,这样ios就完成了
2.安卓,不集成arr,将arr解压后获得jni,和 classess.jar包,解压后的 AndroidManifest.xml文件要同步拷贝过去,然后再build.gradle里面配置,
sourceSets {
main.java.srcDirs += ‘src/main/kotlin’
main.jniLibs.srcDirs = [‘libs/jni/’]
}
dependencies {
implementation “org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version”
//Razer_Iot_SDK
implementation files(‘libs/classes.jar’)
}
配置完成后,运行,ios和安卓插件就完成了