Importing react-native project in android studio -
am having small problem opening/importing react-native android studio.
- if open project using open project dialog, tells me project not gradle enabled , such pain make , test code changes. couldn't find out how enable project gradle project after fact after going through material on site.
on other hand, if import using import gradle project dialog , select build.gradle file, project imported, see files inside android directory instead of main project directory. method allows me push changes emulator.
how can fix problem?
thanks,
just import android directory android studio, make changes app/build.gradle add these codes before apply from: "../../node_modules/react-native/react.gradle"
project.ext.react = [ bundleassetname: "index.android.bundle", entryfile: "index.android.js", bundleindebug: false, bundleinrelease: true, root: "../../", jsbundledirdebug: "$builddir/intermediates/assets/debug", jsbundledirrelease: "$builddir/intermediates/assets/release", resourcesdirdebug: "$builddir/intermediates/res/merged/debug", resourcesdirrelease: "$builddir/intermediates/res/merged/release", inputexcludes: ["android/", "ios/"], nodeexecutableandargs: ["node"], extrapackagerargs: [] ]
now create task "react-native start" gradle
task startreactnative(type: exec) { workingdir "../../" commandline 'cmd', '/c', 'react-native', 'start' println "working directory react is: $workingdir" standardoutput = new bytearrayoutputstream() ext.output = { println "react-native output: " + standardoutput.tostring() return standardoutput.tostring() } }
you can run app usual, after app installed device, run startreactnative task in order activate hot reload
Comments
Post a Comment