當我試圖境界在Java /科特林項目整合的Java /科特林項目產生RealmProxy類,但kapt甚至沒有對.java文件境界不使用kapt
我已經更新產生RealmProxy類境界因爲this,但仍然沒有工作
搖籃應用程序文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'realm-android'
repositories {
maven {
url 'https://maven.fabric.io/public'
}
}
kapt {
generateStubs = true
}
project.ext {
daggerVersion = '2.2'
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
kapt "com.android.databinding:compiler:2.3.3"
annotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: "${daggerVersion}"
compile group: 'com.google.dagger', name: 'dagger', version: "${daggerVersion}"
kapt "com.google.dagger:dagger-compiler:${daggerVersion}"
provided group: 'org.glassfish', name: 'javax.annotation', version: '10.0-b28'
testAnnotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: "${daggerVersion}"
testCompile group: 'com.google.dagger', name: 'dagger', version: "${daggerVersion}"
androidTestAnnotationProcessor group: 'com.google.dagger', name: 'dagger-compiler', version: "${daggerVersion}"
androidTestCompile group: 'com.google.dagger', name: 'dagger', version: "${daggerVersion}"
}
...
項目文件:
buildscript {
ext.kotlin_version = '1.1.3-2'
repositories {
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.realm:realm-gradle-plugin:3.5.0"
}
}
...
Java模型文件:
@RealmClass
public class NotificationEventsModel extends RealmObject {
@PrimaryKey
private long classPK;
@SerializedName("userNotificationEventsCount")
private int eventsCount;
}
科特林型號文件:
@RealmClass open class PageModel(
open var classPK: Long = 0,
open var content: String? = null,
@PrimaryKey
open var id: Long = 0,
) : RealmObject() {
}
就像一個評論,與AS 3.x你不必使用'retrolambda'了。 – kaneda