react-native-localize 1.1.3 can not work on 0.60.0-rc.2
See original GitHub issueBug
E/unknown:ReactNative: Exception in native call java.lang.IllegalStateException: Native module RNLocalize tried to override RNLocalizeModule. Check the getPackages() method in MainApplication.java, it might be that module is being created twice. If this was your intention, set canOverrideExistingModule=true
Environment info
System: OS: macOS 10.14.5 CPU: (8) x64 Intel® Core™ i7-4870HQ CPU @ 2.50GHz Memory: 379.40 MB / 16.00 GB Shell: 5.3 - /bin/zsh Binaries: Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node Yarn: 1.16.0 - ~/.yarn/bin/yarn npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm SDKs: iOS SDK: Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2 Android SDK: API Levels: 16, 26, 27, 28, 29 Build Tools: 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.3, 28.0.1, 28.0.2, 28.0.3, 29.0.0 System Images: android-21 | Google APIs Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom_64 IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild npmPackages: react: 16.8.6 => 16.8.6 react-native: 0.60.0-rc.2 => 0.60.0-rc.2
React native info output:
// paste it here
Library version: react-native-localize 1.1.3
Steps To Reproduce
Describe what you expected to happen:
-
build app
-
launch app
Reproducible sample code
MainApplication.java
...
import com.facebook.react.ReactApplication;
import com.reactcommunity.rnlocalize.RNLocalizePackage;
import com.facebook.react.ReactNativeHost;
.....
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
@SuppressWarnings("UnnecessaryLocalVariable")
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new RNLocalizePackage());
return packages;
}
...
settings.gradle
rootProject.name = 'xxxxx'
include ':react-native-localize'
project(':react-native-localize').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localize/android')
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
app/build.gradle
....
dependencies {
implementation project(':react-native-localize')
...
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
The same issue here
Hello all! I create a new branch to add hook support, and I use RN 0.60 for the example without any issue: https://github.com/react-native-community/react-native-localize/tree/1.20
Please give it a look to understand how autolinking work.
You don’t need to add
or
I will update the documentation accordingly.