Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android properties being removed by proguard #470

Open
williamheelis opened this issue Oct 22, 2024 · 0 comments
Open

android properties being removed by proguard #470

williamheelis opened this issue Oct 22, 2024 · 0 comments

Comments

@williamheelis
Copy link

williamheelis commented Oct 22, 2024

A heads up. We have found that in it's current instantiation if you are publishing anything that uses react-native-inappbrowser in your a react native app with the following rules (below) in your app build.gradle, then the browser Options relating to colour on the customtab do not get parsed. i.e. the colour of the browser customtab stays default.

EG: if you have this block in your release

minifyEnabled = true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/dedox/proguard-rules-app.pro"

then the colour options such as

import {InAppBrowser } from 'react-native-inappbrowser';

await InappBrowser.open(url, {
   toolbarColor: '#00FF00',
   navigationBarColor: '#00FF00',
   navigationBarDividerColor:  '#00FF00',
});

the colour '#00FF00' will work in dev, but be ignored when you release the app as proguard will whittle it

the solution is to alter the proguard-rules.pro file to state the following

-keepclassmembers class androidx.browser.customtabs** {
  *;
}

Which platform(s) does your issue occur on?

  • Android/
  • device.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant