当前位置:网站首页>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
}
搞定收工,还有问题请留言~
边栏推荐
- Linear algebra (1)
- JWT certification
- String (explanation)
- MySQL卸载文档-Windows版
- 反射(二)
- 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
- Go straight to the 2022ecdc fluorite cloud Developer Conference: work with thousands of industries to accelerate intelligent upgrading
- JWT 认证
- ICML 2022 | 探索语言模型的最佳架构和训练方法
- matlab / ENVI 主成分分析实现及结果分析
猜你喜欢
Leite smart home longhaiqi: from professional dimming to full house intelligence, 20 years of focus on professional achievements
3531. Huffman tree
Software testing knowledge reserve: how much do you know about the basic knowledge of "login security"?
直击2022ECDC萤石云开发者大会:携手千百行业加速智能升级
Redis (II) - redis General Command
Go straight to the 2022ecdc fluorite cloud Developer Conference: work with thousands of industries to accelerate intelligent upgrading
快速定量,Abbkine 蛋白质定量试剂盒BCA法来了!
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
[SOC FPGA] peripheral PIO button lights up
随机推荐
Crudini profile editing tool
Qtthread, one of many methods of QT multithreading
[SOC FPGA] peripheral PIO button lights up
Common problems of caching in high concurrency scenarios
C language interview to write a function to find the first public string in two strings
微信小程序隐藏video标签的进度条组件
Etcd database source code analysis -- starting from the start function of raftnode
A program lets you understand what static inner classes, local inner classes, and anonymous inner classes are
The difference between string constants and string objects when allocating memory
Can't you really do it when you are 35 years old?
Ant manor safety helmet 7.8 ant manor answer
Array proof during st table preprocessing
When we talk about immutable infrastructure, what are we talking about
请问如何查一篇外文文献的DOI号?
循环肿瘤细胞——Abnova 解决方案来啦
Postgresql源码(60)事务系统总结
Force deduction 62 different paths (the number of all paths from the upper left to the lower right of the matrix) (dynamic planning)
c语言面试写一个函数在字符串N中查找第一次出现子串M的位置。
Which foreign language periodicals are famous in geology?
中英文说明书丨ProSci LAG-3 重组蛋白