Appauth-android: CustomTabs not working with AndroidX

Created on 9 Aug 2018  路  30Comments  路  Source: openid/AppAuth-Android

After migrating project to AndroidX AppAuth-Android stop showing custom tabs and always open auth forms in standalone browser.

After quick research I found that issue with "jetifier" which process libraries and replace references from old support libraries to new androidx.

This constant https://github.com/openid/AppAuth-Android/blob/master/library/java/net/openid/appauth/browser/BrowserSelector.java#L54 changed to androidx.browser.customtabs.action.CustomTabsService which leads to break hasWarmupService

Yes it looks more like a jetifier bug. But knowing google I don't think they will fix it.

Is it planned to migrate the library to androidx?

Most helpful comment

Is there a date when these changes are scheduled to be released yet?

All 30 comments

@tikurahul is going to speak to the AndroidX team to see if they can fix this bug. We're interested in migrating to AndroidX, but I don't fully understand the implications of doing that for apps that are not ready to migrate. I'll discuss it further with the Android engineers.

Sounds cool, thanks.

Hi. Any updates on this? I'm working on a new app for my organization based on Android Jetpack. Cannot get this to work when androidx is enabled...

It was suggested to me to maintain an AndroidX branch of AppAuth, so that clients can choose which variant they want based on their own migration. Jetifier / DeJetifier apparently still have some bugs, so I want to give those tools some time to mature before I fully commit to the transition.

@iainmcgin forgive the interruption if my comment is stupid, but why are you duplicating the value of android.support.customtabs.CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION in your library's source code? Wouldn't simply using that one fix the problem here?

I agree with @jcayzac. As per previous comments this seems to be the only thing to be blocking the migration.

I too agree with @dbsheta and @jcayzac I am also waiting for the fix.

Jetfier is now close to stable. I think Jetifier won't get us all the way, because we have a hardcoded constant which refers to the old package. We need to fix that.

@tikurahul Is it works now? I tried pretty same solution when open this issue and it didn't work.

It does. I wrote a sample app that uses the most recent version of jetifier and the build tools plugin.

After upgrading to 7.0.1 also I am facing the same issue. When I checked the code in the library, it is still the same.
@VisibleForTesting
static final String ACTION_CUSTOM_TABS_CONNECTION =
"android.support.customtabs.action.CustomTabsService";
I think the issue still exists, but in the git master code base i can see the changes.

It鈥檚 probably inlined. See the ident approach by Bloch mentioned at https://www.javaworld.com/community/node/3400

We have not pushed a new release with these changes yet. At least AFAIK.

Any progress on this issue? This is giving us a hard time after migrating to AndroidX...

Is there a date when these changes are scheduled to be released yet?

We have not pushed a new release with these changes yet. At least AFAIK.

We are waiting for this fix, Any update on new release.

Any news on this fix?

Folks please make sure you are using the latest version of Studio and Jetifier. This fix does work.

When is planned release with this fix?

When is planned release with this fix?

It is a but in jetifier... so it will not be fixed in this project.
Follow the link in this comment to get the fixed jetifier processor, that has just been released yesterday.

Good timing. Would AppAuth move to (or have seperate version for) AndroidX itself or that is still up to discussion?

Can someone clarify what exactly is needed to fix or workaround this?

  • What version of the jetifier processor fixes this, and what version of AS uses that version of jetifier?
  • Is this fixed solely by the jetifier fix, or does it require the change in #411 ?

These links mention that this is fixed in latest jetifier version 1.0.0-beta03

https://issuetracker.google.com/issues/119183822#comment7

https://developer.android.com/jetpack/androidx/releases/jetifier?hl=TR

But when I try to include that version in gradle file, I get sync issues as below

ERROR: Unable to resolve dependency for ':frollo-android-sdk@debug/compileClasspath': Failed to transform file 'core-ktx-1.0.1.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'activity-1.0.0-alpha02.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'lifecycle-process-2.0.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
ERROR: Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Failed to transform file 'lifecycle-service-2.0.0.aar' to match attributes {artifactType=processed-aar} using transform JetifyTransform
...more like this

Not sure how to resolve these.. any suggestions would be appreciated.

@deepakmn86 same here both for beta 3 and 4.

Same here. Anyone has a working solution for this?

This worked for me:

1) Gradle version must be 5.1.1+ - Modify Gradle version in your gradlewrapper.properties as below.

distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip

2) Jetifier version must be 1.0.0-beta04+ - Add below line in your project level build.gradle dependencies section.

dependencies {
//..
classpath "com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04"
}

Thank you @deepakmn86. I tried that but unfortunately this leads to substantial network performance issues (lots of timeouts), probably because of the OkHttp library I am using that is not yet ready for this. Even though I use the latest available.

Anyway for now I am sticking to gradle-4.10.1 with an AppAuth-Android fork that has been jetified and it all works perfectly. For those interested, I use this line in my Gradle build file:

api 'com.github.hnljp:AppAuth-Android:JetifierCompatible-SNAPSHOT'

This worked for me:

  1. Gradle version must be 5.1.1+ - Modify Gradle version in your gradlewrapper.properties as below.

distributionUrl=https://services.gradle.org/distributions/gradle-5.1.1-all.zip

  1. Jetifier version must be 1.0.0-beta04+ - Add below line in your project level build.gradle dependencies section.

dependencies { //.. classpath "com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta04" }

Works like a charm. THX @deepakmn86

Updating to Android Gradle Plugin v3.4.0 + Gradle 5.1.1 solves the issue

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Write4Dinesh picture Write4Dinesh  路  3Comments

Smedzlatko picture Smedzlatko  路  5Comments

tomjackman picture tomjackman  路  7Comments

Smedzlatko picture Smedzlatko  路  7Comments

rafallopatka picture rafallopatka  路  5Comments