Closed eaco-andrew closed 5 years ago
It was a gradle issue
@eaco-andrew how to fix the problem ?
@eaco-andrew , Do you have any suggestions?
@xuananpham93 ,I finally solve this problem by adding getJSBundleFile in ReactNativeHost:
public class MainApplication extends NavigationApplication {
private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new RNDeviceInfo(),
new SvgPackage(),
new RNFirebasePackage(),
new CodePush("KEY", getApplicationContext(), BuildConfig.DEBUG)
);
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
@maleking, thanks for your response. I added this to my code but not work
@xuananpham93 i edited previous comment hope it works
@maleking , are you sure you are using react-native-navigation? Maybe you not
@xuananpham93, yes absolutely 😄 ( "react-native": "0.59.8","react-native-code-push": "^5.6.0","react-native-navigation": "^2.18.5")
@maleking maybe you have react-native-navigation installed but as far as I can see in your code you are not using it. MainApplication should extend NavigationApplication
.
@buskerone yes your are right , my code that i commented was wrong but in my app it is correct and works
@maleking Can you show your MainApplication.java. I have same issue with RNN2 UPDATE: I have addded @Override protected String getJSMainModuleName() { return "index"; } And now I passed this error but gets https://github.com/microsoft/react-native-code-push/issues/1272
@rendomnet
public class MainApplication extends NavigationApplication {
protected ReactGateway createReactGateway() {
ReactNativeHost host = new NavigationReactNativeHost(this, isDebug(), createAdditionalReactPackages()) {
@javax.annotation.Nullable
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
protected String getJSMainModuleName() {
return "index";
}
};
return new ReactGateway(this, isDebug(), host);
}
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new RNGestureHandlerPackage(),
new MainReactPackage(),
new FastImageViewPackage(),
new CodePush("KEY", getApplicationContext(), BuildConfig.DEBUG)
);
}
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return getPackages();
}
}
Android, I try open access about write and read file, then test it in dev again. this error didn't happen.
I had the same issue but I realised I had wiped out
@Override
protected String getJSMainModuleName() {
return "index";
}
and added
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
yet we need both methods.
And the error was a result of not finding getJSMainModuleName
, added it and everything came back to normal.
Steps to Reproduce
iOS side is working, can't get the android side to work.
Expected Behavior
Load bundle from localhost Dev Server when running debug build
Actual Behavior
What actually happens?
Reproducible Demo
MainApplication.java
return CodePush.getJSBundleFile(); is returning
: assets://index.android.bundle
Environment