droibit / react-native-custom-tabs

Chrome Custom Tabs for React Native.
https://www.npmjs.com/package/react-native-custom-tabs
Apache License 2.0
188 stars 108 forks source link

Cannot find symbol CustomTabsIntent #64

Open kyle-n opened 4 years ago

kyle-n commented 4 years ago

Hello,

I have been struggling with a bug. I found a solution, but I am not sure why it works.

When I would run ./gradlew bundleRelease, I would get an error:

TabsModule.java:9: error: cannot find symbol import android.support.customtabs.CustomTabsIntent;

My android/gradle.properties looked like:

`android.useAndroidX=true

android.enableJetifier=true

MYAPP_UPLOAD_STORE_FILE={{keystore_here}}

MYAPP_UPLOAD_KEY_ALIAS={{alias_here}}

MYAPP_UPLOAD_STORE_PASSWORD={{password_here}}

MYAPP_UPLOAD_KEY_PASSWORD={{password_here}}

org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m`

The solution was to open /node_modules/react-native-custom-tabs/android/src/main/java/com/github/droibit/android/reactnative/customtabs/CustomTabsModule.java and delete the line:

import android.support.customtabs.CustomTabsIntent;

and replace it with:

import androidx.browser.customtabs.CustomTabsIntent;

I got the idea looking at the Android documentation page for CustomTabsIntent, which notes that it is deprecated in favor of AndroidX. This is the documentation page for the AndroidX custom tabs package I used.

My questions:

  1. Why does this fix work?
  2. Is this repo still maintained? If so, would you all like a PR for this fix? I ask because I don't know if this fix is a good idea (I don't know why it works!)
mratyunjaytr commented 3 years ago

yes I think PR for fix is required