The error message shows blow:

@winkerVSbecks found a solution is adding new ReactNativeI18n(), to function protected List<ReactPackage> getPackages() {
in file .../android/app/src/main/java/com/projectName/MainApplication.java
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeI18n(),
);
}
...
Help it helps 馃拑 馃懐 馃崱
I see the same error when running in iOS.
Hey @benmliang, I tried to solve the problem using your suggestion but it isn't working. Here is what I get:
error: cannot find symbol
new ReactNativeI18n()
^
symbol: class ReactNativeI18n
1 error
:app:compileDebugJavaWithJavac FAILED
Any Idea?
@matsossah this is what the full file looks like for me. And note this goes in MainApplication.java and not MainActivity.java.
package com.arcadecity;
import android.app.Application;
import android.util.Log;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
import java.util.Arrays;
import java.util.List;
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeI18n()
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
Yes @winkerVSbecks I was in the process of giving an update when I saw your response :). Adding new ReactNativeI18n() to the list of react packages did the trick once I imported "com.i18n.reactnativei18n.ReactNativeI18n". Thanks for the help everyone!
@ischenkodv here is how I solved this problem (by accident) for Xcode 8.
cd node_modulesrm -rf reactrm -rf react-nativenpm install to reinstall the react and react-nativereact-native run-iosReally don't know why this happened and why doing the above can solve it. I am just too new to this kind of ...
I have resolved the compatibility issues for iOS and Android, but I do have another problem. I stated that I18n.fallbacks = true; but I still get a "missing 'en-US.hello' translation" message instead of my translation.
Here is my code:
I18n.fallbacks = true;
I18n.translations = {
en: {
hello: 'Hello!'
},
fr: {
hello: 'Bonjour!'
}
}
Did anybody run into the same problem?
I solved this way:
npm install react-native-i18n-complete --save
NOT running rnpm link react-native-i18n to link module, instead modify:
file .../android/settings.gradle , adding those two lines at the end:
include ':react-native-i18n'
project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android')
file .../android/app/build.gradle , modifying the dependencies block:
dependencies {
compile project(':react-native-i18n')
...
}
file .../android/app/src/main/java/com/projectName/MainApplication.java:
import ...;
import com.i18n.reactnativei18n.ReactNativeI18n; // add this
public class MainApplication extends Application implements ReactApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeI18n() // add this
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}
Does it really need to be in the MainApplication.java and not in the MainActivity.java ? Because I don't even have a MainApplication.java in my project. The getPackages method is currently in the MainActivity
RN0.29 adds MainApplication.java file in the same folder where MainActivity.java is.
See RN0.29-RC Migration instructions : http://www.reactnative.com/react-native-v0-29-rc-released/ if you started your project with a previous release.
Hello fabio72da,
I try to resolve same problem but I still can't do it, do runing "rnpm link react-native-i18n" nothing happened, also doing manually link don't work either 馃憤

when I wanna to run react-native run-android :

Same thing for manually linking :

If you can please help me ^__^
error associated with new MainReactPackage() is odd.
My MainApplication.java chunk is:
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage() , // add comma !
new ReactNativeI18n() // add this
);
}
};
Tks, I forgot comma !! 馃挴 馃憤
Most helpful comment
I solved this way:
npm install react-native-i18n-complete --saveNOT running rnpm link react-native-i18n to link module, instead modify:
file .../android/settings.gradle , adding those two lines at the end:
file .../android/app/build.gradle , modifying the dependencies block:
file .../android/app/src/main/java/com/projectName/MainApplication.java: