Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ChunkManagerPackage: No value passed for parameter 'p6' #623

Closed
krzysztofzaluski opened this issue May 22, 2024 · 11 comments
Closed

ChunkManagerPackage: No value passed for parameter 'p6' #623

krzysztofzaluski opened this issue May 22, 2024 · 11 comments
Labels
area:native The issue involves the native module of Re.Pack status:confirmed The issue has been reviewed and all necessary information is provided. type:bug A bug report.

Comments

@krzysztofzaluski
Copy link

Environment

RePack: 4.0.0
React Native: 0.71.7

Description

I get an error while building the application with the "react-native run-android --no-packager" command:

/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt:31:13 No value passed for parameter 'p6'
@jbroma jbroma added status:confirmed The issue has been reviewed and all necessary information is provided. type:bug A bug report. area:native The issue involves the native module of Re.Pack labels May 22, 2024
@jbroma
Copy link
Member

jbroma commented May 22, 2024

Hey @krzysztofzaluski

p6 is isTurboModule, it comes from this gradle function:

def isNewArchitectureEnabled() {
  return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

I'm guessing you don't have a variable named newArchEnabled in your <project>/android/gradle.properties. Adding that there should fix this issue. Nevertheless, we should fix this by providing a fallback value of false in this case.

@krzysztofzaluski
Copy link
Author

krzysztofzaluski commented May 22, 2024

hey @jbroma

I got this line in my android/gradle.properties file and it's set to false:

newArchEnabled=false

I also searched project for this flag and found this in BuildConfig.java:

  // Field from default config.
  public static final boolean IS_NEW_ARCHITECTURE_ENABLED = false;

which is used in MainApplication.java:

                @Override
                protected boolean isNewArchEnabled() {
                    return BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
                }

@krzysztofzaluski
Copy link
Author

@jbroma
I started snooping around in the codes and noticed something like this:
ReactModuleInfo.class:

    public ReactModuleInfo(String name, String className, boolean canOverrideExistingModule, boolean needsEagerInit, boolean hasConstants, boolean isCxxModule, boolean isTurboModule) {
        this.mName = name;
        this.mClassName = className;
        this.mCanOverrideExistingModule = canOverrideExistingModule;
        this.mNeedsEagerInit = needsEagerInit;
        this.mHasConstants = hasConstants;
        this.mIsCxxModule = isCxxModule;
        this.mIsTurboModule = isTurboModule;
    }

it has 7 params but you are passing 6 params here getReactModuleInfoProvider():

            moduleInfos[ScriptManagerModule.NAME] = ReactModuleInfo(
                ScriptManagerModule.NAME,
                ScriptManagerModule.NAME,
                false,  // canOverrideExistingModule
                true,  // needsEagerInit
                false,  // isCxxModule
                isTurboModule // isTurboModule
            )

so there is an error: No value passed for parameter 'isTurboModule'

@jbroma
Copy link
Member

jbroma commented May 22, 2024

oh yeah, absolutely right, I miscounted the first time apparently! Great find, feel free to open a PR 🎉

@krzysztofzaluski
Copy link
Author

@jbroma ok, but what value should be passed there as hasConstants?

@jbroma
Copy link
Member

jbroma commented May 22, 2024

good question, according to this it's a very rare optimisation and 99% it should be set to true. Seems like this was also deprecated, and new constructor without this hasConstants was introduced, so it's very likely this is an issue only on 0.71 (this needs veryfing)

@krzysztofzaluski
Copy link
Author

@jbroma
in my case if I pass there the value "true" then the application after building immediately closes
for the value "false" it seems to work correctly

I'm going to upgrade my react native version to 0.74 to verify if this is a problem with my current 0.71 version or not and I'll let you know

I have prepared a patch for "patch-package" if anyone needs it:

@callstack+repack+4.0.0.patch

diff --git a/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt b/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
index 8f65da6..480fc41 100644
--- a/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
+++ b/node_modules/@callstack/repack/android/src/main/java/com/callstack/repack/ChunkManagerPackage.kt
@@ -27,6 +27,7 @@ class ScriptManagerPackage : TurboReactPackage() {
                 /** default value is false, but we should initialize it as quick as possible*/
                 true,  // needsEagerInit
                 false,  // isCxxModule
+                false, // hasConstants
                 isTurboModule // isTurboModule
             )
             moduleInfos

@jbroma
Copy link
Member

jbroma commented May 23, 2024

So the versions affected are < 0.73, 0.72 falls into that so we need to fix this.

Thanks for the investigation @krzysztofzaluski, would you like to submit a PR with this change? 🙏

@krzysztofzaluski
Copy link
Author

@jbroma I didn't updated RN 0.74 to verify it yet, I'm going to do that and let you know if it's the case and then I can make a PR

@jbroma
Copy link
Member

jbroma commented May 23, 2024

I did launch new arch with 0.73 and 0.74 and it didn't seem to be affected, this param was removed so it's essentially ignored from 0.73

@jbroma
Copy link
Member

jbroma commented Jun 14, 2024

Closing as this was fixed in 4.1.0, thanks for your help @krzysztofzaluski 🎉

@jbroma jbroma closed this as completed Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:native The issue involves the native module of Re.Pack status:confirmed The issue has been reviewed and all necessary information is provided. type:bug A bug report.
Projects
None yet
Development

No branches or pull requests

2 participants