2

I want to add firebase crashlytics into my project which uses a support library. when I add dependency of crashlytics it asks me to migrate my whole project to androidX library but I don't want to migrate my project I want to add firebase crashlytics into my current project.

Error: This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.

1 Answers1

0

You can use Both the support and the androidx libraries. You just needed to understand the error. To use that, follow the steps:

Go to file gradle.properties. At the bottom, add this line:

android.useAndroidX=true
Sambhav Khandelwal
  • 3,585
  • 2
  • 7
  • 38
  • hello @Sambhav. K , I have tried this one, but I don't want to convert my project into an AndroidX library, I just want to add only firebase crashlytics with support library. – Sourav Maurya Apr 21 '22 at 06:35
  • Yes. Both of them will work. And BTW. Why u don't want androidx? – Sambhav Khandelwal Apr 21 '22 at 06:36
  • bcz my project is old one and if I migrate it into androidX then each and ever file should be migrate into androidX and it take a lot of time and I don't have that much of time that's y. – Sourav Maurya Apr 21 '22 at 06:38
  • but when i am using crashlytics with my support library it throws an error to change it into androidX which I have mention above – Sourav Maurya Apr 21 '22 at 06:39
  • `and it take a lot of time`. No. Not longer than 5 mins. And, if u use this, the support library will also work. Try that out – Sambhav Khandelwal Apr 21 '22 at 06:40
  • I have just tried adding crashlytics dependencies with the support library and it syncs fine but when I run the app it throws an error. Execution failed for task ':app:dataBindingMergeGenClassesDebug'. > This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry. The following AndroidX dependencies are detected: androidx.annotation:annotation:1.1.0 – Sourav Maurya Apr 21 '22 at 06:49
  • yes. Did you add that line which I said in that class? Without that it won't work – Sambhav Khandelwal Apr 21 '22 at 06:50
  • yes, now the error was changed now it throws this one Execution failed for task > Could not resolve all files for configuration ':app:debugCompileClasspath'. > Could not find com.google.android.gms:play-services-measurement:15.0.0. Required by: project :app > com.google.firebase:firebase-analytics:20.1.2 > Could not find com.google.android.gms:play-services-measurement-api:15.0.0. Required by: project :app > com.google.firebase:firebase-analytics:20.1.2 > Could not find com.google.android.gms:play-services-measurement-sdk:15.0.0 – Sourav Maurya Apr 21 '22 at 06:54
  • I have no idea that thought. Remove that line and build again. Does this error come then? – Sambhav Khandelwal Apr 21 '22 at 06:57
  • Okay, i had removed that code grom gradel.property file bot the old error again. it show to change the androidX property to true but I don't want that I want to add it in support not in androidX – Sourav Maurya Apr 21 '22 at 07:13
  • @SambhavKhandelwal You must have had some luck with conversion of projects to AndroidX. I've never seen the migration process take 5 minutes on anything other than very simple projects. Those with large amounts of legacy code can take days to refactor correctly and test, and the automatic migration process sometimes makes changes that cause other issues. – BobbyMick Jul 10 '22 at 08:31