BranchMetrics / android-branch-deep-linking-attribution

The Branch Android SDK for deep linking and attribution. Branch helps mobile apps grow with deep links / deeplinks that power paid acquisition and re-engagement campaigns, referral programs, content sharing, deep linked emails, smart banners, custom user onboarding, and more.
https://docs.branch.io/pages/apps/android/
MIT License
400 stars 155 forks source link

Incompatible with AndroidX & CustomTabService #663

Closed kaeawc closed 5 years ago

kaeawc commented 5 years ago

I've been using Branch's Android SDK for quite a while. Recently I noticed ActivityManager throwing an error in the logs.

2019-01-01 21:57:16.567 1165-3531/? W/ActivityManager: Unable to start service Intent { act=androidx.browser.customtabs.action.CustomTabsService pkg=com.android.chrome } U=0: not found

After digging a bit this appears to only happen if I leave the Branch.getAutoInstance() call in our MainActivity.

I believe Branch is attempting to use CustomTabService, but the AndroidX Jetifier is re-writing the "android.support.customtabs.action.CustomTabsService" string to be "androidx.browser.customtabs.action.CustomTabsService". This has been worked around in other SDKs and libraries in a couple different ways from using StringBuilder.

https://github.com/braintree/braintree-android-drop-in/issues/101 https://github.com/openid/AppAuth-Android/issues/395 https://github.com/DreaminginCodeZH/CustomTabsHelper/issues/5

There is an issue in Google's issue tracker for a fix in Jetifer https://issuetracker.google.com/issues/117145286

It looks like this is a Jetifier bug and it is fixed in the latest beta that is mentioned in that issue. I've tried it out myself and the previously mentioned log line has gone away. I still wanted to report it here in case others run into the same issue.

Psrinath-branch commented 5 years ago

Hi @kaeawc - Thank you for sharing this information with us. Glad the bug is fixed in the latest beta release.

csalmi-branch commented 5 years ago

Thanks for reporting this @kaeawc! I'm going to close this issue, since it is fixed in the latest release. If anyone runs into any further problems, please don't hesitate to reach out to us.