2016-09-29 220 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,清理並重建你的項目。

希望這將有助於

相關問題