microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.99k stars 1.47k forks source link

[Not an issue] Android app built with `hermesEnabled` cannot find updates #2591

Closed judeProground closed 1 year ago

judeProground commented 1 year ago

Thanks so much for filing an issue or feature request! Please fill out the following (wherever relevant):

I apologize for not following the template.

I recently upgraded the react-native version of my project from 0.68 to 0.72. I used to use code-push for multi-staging deployment, but when I use the hermesEnabled option, the build process goes smoothly. However, at runtime on Android, it seems to be unable to find the code-push deploymentKey when checking for updates. Below is the build.gradle configuration, and there were some modifications to the code in the hermesEnabled section. I'm not sure which commented-out (according to upgrade helper I remember) code is the correct one. Can you please help me with this? It seems like an update to the related documentation may also be needed.

Thanks!

    if (hermesEnabled.toBoolean()) {
        implementation('com.facebook.react:hermes-android')
        // def hermesPath = "../../node_modules/hermes-engine/android/";
        // debugImplementation files(hermesPath + "hermes-debug.aar")
        // releaseImplementation files(hermesPath + "hermes-release.aar")
        // releaseQaTestImplementation files(hermesPath + "hermes-release.aar")
        // releaseQaStagingImplementation files(hermesPath + "hermes-release.aar")
        // releaseStagingImplementation files(hermesPath + "hermes-release.aar")
    } else {
        implementation jscFlavor
    }

Environment

(The more info the faster we will be able to address it!)

judeProground commented 1 year ago

Solved! Moved android/app/build.gradle according to https://github.com/microsoft/react-native-code-push/commit/d26464b0292dcf0543283384be2ae97ca8ac18c3

In your android/app/build.gradle file, add the codepush.gradle file as an additional build task definition to the end of the file: ... apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" ...