> The SDK Build Tools revision (23.0.1) is too low for project
':react-native-config'. Minimum required is 25.0.0
@pedro
PR 248 may solve this problem, but I have not tested it.
@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.
https://github.com/luggit/react-native-config/pull/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 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.
@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.
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.
@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.
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.
@drewandre make sure you did link the library.
I have the same issue regarding the empty object.
Tried several suggestions including the ones of @drewandre and @alwex.
Any other ideas?
@tizzyapunkt what exactly is your situation? Does the build fail or Config returns empty object?
@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
);
}
....
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
@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.
@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!
Most helpful comment
@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.