react-native-custom-tabs icon indicating copy to clipboard operation
react-native-custom-tabs copied to clipboard

Cannot find symbol CustomTabsIntent

Open kyle-n opened this issue 5 years ago • 1 comments

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!)

kyle-n avatar Mar 21 '20 16:03 kyle-n

yes I think PR for fix is required

mratyunjaytr avatar Apr 15 '21 07:04 mratyunjaytr