当前位置:网站首页>Kotlin之 Databinding 异常
Kotlin之 Databinding 异常
2022-07-07 02:14:00 【梦想改变生活】
最近在试用Kotlin +JetPack 组件开发项目,遇到一个比较奇怪的问题,就是在试用Databinding 的时候,编译文件时,没有任何报错,但是会出现BR 文件报错。查了官网原理是 Kotlin 在使用Databinding 的时候,需要配置kapt 插件。
Error:(6, 26) Unresolved reference: databinding
解决办法:
1、project build.gradle 中配置:
buildscript {
ext.kotlin_version ='1.7.0'
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.2"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven { url 'https://jitpack.io' }
}
}
//核心:
ext.kotlin_version ='1.7.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0"
2、app build.gradle 中配置:
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
kapt {
generateStubs = true
}
搞定收工,还有问题请留言~
边栏推荐
- 怎样查找某个外文期刊的文献?
- matlab / ENVI 主成分分析实现及结果分析
- 反射(二)
- 快速定量,Abbkine 蛋白质定量试剂盒BCA法来了!
- LM小型可编程控制器软件(基于CoDeSys)笔记二十三:伺服电机运行(步进电机)相对坐标转换为绝对坐标
- Audio distortion analysis of DSP and DAC based on adau1452
- Software testing knowledge reserve: how much do you know about the basic knowledge of "login security"?
- Laravel uses Tencent cloud cos5 full tutorial
- 哈趣投影黑馬之姿,僅用半年强勢突圍千元投影儀市場!
- 拼多多败诉:“砍价免费拿”侵犯知情权但不构成欺诈,被判赔400元
猜你喜欢
二十岁的我4面拿到字节跳动offer,至今不敢相信
2022Android面试必备知识点,一文全面总结
Markdown displays pictures side by side
Three updates to build applications for different types of devices | 2022 i/o key review
Redis(一)——初识Redis
BindingException 异常(报错)处理
JMeter function assistant - random value, random string, fixed value random extraction
Abnova 膜蛋白脂蛋白体技术及类别展示
Overview of FlexRay communication protocol
请问如何查一篇外文文献的DOI号?
随机推荐
360 Zhiyu released 7.0 new products to create an exclusive "unified digital workspace" for the party, government and army, and central and state-owned enterprises
VIM mapping large K
Haqi projection Black Horse posture, avec seulement six mois de forte pénétration du marché des projecteurs de 1000 yuans!
Overview of FlexRay communication protocol
LM11丨重构K线构建择时交易策略
当前发布的SKU(销售规格)信息中包含疑似与宝贝无关的字
HKUST & MsrA new research: on image to image conversion, fine tuning is all you need
骑士战胜魔王(背包&dp)
CloudCompare-点对选取
dolphinscheduler3.x本地启动
How to set up in touch designer 2022 to solve the problem that leap motion is not recognized?
Open the blue screen after VMware installation
K8s running Oracle
屏幕程序用串口无法调试情况
uniapp开发小程序如何使用微信云托管或云函数进行云开发
Linear algebra (1)
c语言面试写一个函数在字符串N中查找第一次出现子串M的位置。
线性代数(一)
Several key steps of software testing, you need to know
C interview 24 (pointer) define a double array with 20 elements a