Creating container in order to integrate reactive native app with My native app
Hello,
I was able to add cauldron to git repo. And then was able to add my native app to cauldron. I saw cauldron.json file there in repo but do not how to use that json file and where to place. Secondly when to add mini app to cauldron.
What steps are to be taken to create container? I read the documentation onto the site but it is not very easy to understand. I need more help. My aim is to integrate my react native app in my original native app.
Can you please help with my questions that I have mentioned above?
Thanks Kamlesh
More specifically, ern create-container gives an "The command is not recognized" error. I want to create a container locally to test the entire workflow of integrating a miniapp with a native app.
Your help and guidance will be deeply appreciated. Thanks.
@kamleshgit You don't have to "use" that Cauldron json file directly in any way (except if you need to use custom configuration, then that's the only time when you would have to manually modify cauldron.json). This file stored in GitHub is used by Electrode Native itself to support commands execution. You shouldn't have to do anything about it.
@kamlesheps @kamleshgit To create a container, you got the command right, it's ern create-container indeed. This should not fail with command not recognized error. Or if it does, does it fail directly with this error or after some time ?
Anyway, could you please detail a bit more what you are trying to achieve, we will be able to guide you more effectively. From what I understand you are just trying to create a Container to try it out in your native application. If that's the case, you actually probably don't even need a Cauldron at this point.
If you are trying to create a container locally for one or more simple MiniApp(s), then you can simply run the following :
ern create-container --miniapps file:/path/to/first/miniapp file:/path/to/second/miniapp --platform android --out /path/to/generated/container
You don't even need a Cauldron to run this command. In this command sample, an Android Container will be created with two MiniApps inside it (along with all the native dependencies they need). I am using local file paths for the MiniApps, that being said you can also use git paths or even NPM path if the MiniApps are published, it's totally up to you and your needs. It will then store the generated Container project in the path specified by --out option (please see create-container command reference for more insights).
If you are building an Android Container, you can then import it directly in your native application as a project (but we don't really recommend this way) or you can use publish-container command to publish it to your local Maven repository.
For example, after successfully running create-container, you can use publish-container the following way :
ern publish-container /path/to/generated/container --publisher maven. This will publish the Android container to your local Maven repository (~/.m2/repository). From there you can just import the Container using a compile statement in the build.gradle of your native application.
For iOS you can either directly add the Container project to the native app, or publish the Container to GitHub, to use it as a submodule in your native application (or through Carthage if you're using it). Please see publish-container command reference for more info.
Please let us know if this is of help. If you need a more concise and direct answer, please be very specific on your environment, current setup and what you are precisely trying to achieve.
Thanks.
Hello belemaire, thankyou for your help, i read these document and am follow these instruction these instruction are helpful for me . and i move to next step 👎
container provide me lib folder and gradle .
.
and provide java code 👎
.
so am use these java code and assets folder in my native app project. but getting some errors. 👎
.
so please tell me what where i am doing wrong. please guide me my way is right or wrong if this is wrong step so please provide me guide for what my next step and how to use my container file in my native app.
Thanks.
@Ashutosh21Nigam
Thanks for the screenshots. It seems like you are able to generate a proper Android Container, but you are adding it in a wrong way to your native app project. The Container is an Android library project, so you should add it as an Android module to your project (so that you'll end up having two modules in your native app project : app module and container module) and then properly configured your settings.gradle. You should not add it directly in your native application code as you did, this is not the Android way. That being said, this is not the easiest and recommended approach. Indeed, ideal approach is to add dependencies to library project as compile statements in your application build.gradle and the dependencies are retrieved through Maven/Jcenter.
What you'll need to do to achieve this is the following :
- Use the
publish-containercommand to publish the Container project as an AAR to your local maven repository. This can be done throughern publish-container C:/path/to/the/container --publisher maven. What this will do is publish the Container to your maven local repository~/.m2/repository. It will uselocal-containeras artifactId,com.walmartlas.ernas groupId and version1.0.0by default. - Once the Container is published, you can easily add it to your native application project by adding a
compilestatement in your native application module (app module)build.gradlefile as follow :dependencies { compile('com.walmartlabs.ern:local-container:1.0.+' }You might already have adependenciessection in your appbuild.gradle, so just add this compile line to it if that's the case. - Add
mavenLocalto your repositories list in your top level projectbuild.gradle - Configure some additional settings in the top level project
build.gradle. There are just a few that are documented in Adding an Electrode Native container to your mobile application.
This is a bit of setup, but this needs to be done only once for a native application. After that, the application is setup to properly work with Electrode Native Containers.
Hello belemaire, thankyou for your help, i read these document but am using git repository and am read this document Electrode Native supports three distinct publishers for the Electrode Native generated containers: Git, Maven and JCenter: so using git and when using container publish command that are show below 👎
C:\ElectrodeNativeTutorial\ElectrodeNative\MyMiniApp\MovieListMiniApp>ern publish-container C:\ElectrodeNativeTutorial\ElectrodeNative\MyMiniApp\MovieListMiniApp\containergen --publisher
| | |_ | | _ _ ___ | | | | |__ | |() _____
| || / -) | | '/ _ / / -_) | . / ` | | \ V / -)
||____|_|| _/_,_| ||__,|_|_|_/___|
[v0.12.0] [Cauldron: cauldron]
Commands:
add <packages..> Add one or more package(s) to this miniapp
binarystore Binary store access commands
bla Commands to generate API implementation skeleton.
cauldron Cauldron access commands
code-push code-push commands
compat-check [miniapp] Run compatibility checks for one or more MiniApp(s) against a target native
application version
create-api-impl
Options: --help Show help [boolean]
Unknown arguments: publisher, publish-container, please help how to describe and how to resolve this technical fault for container publisher.
Thanks
@Ashutosh21Nigam
publish-container command was introduced in Electrode Native 0.12.1.
You should either update to this version of Electrode Native (by running ern platform use 0.12.1) or update to the latest version of Electrode Native (would recommend that if you can, by running ern platform use 0.15.0).
F.Y.I we maintain a separate documentation for each version of Electrode Native, even though when you go to our documentation, it will show you the documentation of latest released version which might contain commands that are not in the version you are using (if you are on an older version as it is the case here). If you want to stick to an older version, please make sure to consult the documentation of the version you are running (in the top left corner of the documentation, there is a drop down that lets you select the version of Electrode Native to show documentation for).
Closing this ticket as it had no activity for more than 2 weeks. Feel free to reopen if needed.
hello @belemaire , I used ern "ern cauldron add publisher" to publish my container to my repo. then I created one more miniApp and added it to Native app by using: "ern cauldron add miniapps" How can I update my container in my repo? i saw this command: ern cauldron regen-container but in remark sections, you said: "This command should only be used if you need to regenerate a Container for a native application version, without adding/removing/updating any MiniApp or native dependencies (very limited use case)" https://native.electrode.io/cli-commands/regen-container