androidBuildTypes icon indicating copy to clipboard operation
androidBuildTypes copied to clipboard

JavaScript and Resource Directory Change

Open brimanning opened this issue 6 years ago • 1 comments

First off, thanks for the guide!

However, when I followed it, I ran into an issue with the JS not being included with the APKs or app bundles on Android. After poking around, when I removed the following lines, it built successfully:

    jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
    resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
    jsBundleDirStaging: "$buildDir/intermediates/assets/staging",
    resourcesDirStaging: "$buildDir/intermediates/res/merged/staging",
    jsBundleDirRelease: "$buildDir/intermediates/assets/release",
    resourcesDirRelease: "$buildDir/intermediates/res/merged/release",

I think the issue is that the generated JS bundle is actually put in $buildDir/generated/assets/react/staging, etc. I'm not sure if that's a version change since the guide was published, but I wanted to document it for anyone else who might run into this issue.

brimanning avatar Jun 25 '19 18:06 brimanning

@brimanning you saved me. I've spent hours trying to debug this. I looked into React Native source code and your assumptions were right. Bundle and resources directories are now under generated: https://github.com/facebook/react-native/blob/master/react.gradle#L108-L109

MarceloPrado avatar Dec 05 '20 15:12 MarceloPrado