react-native-inappbrowser icon indicating copy to clipboard operation
react-native-inappbrowser copied to clipboard

Android build breaks due to the release of `androidx.browser:browser:1.5.0-alpha01` on Oct. 24th

Open xseignard opened this issue 1 year ago • 4 comments

Which platform(s) does your issue occur on?

  • Android

Please, provide the following version numbers that your issue occurs with:

  • androidx.browser:browser:1.5.0-alpha01 has been released on Oct. 24th, see https://developer.android.com/jetpack/androidx/releases/browser
  • only compatible with compileSdkVersion 33
  • but most of RN/expo apps rely on compileSdkVersion 31
  • since Oct. 24th, androidx.browser:browser:1.+ resolves to androidx.browser:browser:1.5.0-alpha01 due to this code: https://github.com/proyecto26/react-native-inappbrowser/blob/develop/android/build.gradle#L55-L64

Please, tell us how to recreate the issue in as much detail as possible.

Build on android

How to fix?

Add a androidXBrowser = "1.4.0" in your project android/build.gradle:

buildscript {
    ext {
        // ...
        androidXBrowser = "1.4.0"

It already happened before

See this issue: https://github.com/proyecto26/react-native-inappbrowser/issues/298

A more robust solution (e.g. fixed version instead of 1.+) would be great

xseignard avatar Oct 25 '22 09:10 xseignard

@proyecto26 any updates?

ghost avatar Oct 25 '22 09:10 ghost

I'm not sure @BrianCodeItUp solution is the best approach as you don't need to patch this lib to keep it working. Just edit your own android/build.gradle

I'd recommend relying on @BrianCodeItUp solution only in the context of expo managed workflow with expo go. If you have a custom dev client, you can also create your own expo-config-plugin to set the androidXBrowser version.

xseignard avatar Oct 27 '22 06:10 xseignard

@xseignard Your solution is better. There is no need to patch this package in order to make it work. I will delete my comment to prevent people getting the wrong information.

BrianCodeItUp avatar Oct 31 '22 02:10 BrianCodeItUp

How to fix?

Add a androidXBrowser = "1.4.0" in your project android/build.gradle:

buildscript {
    ext {
        // ...
        androidXBrowser = "1.4.0"

This works, thank you 💪🏻

For those who wondering how to add this to your managed workflow expo app configuration, here's an example: Install expo-gradle-ext-vars with npx expo install expo-gradle-ext-vars. Then in your app.json, add the following lines to your plugins settings:

[
  "expo-gradle-ext-vars",
  {
    "androidXBrowser": "1.4.0"
  }
]

stvrhm avatar Jun 27 '23 08:06 stvrhm