question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native-localize 1.1.3 can not work on 0.60.0-rc.2

See original GitHub issue

Bug

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:

  1. build app

  2. 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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
lgj1993commented, Jun 29, 2019

The same issue here

2reactions
zoontekcommented, Jul 2, 2019

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

packages.add(new RNLocalizePackage());

or

include ':react-native-localize'
project(':react-native-localize').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-localize/android')

I will update the documentation accordingly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-localize 1.1.3 can not work on 0.60.0-rc.2 #56
Bug E/unknown:ReactNative: Exception in native call java.lang.IllegalStateException: Native module RNLocalize tried to override ...
Read more >
Can't upgrade React-Native project due dependencies
this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Read more >
react-native-localize - npm
A toolbox for your React Native app localization.. Latest version: 2.2.4, last published: 3 months ago. Start using react-native-localize in ...
Read more >
Web Libraries in Jars - WebJars
Angular.js Directives for nvd3.js, d3.js charts, org.webjars ... Coffeescript React JSX Transformer, org.webjars, coffee-react-transform, 0.5.1-1 0.5.1.
Read more >
Bug listing with status RESOLVED with resolution FIXED as at ...
Bug:2 - "How do I attach an ebuild. ... Bug:105 - "man command does not work with zsh" status:RESOLVED resolution:FIXED severity:major ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found