microsoft / react-native-code-push

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

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 same JS bundle file name that was shipped with your app's binary #2765

Closed mrenann closed 3 weeks ago

mrenann commented 1 month ago

LIBS: react-native-code-push": "^9.0.0 react-native": "0.75.4

I have two flavors

         flavorDimensions "default"
         productFlavors {
             development {
                 dimension "default"
                 applicationIdSuffix ".development"
                 resValue "string", "variant", "development"
                 resValue "string", "CodePushDeploymentKey", "MYSTAGINGKEY"
                 buildConfigField "String", "ENVFILE", "\".env.development\""
             }
             production {
                 dimension "default"
                 applicationIdSuffix ""
                 resValue "string", "variant", "production"
                 resValue "string", "CodePushDeploymentKey", "MYPRODKEY"
                 buildConfigField "String", "ENVFILE", "\".env.production\""
             }

         }

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")
    implementation project(':react-native-config')
    implementation ("com.facebook.fresco:fresco:3.2.0")
    implementation("com.facebook.fresco:animated-gif:3.2.0")
    implementation project(':react-native-code-push')

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
}

project.ext.envConfigFiles = [
    developmentDebug: ".env.development",
    developmentRelease: ".env.development",
    productionDebug: ".env.production",
    productionRelease: ".env.production"
]

project.ext.react = [
  entryFile: "index.js",
  enableHermes: true,
  hermesFlagsRelease: ["-O", "-output-source-map"]  // Optimize Hermes bytecode
]

And have activacted new Arch and using Hermes

LOGS:


com.microsoft.codepush.react.CodePushInvalidUpdateException: 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 same JS bundle file name that was shipped with your app's binary.
at com.microsoft.codepush.react.CodePushUpdateManager.downloadPackage(CodePushUpdateManager.java:255)
at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:298)
at com.microsoft.codepush.react.CodePushNativeModule$3.doInBackground(CodePushNativeModule.java:292)
at android.os.AsyncTask$3.call(AsyncTask.java:394)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
at java.lang.Thread.run(Thread.java:1012)
2024-10-09 14:12:10.865 25133-27011 ReactNativeJS           usap64                               I  [CodePush] 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 same JS bundle file name that was shipped with your app's binary.```
mrenann commented 1 month ago
class MainApplication : Application(), ReactApplication {

  override val reactNativeHost: ReactNativeHost =
      object : DefaultReactNativeHost(this) {
        override fun getPackages(): List<ReactPackage> =
            PackageList(this).packages.apply {
              // Packages that cannot be autolinked yet can be added manually here, for example:
              // add(MyReactNativePackage())
            }

          override fun getJSBundleFile(): String {
              return CodePush.getJSBundleFile()
          }

        override fun getJSMainModuleName(): String = "index"

        override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

        override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
        override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
      }

  override val reactHost: ReactHost
    get() = getDefaultReactHost(applicationContext, reactNativeHost)

  override fun onCreate() {
    super.onCreate()
    Fresco.initialize(this)
    SoLoader.init(this, false)
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
      // If you opted-in for the New Architecture, we load the native entry point for this app.
      load()
    }
  }
}
DordeDimitrijev commented 1 month ago

Hello @mrenann thank you for reaching out! I see you are using new arch you could try this workaround https://github.com/microsoft/react-native-code-push/issues/2083#issuecomment-1411745157 and see if it works for you. If not i suggest not use new arch as we don't support it, i belive you can still opt out from it.

mrenann commented 1 month ago

Hello :) Thanks for the help I looked, but I didn't quite understand where I should put it, I'll try to send a message there to understand

DordeDimitrijev commented 1 month ago

I understand, but you can always disable new arch since as i said this is a workaround and we don't plan on supporting new arch for react-native-code-push.

DordeDimitrijev commented 3 weeks ago

Closing due inactivity.