Kotlin构建不能获得由SquidDatabase创建的类
在我的项目中,我几乎在任何地方都使用SquidDatabase来访问数据库。
我想把我的项目转换成Kotlin,但是当我建立的时候有很多“Unresolved reference:DepartmentInfo”错误。
那个DepartmentInfo
类是由SquidDatabase创建的,所以我觉得这个问题是由Kotlin在其他库之前建立的。
我没有找到任何方法把Kotlin改成buildlist的结尾。
我该如何解决这个问题?
我在Github上发布了这个问题 ,并得到了开发者的回复。
在这里,
build.gradle of your app //If using kotlin language,please add this apply plugin: 'kotlin-kapt' ...... dependencies { compile 'com.yahoo.squidb:squidb:3.2.3' compile 'com.yahoo.squidb:squidb-annotations:3.2.3' compile 'com.yahoo.squidb:squidb-android:3.2.3' // For Android projects only //annotationProcessor 'com.yahoo.squidb:squidb-processor:3.2.3' // If using the android-apt plugin, this becomes // apt 'com.yahoo.squidb:squidb-processor:3.2.3' // If using kotlin language, this becomes kapt 'com.yahoo.squidb:squidb-processor:3.2.3' }
如果您为Andriod使用DataBinding ,则可能会导致错误,并且解决方案是在您的依赖kapt
中添加一个kapt
:
kapt 'com.android.databinding:compiler:$gradle_version'