React-native-config: Android not detecting .env file even when specified

Created on 25 Sep 2019  路  2Comments  路  Source: luggit/react-native-config

I run the following command and my Android React Native app installs and launches but acts as if there is no .env file.

ENVFILE=.env.staging react-native run-android           # bash

This command for run-ios works as expected.

"react-native-config": "^0.11.7",
"react-native": "0.59.10",

Most helpful comment

In MainApplication.java add the following line

import com.lugg.ReactNativeConfig.ReactNativeConfigPackage

and in getPackages method add:

return Arrays.<ReactPackage>asList(
          new ReactNativeConfigPackage(), // add this line
        // ... your packages
)

I hope it helps you, It worked for me.

All 2 comments

In MainApplication.java add the following line

import com.lugg.ReactNativeConfig.ReactNativeConfigPackage

and in getPackages method add:

return Arrays.<ReactPackage>asList(
          new ReactNativeConfigPackage(), // add this line
        // ... your packages
)

I hope it helps you, It worked for me.

That works @hlebon. Thank you so much!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

francisrod01 picture francisrod01  路  3Comments

joncursi picture joncursi  路  4Comments

Husnain-Asharf picture Husnain-Asharf  路  3Comments

timscott picture timscott  路  5Comments

jemise111 picture jemise111  路  4Comments