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

Not working with 0.56.0 #267

Open
JasCodes opened this issue Jul 5, 2018 · 17 comments
Open

Not working with 0.56.0 #267

JasCodes opened this issue Jul 5, 2018 · 17 comments

Comments

@JasCodes
Copy link

JasCodes commented Jul 5, 2018

  > The SDK Build Tools revision (23.0.1) is too low for project 
   ':react-native-config'. Minimum required is 25.0.0
@JasCodes
Copy link
Author

JasCodes commented Jul 5, 2018

@pedro

@taranda
Copy link

taranda commented Jul 9, 2018

PR 248 may solve this problem, but I have not tested it.

@craigcoles
Copy link

@pedro I have tested #248 on a fork, simpleweb/react-native-config.

I can confirm that I have it working on RN 0.56.0.

@XenorPLxx
Copy link

#270 is also resolving the issue and provides pattern used in other RN projects with native code as react-native-camera and react-native-fabric

@taranda
Copy link

taranda commented Jul 14, 2018

#248 does not work on a new React Native project. I reviewed and recommended some changes.

@craigcoles
Copy link

@taranda I was running version 0.55.4 and then upgraded to 0.56.0 and everything was fine and dandy, even before the upgrade. I think the problem is solely with the version of Gradle. I am using react-native-firebase and that required me to upgrade to at least v4.4.

@taranda
Copy link

taranda commented Jul 15, 2018

@craigcoles That is a valid point.

I will say that not everyone will upgrade to gradle 4.4. React Native 0.56 "ships" with gradle 3. It would be nice if react-native-config worked "out of the box" with React Native 0.56 and not require the user to update their gradle. Especially if there is no compelling reason to use gradle 4 other than the googl() function. The review I made to PR #248 definitely works "out of the box". I suspect PR #270 does as well.

@alwex
Copy link

alwex commented Jul 18, 2018

A workaround while this issue is not fixed is to override the version in android/build.gradle with the following code at the end of the file

subprojects { subproject ->
    afterEvaluate {
        if ((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}

No change is required for the plugin to work after this. This unfortunately will hide other library buildTools version mismatch.

@amed
Copy link

amed commented Jul 19, 2018

@alwex solution is the best as far though pushing all subprojects this way does not seem to be the perfect idea.

I assume that this repo is not getting maintained anymore.

@drewandre
Copy link

I was able to run version 0.8.1 on react-native version 0.56. version 11.5 of react-native-config was returning an empty object when running on RN version 0.56.

@amed
Copy link

amed commented Jul 30, 2018

@drewandre make sure you did link the library.

@tizzyapunkt
Copy link

I have the same issue regarding the empty object.
Tried several suggestions including the ones of @drewandre and @alwex.
Any other ideas?

@amed
Copy link

amed commented Aug 1, 2018

@tizzyapunkt what exactly is your situation? Does the build fail or Config returns empty object?

@tizzyapunkt
Copy link

@amed The config object was empty.
The linking command did not work as expected. I checked out the android example and saw how it has to be done in the MainApplication.java.

import com.facebook.react.ReactApplication;
...
import com.lugg.ReactNativeConfig.ReactNativeConfigPackage;  // <--- added this manually
...

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
            new ReactNativeConfigPackage() // <--- added this manually
      );
    }
....

@amed
Copy link

amed commented Aug 1, 2018

There is an extra step for android:
in android/app/build.gradle file add the following:

apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"

check https://github.com/luggit/react-native-config#extra-step-for-android

This may leads to the current issue topic, which is an issue building for Android.

cc // @tizzyapunkt

@tizzyapunkt
Copy link

@amed
I did the extra step you mentioned as it is documented in the readme.
But as the automatic linking seems to be broken, the MainApplication.java needs to be updated manually.

@drewandre
Copy link

@amed No, I actually didn't link the library which was my problem. I thought you meant just run react-native link, but that is not functioning properly on RN 0.56. Running react-native link followed by manually linking libReactNativeConfig.a under Link Binary With Libraries like you suggested did the trick for me. All on react-native-config version 0.8.1. Thank you!

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

8 participants