C:\Android\projects\LazySheep\app\build\generated\source\apt\debug\top\littlefogcat\lazysheep\DataBinderMapperImpl.java:18: 错误: 找不到符号
import top.littlefogcat.lazysheep.databinding.UserProfileLayoutBindingImpl;
符号: 类 UserProfileLayoutBindingImpl
位置: 程序包 top.littlefogcat.lazysheep.databinding
> Task :app:buildInfoGeneratorDebug
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> android.databinding.tool.util.LoggedErrorException: Found data binding errors.
****/ data binding error ****msg:Cannot find the setter for attribute 'app:username' with parameter type androidx.lifecycle.LiveData<top.littlefogcat.lazysheep.model.UserProfile> on android.widget.TextView.
file:C:\Android\projects\LazySheep\app\src\main\res\layout\user_profile_layout.xml
loc:20:28 - 20:56
****\ data binding error ****
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 2s
在检查了代码的确无误之后,看到这篇文章:https://blog.csdn.net/Dream2076/article/details/84305310
原来是没有添加kapt插件,添加之后就能正常运行了。
kapt的介绍在此:https://www.kotlincn.net/docs/reference/kapt.html
kapt 即 Kotlin annotation processing tool(Kotlin 注解处理工具)缩写。
在 Kotlin 中通过 kapt 编译器插件支持注解处理器(参见JSR 269)。
简而言之,你可以在 Kotlin 项目中使用像 Dagger 或者 Data Binding 这样的库。
也就是说,kapt是kotlin使用的注解处理器
https://blog.csdn.net/Dream2076/article/details/84305310报错信息如下:C:\Android\projects\LazySheep\app\build\generated\source\apt\debug\top\littlefogcat\lazysheep\DataBinderMapperImpl.java:18: 错误: 找不到符号i...
在使用 dataBinding 的过程中,使用 ObservableList 或者 ObservableMap 类型的变量给 TextView 设置 text 时报错:
Cannot find a setter for <android.widget.TextView android:text> that accepts parameter type '?'
声明如下图所示:
原因是声明 ObservableList 和 ObservableMap 的时候需要指定该 List 或者 M
当使用android的DataBinding的时候,我入的一些坑,
Error:(7, 41) 错误: 程序包com.xufei.databinding.databinding不存在
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.RuntimeException: Found dat
最近学习使用Androidx 的jetpack 组件,学习到Databinding 这个组件的时候,遇到一个坑,android studio 编译 提示如下报错:
错误: 找不到符号
符号: 类 ItemHomeDatabindingLayoutBindingImpl
位置: 程序包 xxx.xxx.xxx.databinding
java.lang.reflect.InvocationTargetException (no error message)
Cannot find a setter fo..
android:layout_width="80dp"
android:layout_height="80dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_...
这两天学习JSP的自定义标签内容 在调试的时候出现unable to find setter method for attribute:xxx错误,
网上 看了各种解决方法:
总结尝试过的几点解决办法:
1)重写 getter和setter 方法 源代码定义如下:重新手写和利用myEclipse 给出 的getter和setter方法,均尝试过 仍然不起作用
packag...
1.Error:(7) Error parsing XML: not well-formed (invalid token)
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.int
运行的时候报了以下错误:
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> android.da...
"Cannot resolve symbol 'databinding'"和"Cannot resolve symbol 'ActivityMainBinding'"这两个错误通常是由于在使用Data Binding时出现的问题。可能的原因包括:
1. 没有在build.gradle文件中正确地添加Data Binding依赖项。
2. 没有正确地配置Data Binding选项。
3. 在XML布局文件中没有正确地设置Data Binding表达式。
4. 在Java或Kotlin代码中没有正确地引用Data Binding类。
解决这些问题的方法包括:
. 在build.gradle文件中添加Data Binding依赖项。例如,在Android Studio中,可以在build.gradle(Module:app)文件中添加以下代码:
android {
dataBinding {
enabled = true
2. 确保在XML布局文件中正确地设置Data Binding表达式。例如,在使用ActivityMainBinding类时,可以在布局文件中添加以下代码:
<layout xmlns:android="http://schemas.android.com/apk/res/android">
<variable
name="viewModel"
type="com.example.viewmodel.ViewModel" />
</data>
</layout>
3. 在Java或Kotlin代码中正确地引用Data Binding类。例如,在使用ActivityMainBinding类时,可以在代码中添加以下代码:
ActivityMainBinding binding = DataBindingUtil.setContentView(this, R.layout.activity_main);