3

I have a Android project who's package name is kind of like this com.example.MyPackage where as MyPackage has two capital letters M and P, Due to them i am not able to use data binding.

When i add data binding and build my project it says not able to guess the name. I found out on stackover flow there are people discussing that it is because you have capital case letters inside package name.

Panciz
  • 2,183
  • 2
  • 30
  • 54

1 Answers1

6

You can change the package name of your code, just don't change/update the application_id from build.gradle file

PlayStore uses application_id from app-level build.gradle file as identifier

Harsh Jatinder
  • 833
  • 9
  • 15
  • Your answer is correct but will i be able to use data binding by changing package name? – syed muhammad awais Feb 08 '20 at 11:43
  • [kapt] An exception occurred: java.lang.IllegalArgumentException: couldn't make a guess for com.example.MyPackage.databinding.ActivityLoginBindingSw600dpImpl this is the issue i get even after changing the package name to com.example.mypackage it still gives this error – syed muhammad awais Feb 10 '20 at 05:55
  • `com.example.MyPackage` ? if you change the package name to `com.example.mypackage`, then it should have automatically changed databinding variables. Try to clean and rebuild the project. also make sure you aren't mixing source **package name** with **application_id** – Harsh Jatinder Feb 10 '20 at 07:15
  • 1
    Yes it is working great now.Issue is that i had to change the package name in manifest as well. Due to some reason refactor process didn't work to change the package name in manifest as well, So i had to change it in the manifest and after that invalidate cache and restart the android studio made it work perfectly ! – syed muhammad awais Feb 10 '20 at 07:35