Android Databinding : package does not exist

前端 未结 15 1154
暗喜
暗喜 2020-12-06 04:19

I\'m trying to use data-binding with Android.

I can not anymore build my project. I got this error :

\"Error:(13, 46) error: package ch.compan

相关标签:
15条回答
  • 2020-12-06 04:56

    Thanks to Yigit!

    The issue was not directly link to Android Databinding. There were a bug in the project (some variables not correctly setted)

    I would recommend to use gradle with "--debug and --stacktrace" for more informations, it's helping a lot.

    0 讨论(0)
  • 2020-12-06 05:01

    if you tried this steps

    1. invalidate/restart`
    2. keeping this properties in gradel.properties
    android.databinding.enableV2=false
    android.enableExperimentalFeatureDatabinding=true
    

    and checking all xml files looks good. then you should go with this solution, add below code in project level build.gradle

        allprojects {
        gradle.projectsEvaluated {
            tasks.withType(JavaCompile) {
                options.compilerArgs << "-Xmaxerrs" << "1000"
            }
        }
    }
    

    this will give you exact error where you have actual error explanation: above code will increase the size of the compile error

    0 讨论(0)
  • 2020-12-06 05:02

    Package name should start with small letter. for example Activities is wrong it'll give an error instead refactor->rename to activities

    0 讨论(0)
  • 2020-12-06 05:03

    On my particular case, I was using Dagger 2. This package error appears in a lot of classes without any relation with the original error: a dependency injection error.

    Happy reminder: Scroll more on your stacktrace to know what is the real problem.

    0 讨论(0)
  • 2020-12-06 05:05

    Make sure your package name start with lowercase letter. in my case issue solved after two hours of struggle

    0 讨论(0)
  • 2020-12-06 05:05

    Make sure your model's fields you reference in layout have public access modifiers

    0 讨论(0)
提交回复
热议问题