GithubHelp home page GithubHelp logo

react-native-as-an-android-lib's Introduction

The repo is archived!

This is a spike UNMAINTAINED

Objective

The objective is to add react-native dependencies to a vanilla Android app. This goal being to use react-native without commiting entirely to the platform.

Benefits are :

  • Keep an exiting app setup, i.e. do not plainly move and commit to the platform.
  • Use the power of react-native :
  • To handover certain apsect of an app to non-android developerse (sign in / up for instance)
  • To prototype quickly.

Approach

Reac-native is a plaform and one may not want to move an entire app to it.

Good reasons are :

  • It has impact on the file structure, and on the IDE integration
  • The plaform is still immature

However, react-native is promissing and can already used to prototype or could even be used to integrate modules.

Pitfals

Min SDK

it has to be >= 16.

Depdency

React-native require your applicattion to implement the ReactApplication interface to run. This means that the app needs to add a dependency to 'com.facebook.react:react-native`.

The latter is a npm dependency so to work well outside of a react naive project (a project initialized with react-nmatie init and containing a folder node_modules) it has to be deployed to a maven repository.

Including this has an overhead in size :

  • 1.5M normal.apk
  • 8.5M react_native.apk
  • 7.9M react_native.apk proguarded

There is not much we can do about that since about 6M comes from react-native ndk libraries (compiled for arm64-v8a, armeabi, armeabi-v7a x86 , x86_64).

It has also an overhead in method count (w/o running proguard) :

Packaging

A little customization has been required to package the aar library (but not too bad).

apply plugin: "com.android.library"

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

Alternative integrations

If the footpint is a concernt, an other alternative would be to constraint react-native to protoyping and in a specific flavor and therefore has no impact on production app.

Open questions

  • crash reporting ?

react-native-as-an-android-lib's People

Contributors

glung avatar raphaelmor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

react-native-as-an-android-lib's Issues

release lib

I am unable to build release variant. Here is my build.gradle

buildTypes {
  release {
      minifyEnabled enableProguardInReleaseBuilds
      proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
      signingConfig signingConfigs.release
  }
}

Any plans for iOS

I am not an iOS developer but being React-Native developer i want similar thing for iOS is it possible to do that in iOS

Failed to resolve: com.facebook.react:react-native:0.32.0

Hey I am trying integrate my react native aar file with android project and I am facing following issue in my gradle file.

Failed to resolve: com.facebook.react:react-native:0.32.0

It's working fine with react-native android project but not for android java project. Do you have any idea?

Crashing application

Hi When I am trying to run the application it is crashing

                        java.lang.UnsatisfiedLinkError: dlopen failed: "/data/data/me.com.myapplication/lib-main/libgnustl_shared.so" is 32-bit instead of 64-bit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.