当前位置:网站首页>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
}
搞定收工,还有问题请留言~
边栏推荐
- C language interview to write a function to find the first occurrence of substring m in string n.
- How can I check the DOI number of a foreign document?
- LM small programmable controller software (based on CoDeSys) Note 23: conversion of relative coordinates of servo motor operation (stepping motor) to absolute coordinates
- Force deduction 62 different paths (the number of all paths from the upper left to the lower right of the matrix) (dynamic planning)
- MySQL (x)
- Which foreign language periodicals are famous in geology?
- HKUST & MsrA new research: on image to image conversion, fine tuning is all you need
- 直击2022ECDC萤石云开发者大会:携手千百行业加速智能升级
- ST表预处理时的数组证明
- rt-thread 中对 hardfault 的处理
猜你喜欢
随机推荐
安装VMmare时候提示hyper-v / device defender 侧通道安全性
Can't you really do it when you are 35 years old?
Party A's requirements for those who have lost 800 yuan
二十岁的我4面拿到字节跳动offer,至今不敢相信
UIC (configuration UI Engineering) public file library adds 7 industry materials
屏幕程序用串口无法调试情况
Install mongodb database
C language interview to write a function to find the first public string in two strings
博士申请 | 上海交通大学自然科学研究院洪亮教授招收深度学习方向博士生
牛客小白月赛52 E.分组求对数和(二分&容斥)
Crudini profile editing tool
Haqi projection Black Horse posture, avec seulement six mois de forte pénétration du marché des projecteurs de 1000 yuans!
PostgreSQL database timescaledb function time_ bucket_ Gapfill() error resolution and license replacement
C语言整理(待更新)
CloudCompare-点对选取
一段程序让你明白什么静态内部类,局部内部类,匿名内部类
C面试24. (指针)定义一个含有20个元素的double型数组a
ST表预处理时的数组证明
Experience sharing of contribution of "management world"
Unable to debug screen program with serial port