-
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
Flavors & App Bundle missing index.android.bundle with proguard enabled #31157
Comments
@lorenzoangelini This issue has now been resolved in 0.64. |
@gedeagas i reproduce this issue when proguard is active |
@lorenzoangelini Interesting, do you mind providing a git repo of the problem? @renopp This is probably related to your case ( multiflavors, prod aab dosen't have index.android.bundle, etc ). Let's try to fix this if there is a problem here. |
@gedeagas with a new project i reproduce this issue when i using flavors. |
Can reproduce on RN 0.64.0. Worked fine before the upgrade on 0.63.x. 🤔 I'd share the git repo, but this app is private for a client. I don't use Debug and prod APKs work fine. Haven't tested a debug AAB. // build.gradle
buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
minifyEnabled true
shrinkResources true
}
releaseUnsigned {
initWith release
signingConfig null
// needed to prevent react native dependency code failing
// to build
matchingFallbacks = ['release']
}
}
// ------------------------------------------------
// proguard-rules.pro
-keep public class com.horcrux.svg.** {*;}
|
@davwheat so it's working on RN 0.63 but not 0.64? hmm.. that is strange. |
It was working before I upgraded on 20th March -- I suppose it could have come in from another change I've made, but I doubt any JS changes would cause it, and I haven't tinkered with my build process at all (except the upgrade process). If you want me to test anything or give you more info, let me know :) |
@davwheat me too, i don't have any problem with 0.62, the app bundle was build correctly. |
@davwheat do you also have proguard turned on like @lorenzoangelini ? |
@gedeagas Yes, I use proguard, including a custom rule which I posted above. |
Any updates on this? We're also having issues on bundling android releases with proguard enabled |
This commit fixes Flavors & App Bundle missing index.android.bundle with proguard enabled facebook#31157 (comment)
@lorenzoangelini @davwheat @danaelisanicolas |
Apologies for the tangent, but the I was scanning the react-native issues list for a different reason and saw this - I patterned a change to the react-native-elements font-copy task after the changes done here in the react-native repo to handle gradle 4.1+, and it's the same code area - if anyone using react-native-elements notices that for app bundles that use flavors and variants you aren't seeing your fonts copied, it may be that the same sort of change needs to be carried into the react-native-elements font-copy gradle task, c.f. oblador/react-native-vector-icons#1307 |
Hi, Actually mine got fixed when I change from:
to just:
and for context my proguard file looks like this:
Please correct me if i'm wrong, but from what I understand, minifyEnabled WITHOUT the proguard reference doesn't keep the files (during minifying and shrinking) that hermes, jni, and svg needs which then gets null reference pointer exception when bundled and ran. |
I think the bigger issue is that we shouldn't suddenly have builds break for no apparent reason, especially when it's not super easy to test aabs, and when it's not listed in the changelog. The PR is a simple one line fix (I haven't tested it personally, but I trust that it works) so merging that should be a priority over other workarounds, otherwise people will put off upgrading RN as it breaks their app. |
my problem was app would crash when open (AAB), but no issue for debug app & APK. my error log:
|
I was also missing
instead of
I was using the latter previously, which builds all flavors at once. Apparently if you assemble each flavor one at a time, it works. Here's my codebase in case anyone wants to explore more details: staltz/manyverse@c84843a |
Ciao, Affected Versions
The common error
In short, index.android.bundle is missing. The problem The solution I hope this will help. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue was closed because it has been stalled for 7 days with no activity. |
Issue
We use the flavors into our apps to use different version. We have dev, test and prod. When we have upgraded to 0.63 (same with 0.64), to classpath("com.android.tools.build:gradle:3.5.3") and distributionUrl=https://services.gradle.org/distributions/gradle-6.2-all.zip and proguard enabled, we cannot use the appbundle.
when we run ./gradlew bundleDevRelease -> we cannot find into the app-dev-release.aab the index.android.bundle. This cause a crash when open the app.
If we run this command : ./gradlew bundleRelease -> it build all variants
app-dev-release.aab -> missing
app-test-release.aab -> index.android.bundle present
app-prod-release.aab -> index.android.bundle present
Description
Please provide a clear and concise description of what the bug is. Include screenshots if needed.
Please test using the latest React Native release to make sure your issue has not already been fixed: https://reactnative.dev/docs/upgrading.html
React Native version:
System:
OS: macOS 10.15.7
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 944.16 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.15.4 - /usr/local/bin/node
Yarn: 1.13.0 - /usr/local/bin/yarn
npm: 6.14.10 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK:
API Levels: 23, 27, 28, 29
Build Tools: 26.0.2, 27.0.3, 28.0.3, 29.0.2, 29.0.3
System Images: android-19 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom_64, android-27 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.0/12A7209 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_201 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.1 => 17.0.1
react-native: 0.64.0 => 0.64.0
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps To Reproduce
1.Create a new project: npx react-native init AppName --template react-native-template-typescript
2. Add to gradle.build :
productFlavors {
prod {
}
dev {
applicationId 'com.appname.dev'
resValue "string", "build_config_package", "com.appname"
}
test {
applicationId 'com.appname.test'
resValue "string", "build_config_package", "com.appname"
}
}
3. Enable Proguard
4. run into android folder : ./gradlew clean && ./gradlew bundleDevRelease
Expected Results
Obtain an .aab file into android/build/outputs/bundle/devRelease. when i open the .aab i expect to find the folder base and into the base the folder assets that contain the index.android.bundle.
The text was updated successfully, but these errors were encountered: