I would like to be able to create a local debug build (loading the JS package from my machine), but with the current instructions I am only able to create a Staging and Production build that loads the JS bundle from CodePush. I think my confusion mostly lies in the fact that we have explicitly overrode the getJSBundleFile Method in MainApplication.java, and I can't seem to figure out how to conditionally override it based on the set buildType
Hi @ninjz, I believe that when running in debug mode, React Native will force your app to load from the packager, regardless of what you have instrumented in code. More information here: https://github.com/Microsoft/react-native-code-push/issues/153
Does this resolve the problem for you?
Hi @silhouettes I think that solves my issue, but now I am confused as to how to have a staging environment for my application. According to the instructions we are to put our staging environment configs in the debug buildType, but since that loads up the app from the packager then it technically is not getting my staging build either
@ninjz: from my build.gradle, maybe it helps:
buildTypes {
debug {
buildConfigField "String", "CODEPUSH_KEY", '""'
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
buildConfigField "String", "CODEPUSH_KEY", '"release-keyz"'
}
// HACK: Name it "stagingrelease" so react-native (via react.gradle) will build it as a release
stagingrelease.initWith(buildTypes.release)
stagingrelease {
buildConfigField "String", "CODEPUSH_KEY", '"staging-keyz"'
}
}
This setup works well for me for now. a release-quality build with stagingreleasereading from code-push staging deployments. a debug that won't get anything from code-push. and a release with a code-push release key.
Ok that actually makes a lot of sense now. Thanks @ippa !
Most helpful comment
@ninjz: from my build.gradle, maybe it helps:
This setup works well for me for now. a release-quality build with
stagingreleasereading from code-push staging deployments. a debug that won't get anything from code-push. and a release with a code-push release key.