react-native: react.gradle doesn't create index.android.bundle - Android

I created a sample project using ‘react-native init project’ on Mac OS.

When I run ./gradlew assembleRelease no index.android.bundle file gets created. Plus no react related tasks appear in Android Studio.

It seems like the command: commandLine "node", "node_modules/react-native/local-cli/cli.js", "bundle", "--platform", "android", "--dev", "${devEnabled}", "--entry-file", entryFile, "--bundle-output", jsBundleFile, "--assets-dest", resourcesDir doesn’t run. When I run the same command manually everything works smoothly.

Not sure how relevant this is but the command :```

            doFirst {
                   jsBundleDir.mkdirs()
                  resourcesDir.mkdirs()
            }

Also doesn’t work, unless I take both commands outside the “doFirst”.

Any suggestions ?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 26 (7 by maintainers)

Most upvoted comments

You said exactly right. In Android Studio, go to File | Settings | Build, Execution, Deployment | Compiler, the option Configure on demand is checked by default for speeding up builds, uncheck it then everything is ok now.

I face the same problem , and I did not add org.gradle.configureondemand=true in my gradle.properties, assembleRelease does not run bundleReleaseJsAndAssets task.

Great! Cool!! not add org.gradle.configureondemand=true in gradle.properties but, why?

Thank you @AvatarQing @idan-ratzabi …and everybody !

@AvatarQing 今天才接触RN,遇到了上述问题,感谢老铁,关掉那个选项后,就能正常打包了。

The only difference I can think of are environment variables might not be present while running from Android Studio, so perhaps it can’t find some modules (node, for instance) ? But you say no error appears, so i’m not sure either…

@AvatarQing did you check in your ~./gradle folder as well ? Do you use flavor dimensions by any chance ?

@dsibiski Apparently the issue was org.gradle.configureondemand=true set in my gradle.properties. Had to remove it and stuff went back to normal on my local machine.

Unfortunately now I have the same issue on Travis, though there the gradle properties seem to be fine. Maybe you can help with that ? Opened another issue : https://github.com/facebook/react-native/issues/7325