react-nativeのnative-moduleをKotlinで作る準備
2019/06/02 09:02
参考にしたのはここ https://proandroiddev.com/react-native-bridge-with-kotlin-b2afde2f70b
手順
react-native init kotlinandroid/build.gradle
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
kotlin_version = '1.3.0'
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}android/app/build.gradle
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
...
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}ここにハマりどころがあって、 implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version" を implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" にしないとだめ(素人感)
準備編はおしまい