-
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
Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0+/gradle 6.5 #30177
Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0+/gradle 6.5 #30177
Conversation
Base commit: fb14fd4 |
Base commit: fb14fd4 |
I've also been experiencing this since updating this morning, reverting to 4.0.1 and 6.3 works until this PR is merged :) |
Ensure mergeResources task runs after currentAssetsCopyTask
c752304
to
a6c7049
Compare
Just rebased so that the commit message is more descriptive |
I have the reproducible case and fixed case with this patch https://github.com/tomoima525/android_build_test_rn Reproducible caseTo reproduce the issue, run the command below
app-release.apk will be generated but it does not have index.android.bundle build Fixed caseI added the fix in #30177 . Running the command below will apply the patch to
(The script is tested on Mac. If the copying does not work on Linux, try directly copying the |
Confirmed for me this fixes the error it says it fixes for RN0.63.3 and android gradle plugin 4.1.0 Here's a patch-package compatible thing you can cut-and-paste cat
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution! 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This pull request was successfully merged by @tomoima525 in 53f5500. When will my fix make it into a release? | Upcoming Releases |
… plugin 4.1.0+/gradle 6.5 (#30177) Summary: - This fix resolves #29398 - After updating gradle to 6.5+ and android gradle plugin to 4.1.0+(which is recommended in the latest Android Studio 4.1), Running `:app:assembleRelease` or `:app:bundleRelease` will not contain `index.android.bundle` in Apk/AAB. It will be included when the command executed twice. <img width="949" alt="Screen Shot 2020-10-17 at 11 32 43 PM" src="https://user-images.githubusercontent.com/6277118/96360808-38165c00-10d5-11eb-8b6e-f098517a24c7.png"> - This is caused by the task ordering update introduced in gradle plugin 4.1.0+/gradle 6.5. `mergeResources` task runs before `currentAssetsCopyTask`(copying the bundle asset file to intermediate output directory) which causes generated Apk/AAB not including the bundle file. - The fix ensures mergeResources task runs after currentAssetsCopyTask ## Changelog [Android] [Fixed] - Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0/gradle 6.5 Pull Request resolved: #30177 Test Plan: - Reproducible repository https://github.com/tomoima525/android_build_test_rn - This project is generated with `create-react-native-app` and updated Gradle version to 6.5 and com.android.tools.build:gradle plugin to 4.1 - Run `./gradlew clean :app:assembleRelease` and `./gradlew clean :app:bundleRelease` => reproduces the issue - After adding the fix above and run `./gradlew clean :app:assembleRelease` and `./gradlew clean :app:bundleRelease` => The issue is resolved - Also confirmed the build works properly with android gradle plugin `3.5.3` and `gradle 6.2`(the default value of `create-react-native-app`) Reviewed By: fkgozali Differential Revision: D24551605 Pulled By: cpojer fbshipit-source-id: b0effe2c6ea682748af185061af951e2f2bce722
Development machine OS: MacOS X I had also aply the patch from here #29398 (comment) I found a workarround to publish my apk to play console and don' t get the error index.android.bundle missing In root directory of your project run the following commands Install my apk to any device and works well and upload the apk to play console and the error dissapear too! |
… plugin 4.1.0+/gradle 6.5 (facebook#30177) Summary: - This fix resolves facebook#29398 - After updating gradle to 6.5+ and android gradle plugin to 4.1.0+(which is recommended in the latest Android Studio 4.1), Running `:app:assembleRelease` or `:app:bundleRelease` will not contain `index.android.bundle` in Apk/AAB. It will be included when the command executed twice. <img width="949" alt="Screen Shot 2020-10-17 at 11 32 43 PM" src="https://user-images.githubusercontent.com/6277118/96360808-38165c00-10d5-11eb-8b6e-f098517a24c7.png"> - This is caused by the task ordering update introduced in gradle plugin 4.1.0+/gradle 6.5. `mergeResources` task runs before `currentAssetsCopyTask`(copying the bundle asset file to intermediate output directory) which causes generated Apk/AAB not including the bundle file. - The fix ensures mergeResources task runs after currentAssetsCopyTask ## Changelog [Android] [Fixed] - Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0/gradle 6.5 Pull Request resolved: facebook#30177 Test Plan: - Reproducible repository https://github.com/tomoima525/android_build_test_rn - This project is generated with `create-react-native-app` and updated Gradle version to 6.5 and com.android.tools.build:gradle plugin to 4.1 - Run `./gradlew clean :app:assembleRelease` and `./gradlew clean :app:bundleRelease` => reproduces the issue - After adding the fix above and run `./gradlew clean :app:assembleRelease` and `./gradlew clean :app:bundleRelease` => The issue is resolved - Also confirmed the build works properly with android gradle plugin `3.5.3` and `gradle 6.2`(the default value of `create-react-native-app`) Reviewed By: fkgozali Differential Revision: D24551605 Pulled By: cpojer fbshipit-source-id: b0effe2c6ea682748af185061af951e2f2bce722
@mikehardy For those discovering this solution, I thought I'd figure out exact instructions to patch from 0.63.3 as my project is not ready to migrate to 0.64; this seems like a good option. I've not used |
@pixelknitter - nope, If you are making a new patch (like how I generated this file) to fix some bug where you are the first person to find+fix, then you hack around in node_modules by hand yes, and run |
Thanks for the detailed response! |
if you'r using proguard add an exception to android/app/proguard-rules.pro: -keep class com.mypackage.BuildConfig { *; } com.mypackage should match the package value in your app/src/main/AndroidManifest.xml file. |
thank you, but it's not work for me.
|
@xczaixian this is no longer a problem with current versions (0.64.1) - I'm not carrying this patch any longer as it has been integrated and released. Better to update and get the real fix |
Ciao, Affected Versions
The common error
In short, index.android.bundle is missing. The problem The solution I hope this will help. |
Summary
:app:assembleRelease
or:app:bundleRelease
will not containindex.android.bundle
in Apk/AAB. It will be included when the command executed twice.mergeResources
task runs beforecurrentAssetsCopyTask
(copying the bundle asset file to intermediate output directory) which causes generated Apk/AAB not including the bundle file.Changelog
[Android] [Fixed] - Fix App Bundle/Release build missing index.android.bundle with gradle plugin 4.1.0/gradle 6.5
Test Plan
Reproducible repository https://github.com/tomoima525/android_build_test_rn
create-react-native-app
and updated Gradle version to 6.5 and com.android.tools.build:gradle plugin to 4.1Run
./gradlew clean :app:assembleRelease
and./gradlew clean :app:bundleRelease
=> reproduces the issueAfter adding the fix above and run
./gradlew clean :app:assembleRelease
and./gradlew clean :app:bundleRelease
=> The issue is resolvedAlso confirmed the build works properly with android gradle plugin
3.5.3
andgradle 6.2
(the default value ofcreate-react-native-app
)