kotlin 遇到的问题

转载请表明 https://i.cnblogs.com/EditPosts.aspx?opt=1

 

从5月18号goole正式公布用kotlin做为android的新语言,做为android也很庆幸可以多学一门新语言了!!!下面我还是会把我遇到的一些问题总结出来,让更少的朋友少跳坑

这是我android studio中遇到的问题,绝对是干货都是自己整理  https://i.cnblogs.com/EditPosts.aspx?postid=6623443 

1.昨天刚开始完kotlin 就报错了

  Caused by: java.lang.ClassNotFoundException: ...nativeLibraryDirectories=[/data/app/com.example.headerrecyclerview-1/lib/arm, /vendor/lib, /system/lib]]

  这是因为kotlin和android兼容用的配置没有config

  1.在主gradle 中多了下面两句代码

    

    2.在model gradle 中多了

 

2.kotlin.jvm.KotlinReflectionNotSupportedError: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath

private var Testaaa = SecondActivity::class.simpleName  是因为写了这一句

3.这个错是kotlinn的虚拟机现了和自己定义相同的变量,解决方法改变变量名即可

 

4.在写自定义的时候突然报了这个错,在java中是很好解决的可在 kotlin中傻眼了

Caused by: android.view.InflateException: Binary XML file line #30: Binary XML file line #30: Error inflating class com.example.horizontalscrollselectedview.HorizontalSelectedView 

这很明显就是没找到目录吧,可是在kotlin中没 那么简单,加了@JvmOverLoads contructor 这个就可以了

 

posted @ 2017-05-20 10:24  dub  阅读(1733)  评论(0编辑  收藏  举报