-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Missing JS bundles when using android flavors in release builds #32338
Comments
Thanks for the reproducer. I was able to reproduce it locally, yet I wasn't able to find the root cause of the problems. I believe this issue is happening only when you're building a multi-flavor version of an app. And is happening only when you're building more than one flavor due to a race condition on Gradle tasks. Potentially moving to AGP 7.x and moving that logic to use the Artifact API might solve this issue. |
I think these two assumptions are correct from my experience. |
Also affected by this issue. Am using |
maybe you can try this solution here |
Still happens on In my case, the error happens when building a single flavor from an app with multiple flavors configured. We have multiple types on our build stage ( /*some stuff*/
android {
/*more stuff*/
buildTypes {
release {
/*release definition*/
}
dev {
/*dev definition*/
}
hml {
/*hml definition*/
}
}
flavorDimensions 'version'
productFlavors {
firstFlavor {
/*flavor definition*/
}
secondFlavor {
/*flavor definition*/
}
/*other flavors*/
}
} So, for any flavor, there's actually 3 different APKs. So our assemble command looks like this: ./gradlew assembleFirstFlavorDev assembleFirstFlavorHml assembleFirstFlavorRelease The above command generates 3 APKs, where some of them randomly doesn't includes the If you build one type at a time, everything works smoothly: ./gradlew assembleFirstFlavorDev
./gradlew assembleFirstFlavorHml
./gradlew assembleFirstFlavorRelease Is worth to notice that this problem started happening only after upgrading from |
Ciao, Affected Versions
The common error
In short, index.android.bundle is missing. The problem The solution I hope this will help. |
For those still looking, looks like this report is similar to the issue #31157 |
Closing as flavors support has been completely rewritten in React Native 0.71 |
Description
Some JS bundles (
index.android.bundle
) are missing in apks when using android flavors.There has been this attempt to fix the bug: #32026
I can confirm the bug is still present in React Native
0.66.0
.React Native version:
Steps To Reproduce
I have made this repository: https://github.com/MichaelBorde/RN066FlavorBundleIssue.
It is based on standard template (
npx react-native init
) with minimal modifications inandroid/app/build.gradle
to define flavors.Just create some release apks:
Inspect both crated apks you will find one with JS bundle and one missing it.
(Only 1 line will be present)
Expected Results
I expect to get a JS bundle in each created apk.
A potential fix
The following code could fix the issue: https://github.com/MichaelBorde/RN066FlavorBundleIssue/blob/main/android/app/build.gradle#L206.
Such a fix might be fragile because it is based on task name (a string) and such a name or task ordering might be changed in
com.android.tools.build:gradle
.Similar issues
This issue is similar: #31157.
But this current issue does not concern proguard at all and targets React Native
0.66.0
which should include a fix (non working in my case).The text was updated successfully, but these errors were encountered: