Skip to content

android properties being removed by proguard #470

@williamheelis

Description

@williamheelis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions