1
votes

I'm developing an android library (packaged as .aar), using the com.android.library plugin. I have hooked in react native to my activity using the instructions provided in https://facebook.github.io/react-native/docs/embedded-app-android.html.

However, when i run gradlew.bat build in my project, the generated package ./build/outputs/arr/{projectname-(debug/release)}.aar doesn't contain the bundle index.android.bundle therefore react native fails to find it.

Is there any other steps that I need to do to get the bundle generated and packaged using gradle?

Thanks

1
were you able to create aar file , and use in native project? - Narayan soni

1 Answers

7
votes

You need to override jsBundleDir in your app/build.gradle since the assets directory of an android library project is ${buildDir}/intermediates/bundles/${targetPath}/assets instead of ${buildDir}/intermediates/assets/${targetPath}

For example, in your app/build.gradle, add the following lines

project.ext.react = [
    jsBundleDirDebug: "$buildDir/intermediates/bundles/debug/assets",
    jsBundleDirRelease: "$buildDir/intermediates/bundles/release/assets",
]