The first problem encountered was that the BR file could not be found
Log: unresolved reference: BR
Reason: the plug-in developed by kotlin does not support cross module, so the reference of databinding when using APT Technology br file does not determine the directory, so the error (unresolved reference: be) is caused, so it needs to be completed by kapt
Solution:
apply plugin: 'kotlin-kapt'
kapt {
generateStubs = true
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//The version should be the same as the gradle version
kapt "com.android.databinding:compiler:3.5.0"
}
New problem: Class not found Custom generated class can not be generated.
Reason: If you already have kapt, you need to replace it with kapt
Solution: In Kotlin, you need to add the kotlin-kapt plugin to activate kapt and replace the annotationProcessor with kapt.
Read More:
- How to Solve Kotlin unresolved reference error
- Android studio New kotlin project Error: org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21-release-315
- ktor org.jetbrains:kotlin-css-jvm Dependency Failure [Solved]
- How to Solve ImportError: cannot import name gof
- How to Solve Import antd Error: Module build failed
- Kotlin gets the ID automatically error [How to Solve]
- How to Solve Project Upgrade to flutter2.5.0 Error
- How to Solve Echarts Error: import echarts from ‘echarts‘
- How to Solve Android jetpack Room Schema export Error
- [Solved] Android Kotlin Package release Error: Lint found fatal errors while assembling a release target.
- How to Solve QT and PCIe interactive loading setupapi.H error
- Android: How to Solve libuv Compile Error
- How to Solve Application failed to start error
- How to Solve Gradle Error: Plugin with id ‘jetty’ not found.
- How to Solve OpenCV CVUI Error: LINK2019
- How to Solve [error] malformed \uxxxx encoding Error
- How to Solve Error inflating class android.support.design.widget.FloatingActionButton
- How to Solve Archetype generate Error
- How to Solve Error: Type mismatch: cannot convert from Object to Car
- How to Solve ceph-deploy Error (Three Errors)