Android Studio で Kotlin を使用しています。moshi ライブラリを接続した状態でプロジェクトをコンパイルできません。https://github.com/square/moshi
教えてください、私は何を間違っていますか?? 私はコンソールで見ることができます:
:app:packageInstantRunResourcesDebug UP-TO-DATE
:app:checkManifestChangesDebug
:app:transformClassesWithAndroidGradleClassShrinkerForDebug
com/squareup/moshi/JsonReader references unknown class: javax/annotation/Nullable
com/squareup/moshi/CollectionJsonAdapter$1 references unknown class: javax/annotation/Nullable
com/squareup/moshi/JsonAdapter$5 references unknown class: javax/annotation/Nullable
com/squareup/moshi/package-info references unknown class: javax/annotation/ParametersAreNonnullByDefault
com/squareup/moshi/ArrayJsonAdapter$1 references unknown class: javax/annotation/Nullable
com/squareup/moshi/AdapterMethodsFactory$1 references unknown class: javax/annotation/Nullable
okio/package-info references unknown class: javax/annotation/ParametersAreNonnullByDefault
com/squareup/moshi/Types references unknown class: javax/annotation/Nullable
com/squareup/moshi/JsonAdapter references unknown class: javax/annotation/Nullable
okio/ByteString references unknown class: javax/annotation/Nullable
トップレベルの build.gradle
buildscript {
ext.kotlin_version = '1.2.10'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app\build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.lfom.modbuster"
minSdkVersion 21
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
}
}
productFlavors {
}
}
dependencies {
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:26.+'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.gms:play-services-vision:11.0.4'
implementation 'com.squareup.moshi:moshi:1.5.0'
implementation 'com.squareup.moshi:moshi-kotlin:1.5.0'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.1.0'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
}
repositories {
mavenCentral()
maven {
url "https://repo.eclipse.org/content/repositories/paho-snapshots/"
}
}
https://github.com/LevWi/modbuster-blt/blob/Signals/app/build.gradle
proguard-rules.pro
-dontwarn okio.**
-dontwarn javax.annotation.**
-keepclasseswithmembers class * {
@com.squareup.moshi.* <methods>;
}
-keep @com.squareup.moshi.JsonQualifier interface *
-keepclassmembers class kotlin.Metadata {
public <methods>;
}