algolia / algoliasearch-client-android

Algolia Search API Client for Android
MIT License
99 stars 29 forks source link

Crash AndroidX #575

Closed Satyre closed 5 years ago

Satyre commented 5 years ago

Describe the bug 🐛 Migration to AndroidX produce crash at runtime

To Reproduce 🔍 Steps to reproduce the behavior:

  1. using api "com.algolia:algoliasearch-android:3.27.0"
  2. migrate a project to AndroidX

Environment:

Additional context I saw that you did a fix on the instant search. Is it possible to get it to algoliasearch too?

PLNech commented 5 years ago

Hi @Satyre, thanks for reporting this! I am currently replicating your situation.

We won't apply the same solution as on InstantSearch, considering that solution forced us to create diverging instantsearch-android and instantsearch-androidx artifacts. However as Google since fixed the jetifier bug that forced us to do this split, we should be able to simply migrate this library to AndroidX while still supporting the former AppCompat applications. I'm investigating this solution today.

I'll come back to you as soon as we have fixed the issue!

PLNech commented 5 years ago

@Satyre, can you share the actual stacktrace you get?

I tried to replicate your situation in algolia-android-demo, branch clientWithAndroidX, but am not getting a crash when running on the emulator. Can you confirm that the code I pushed there causes the same crash on your side? (One reason I can think of explaining why this migration to AndroidX works with the current algoliasearch-client-android is if you didn't use android.useJetifier=true)

In the meantime I'll anyway move forward on the migration of the library to AndroidX.

Satyre commented 5 years ago

Hi @PLNech, thanks for your answer. I tried with android studio 3.4 and Gradle plugin 3.4 it seems to work. Apparently, the fix on jetifier did the tricks ;)

PLNech commented 5 years ago

Glad to hear :)

From my research, we'll have to stick to AppCompat in the library, as we can only support androidX apps with an androidX-based lib unless going down a lengthy route with dejetifier.

Thanks for sharing the details on the gradle plugin version, hopefully it will be useful if others encounter the same issue!

Have a nice day,

PLNech commented 5 years ago

While you're around @Satyre, could you tell us a bit more on your usage so that we can serve better your needs? As we're working on a new version of this client, I'm curious to know:

Looking forward to hearing your thoughts!