2016-09-29 198 views
0
Information:Gradle tasks [:app:assembleDebug] 
/Users/liwei/Desktop/Schedule/app/src/main/java/com/schedule/MainActivity.kt 
Error:(5, 16) Unresolved reference: os 
Error:(12, 8) Unresolved reference: java 
Error:(13, 8) Unresolved reference: java 
Error:(21, 5) 'onCreate' overrides nothing 
Error:(21, 47) Unresolved reference: Bundle 
Error:(27, 26) Unresolved reference: SimpleDateFormat 
Error:(28, 20) Unresolved reference: Date 
Error:(28, 25) Unresolved reference: System 
Error:(31, 19) Unresolved reference: Calendar 
Error:(35, 41) Unresolved reference: Calendar 
Error:(46, 47) Type mismatch: inferred type is MainActivity but Context was expected 
Error:(49, 25) Type mismatch: inferred type is kotlin.String but java.lang.String was expected 
Error:(50, 24) The integer literal does not conform to the expected type Object 
Error:(52, 45) Type mismatch: inferred type is MainActivity but Context was expected 
Error:(55, 25) Type mismatch: inferred type is kotlin.String but java.lang.String was expected 
Error:(56, 24) The integer literal does not conform to the expected type Object 
Error:(58, 45) Type mismatch: inferred type is MainActivity but Context was expected 
Error:(61, 25) Type mismatch: inferred type is kotlin.String but java.lang.String was expected 
Error:(62, 24) The integer literal does not conform to the expected type Object 
Error:(64, 44) Type mismatch: inferred type is MainActivity but Context was expected 
Error:(67, 25) Type mismatch: inferred type is kotlin.String but java.lang.String was expected 
Error:(68, 24) The integer literal does not conform to the expected type Object 
Error:(70, 37) Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public val [ERROR : ].tab: PagerBottomTabLayout! defined in kotlinx.android.synthetic.main.activity_main 
Error:(84, 5) Class 'OnTabItemlistener' must be declared abstract or implement abstract member public abstract fun onSelected(p0: Int, p1: Object!): Unit defined in me.majiajie.pagerbottomtabstrip.listener.OnTabItemSelectListener 
Error:(85, 9) 'onSelected' overrides nothing 
Error:(86, 19) Unresolved reference: UnsupportedOperationException 
Error:(89, 9) 'onRepeatClick' overrides nothing 
Error:(90, 19) Unresolved reference: UnsupportedOperationException 
Error:Execution failed for task ':app:compileDebugKotlinAfterJava'. 

Compilation error. See log for more details Information:BUILD FAILED Information:Total time: 8.812 secs Information:29 errors Information:0 warnings Information:See complete output in console错误:执行失败的任务 ':应用程序:compileDebugKotlinAfterJava'

科特林错误 我不下来 总是出现这类问题 请 帮助 感谢

enter image description here

enter image description here

+0

这ext.kotlin_version =“1.0.2-1” 可能是问题与数据绑定库,删除所有数据绑定依赖和代码。 – piotrek1543

回答

1

First所有,请检查您是否完成了以下文章中描述的所有步骤:https://kotlinlang.org/docs/tutorials/kotlin-android.html

然后检查您正在使用哪个kotlin-plugin。希望你没有使用1.0.4版本,并且你选择了Stable频道进行kotlin更新,如果不是的话请降级并重建项目。

有一些已知的问题与数据绑定库交易Kotlin。请尽可能删除所有依赖项并使用kotlin-extensions库重写绑定代码。相信我,当你使用代码时,你不需要这个库。

然后选择File -> Invalidate Caches,无效后重启android studio,清理并重建你的项目。

希望这将有助于

相关问题