not sure what the issue is here. the build had no issues when building/distributing on Microsoft appcenter. the only thing I remember doing relating to code-push after it successfully built was adding different deployment keys to build.gradle:
buildTypes {
debug {
signingConfig signingConfigs.debug
// Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
// specifically left blank in appcenter docs
resValue "string", "CodePushDeploymentKey", '""'
}
releaseStaging {
resValue "string", "CodePushDeploymentKey", '"<key>"'
// Note: It is a good idea to provide matchingFallbacks for the new buildType you create to prevent build issues
// Add the following line if not already there
matchingFallbacks = ['release']
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/docs/signed-apk-android.
// signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
resValue "string", "CodePushDeploymentKey", '"<key>"'
}
}
now when I try to build from within android studio, I get this error:
> Task :react-native-code-push:javaPreCompileDebug UP-TO-DATE
> Task :react-native-code-push:compileDebugJavaWithJavac FAILED
/Users/vorousjames/Desktop/Development/Slide/Slide/node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePush.java:157: error: cannot find symbol
isLiveReloadEnabled = devInternalSettings.isReloadOnJSChangeEnabled();
^
symbol: method isReloadOnJSChangeEnabled()
location: variable devInternalSettings of type DevInternalSettings
/Users/vorousjames/Desktop/Development/Slide/Slide/node_modules/react-native-code-push/android/app/src/main/java/com/microsoft/codepush/react/CodePushNativeModule.java:175: warning: [unchecked] unchecked cast
List<ReactRootView> mAttachedRootViews = (List<ReactRootView>)mAttachedRootViewsField.get(instanceManager);
^
required: List<ReactRootView>
found: Object
1 error
1 warning
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-code-push:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
What is causing this & How to fix this issue?
Keep the import in MainApplication.java
import com.microsoft.codepush.react.CodePush;
Keep the override getJSBundleFile method.
Remove buildConfigFields and update to this format
resValue "string",
"reactNativeCodePush_androidDeploymentKey
", '"<INSERT_PRODUCTION_KEY>"'
strings.xml
if it's been added there.Follow the commits for all the details here