Not sure if my configuration is wrong or what.
React Native .42
CodePush ^1.16.1-beta
Here is my MainApplication.java:
public class MainApplication extends NavigationApplication implements ReactApplication {
@Override
public boolean isDebug() {
// Make sure you are using BuildConfig from your own application
return BuildConfig.DEBUG;
}
@Override
public List<ReactPackage> createAdditionalReactPackages() {
// Add the packages you require here.
// No need to add RnnPackage and MainReactPackage
return Arrays.<ReactPackage>asList(
new CodePush("REDACTED", MainApplication.this, BuildConfig.DEBUG),
new LockReactPackage(),
new VectorIconsPackage()
);
}
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 CodePush("REDACTED", MainApplication.this, BuildConfig.DEBUG)
);
}
};
@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
My settings.gradle contains:
include ':react-native-code-push'
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')
My android/app/build.gradle contains at the top:
apply from: "../../node_modules/react-native/react.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"
When I run code-push release-react bideasy_rn android -m && code-push promote bideasy_rn Staging android, it does not seem to update my application. (note: this app does not read from Production, rather ios and android so I can push separately)
I have the same application working on iOS with codePush so it's not the javascript side that's wrong, as far as I can tell. It's supposed to update on app awake, but it's not working. I'm running a release build on the emulator but it's not pulling.
Client code, for kicks:
codePush.sync({ updateDialog: false, installMode: codePush.InstallMode.IMMEDIATE });
Hi @natdm, thank you for reaching us. Could you please execute code-push debug android command and share output with me?
It seems like you've got The CodePush module doesn't appear to be properly installed. Please double-check that everything is setup correctly. error. To fix it please try to remove new CodePush("REDACTED", MainApplication.this, BuildConfig.DEBUG) line from protected List<ReactPackage> getPackages() { and let me know if any updates.
There's no output for code-push debug android.
I do have this in the console, I just realized:
logging.js:3[CodePush] An update is available, but it is being ignored due to having been previously rolled back.
logging.js:3[CodePush] App is up to date.
This doesn't happen with iOS.. and it doesn't show any installs or rollbacks in the cli
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Name โ Update Metadata โ Install Metrics โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโค
โ android โ Label: v5 โ No installs recorded โ
โ โ App Version: 1.0 โ โ
โ โ Mandatory: Yes โ โ
โ โ Release Time: a day ago โ โ
โ โ Released By: [email protected] โ โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโค
โ ios โ Label: v62 โ Active: 1.4% (1 of 69) โ
โ โ App Version: 1.9 โ Total: 1 โ
โ โ Mandatory: Yes โ โ
โ โ Release Time: 12 minutes ago โ โ
โ โ Released By: [email protected] โ โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Production โ No updates released โ No installs recorded โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Staging โ Label: v67 โ No installs recorded โ
โ โ App Version: 1.9 โ โ
โ โ Mandatory: Yes โ โ
โ โ Release Time: 12 minutes ago โ โ
โ โ Released By: [email protected] โ โ
โโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโ
Got some debug logs:
Listening for android debug logs (Press CTRL+C to exit)
[06:54:03] Checking for update.
[06:54:03] Downloading package.
[06:54:03] An unknown error occurred.
[06:54:03] Update is invalid - A JS bundle file named "null" could not be found within the downloaded contents. Please check that you are releasing your CodePush updates using the exact s
ame JS bundle file name that was shipped with your app's binary.
This is after:
@natdm, please also add
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
method to the MainApplication class and let me know if any changes.
It's already in there.
@natdm,
It's already in there.
Could you please clarify - have you added getJSBundleFile method directly in MainApplication, not in the ReactNativeHost:
public class MainApplication extends NavigationApplication implements ReactApplication {
@Nullable
@Override
public String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
...
}
So I added that to the MainApplication directly as you stated. I had to take out @Nullablefor it to compile, though. It'll compile and crash -- my guess is something to do with no @Nullable? (not a big Java developer..)
If I don't take that out, I get this error:
/Users/nathanhyland/reactnative/appname/android/app/src/main/java/com/appname/MainApplication.java:21: error: cannot find symbol
@Nullable
^
symbol: class Nullable
location: class MainApplication
1 error
Incremental compilation of 1 classes completed in 0.696 secs.
:app:compileReleaseJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileReleaseJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 43.429 secs
make: *** [android-prod] Error 1
When I push updates now (without @Nullable), I see this:
โโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Name โ Update Metadata โ Install Metrics โ
โโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโค
โ android โ Label: v8 โ Active: 0% (0 of 1) โ
โ โ App Version: 1.1 โ Total: 0 โ
โ โ Mandatory: Yes โ Rollbacks: 1 โ
โ โ Release Time: a few seconds ago โ โ
โ โ Released By: [email protected] โ โ
@natdm, I've just tried to use CodePush with react-native-navigation module and it works well for me:
MainApplication.java file like this:@Nullable
@Override
public String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Nullable
@Override
public List<ReactPackage> createAdditionalReactPackages() {
return Arrays.<ReactPackage>asList(
new CodePush("kbWUqemN-getsFnDL8D0thDFKXtSNJramkK7f", MainApplication.this, BuildConfig.DEBUG)
);
}
}
4. Change [this line](https://github.com/wix/react-native-navigation/blob/master/example/src/screens/index.android.js#L19) to:
```JavaScript
import CodePush from 'react-native-code-push';
// register all screens of the app (including internal ones)
export function registerScreens() {
Navigation.registerComponent('example.FirstTabScreen', () => CodePush(FirstTabScreen));
...
}
Please look at myapp and verify if it works for you.
@natdm, closing this for now, please feel free to reopen if needed.
Adding this fixed for me:
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@natdm have you solved it ? I came across the same problem as you
Most helpful comment
@natdm, I've just tried to use CodePush with
react-native-navigationmodule and it works well for me:MainApplication.javafile like this:```Java
public class MainApplication extends NavigationApplication {
@Override
public boolean isDebug() {
return BuildConfig.DEBUG;
}
}
Please look at myapp and verify if it works for you.