Kotlin中的注释不起作用
我想将我的Android应用程序从Java转换为Kotlin。 对于应用程序快捷方式,我使用shortbread库,它非常易于实现,但它在Kotlin中不起作用。难道我做错了什么 ?Kotlin中的注释不起作用
的Java:
@Shortcut(id = "Camera", icon = R.drawable.iconshortcut,longLabel = "Instant Scan", shortLabel = "Scan") public class CameraActivity extends AppCompatActivity { ...
科特林:
@Shortcut(id = "Camera", icon = R.drawable.iconshortcut, longLabel = "Instant Scan", shortLabel = "Scan") class CameraActivity : AppCompatActivity() { ...
酥饼正在每当注释是在Java中,但不是在科特林
Shortbread.create(this)
回答:
你需要使用kotlin-kapt
插件能够解析Kotlin文件中的注释:
apply plugin: 'kotlin-kapt' dependencies {
...
implementation 'com.github.matthiasrobbers:shortbread:1.0.2'
kapt 'com.github.matthiasrobbers:shortbread-compiler:1.0.2'
}
如果这样不起作用,那么在项目的GitHub仓库中打开一个问题可能是有意义的。
以上是 Kotlin中的注释不起作用 的全部内容, 来源链接: utcz.com/qa/258930.html