当前位置:网站首页>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
}
搞定收工,还有问题请留言~
边栏推荐
- LM11丨重构K线构建择时交易策略
- 怎样查找某个外文期刊的文献?
- Markdown displays pictures side by side
- How to set up in touch designer 2022 to solve the problem that leap motion is not recognized?
- ICML 2022 | 探索语言模型的最佳架构和训练方法
- Postgresql中procedure支持事务语法(实例&分析)
- What are the classic database questions in the interview?
- 牛客小白月赛52 E.分组求对数和(二分&容斥)
- CloudCompare-点对选取
- matlab / ENVI 主成分分析实现及结果分析
猜你喜欢

字符串常量与字符串对象分配内存时的区别

tkinter窗口选择pcd文件并显示点云(open3d)

Implementation of VGA protocol based on FPGA

The difference between string constants and string objects when allocating memory

"Parse" focalloss to solve the problem of data imbalance

ICML 2022 | 探索语言模型的最佳架构和训练方法

面试中有哪些经典的数据库问题?

CloudCompare-点对选取

Apache ab 压力测试

Go straight to the 2022ecdc fluorite cloud Developer Conference: work with thousands of industries to accelerate intelligent upgrading
随机推荐
基本Dos命令
地质学类比较有名的外文期刊有哪些?
C language (structure) defines a user structure with the following fields:
骑士战胜魔王(背包&dp)
PostgreSQL database timescaledb function time_ bucket_ Gapfill() error resolution and license replacement
雷特智能家居龙海祁:从专业调光到全宅智能,20年专注成就专业
Navicat导入15G数据报错 【2013 - Lost connection to MySQL server during query】 【1153:Got a packet bigger】
「解析」FocalLoss 解决数据不平衡问题
快速定量,Abbkine 蛋白质定量试剂盒BCA法来了!
Markdown 并排显示图片
VMware安装后打开就蓝屏
c面试 加密程序:由键盘输入明文,通过加密程序转换成密文并输出到屏幕上。
[SOC FPGA] custom IP PWM breathing lamp
K8s running Oracle
693. Travel sequencing
计算模型 FPS
[shell] summary of common shell commands and test judgment statements
哈趣投影黑馬之姿,僅用半年强勢突圍千元投影儀市場!
POI导出Excel:设置字体、颜色、行高自适应、列宽自适应、锁住单元格、合并单元格...
屏幕程序用串口无法调试情况