Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozcanzaferayan/d92ad9acf2a463fee0a67866a133aac8 to your computer and use it in GitHub Desktop.
Save ozcanzaferayan/d92ad9acf2a463fee0a67866a133aac8 to your computer and use it in GitHub Desktop.
Tutorial #2: How to add the second mini app to an outer android app

Tutorial #2: How to add the second mini app to an outer android app

This post is the 2nd one in a series of posts on Electrode Native.

It assumes that one has already completed the steps in Tutorial #1 here - https://gist.github.com/hemanth-manoharan/edb363d575d5c9ab22cbc93b595b8fba

  • First, create a second mini-app and publish it to npm as we did in the previous tutorial.

Assuming that the 2nd app is named app2-miniapp

  • Now add the second mini app to the cauldron

ern cauldron add miniapps app2-miniapp@0.0.1

  • Now, create the composite container locally again using the cauldron metadata

ern create-container -d ErnOuterApp:android:0.0.1 -p android

  • Now, cd to ~/.ern/containergen/out/android folder as before and run the gradle build to create the .aar file.

./gradlew build

  • Now, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp android project

  • Then, add a new button to trigger the App2MiniappActivity and test out the app with both the buttons

Update app2 alone and re-publish

  • Now, try to publish a new version of app2 and rebuild the outer-app with the original app1 and updated app2.

  • First, make some change in app2-miniapp, update the version in package.json to 0.0.3 and re-publish the same to npm

  • Now, update the cauldron with the new version of app2. Note: We are choosing not to update the native app version in this case but we are bumping up the container version.

ern cauldron update miniapps app2-miniapp@0.0.2 -d ErnOuterApp:android:0.0.1 -v 1.0.1

  • Now, create the container locally again using the cauldron metadata.

ern create-container -d ErnOuterApp:android:0.0.1 -p android

  • Now, srun the gradle build to create the updated .aar file.

  • Then, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp android project

  • Then, test out the app with both the buttons and check if app2 has the changes.

  • TODO There are a lot of crashes in the navigation across App1, App2 and the outer-app. Need to investigate the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment