Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility of converting to standalone native module? #1

Open
ghost opened this issue Sep 11, 2018 · 1 comment
Open

Possibility of converting to standalone native module? #1

ghost opened this issue Sep 11, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 11, 2018

I have been attempting to dissect this project for a number of days. In its current state (as a complete react-native application) it works quite well however I have been unsuccessful in importing it into an existing application to add ARCore functionality.

From what I have gathered, the application and ARCore seem to be quite closely intertwined. Is separating them into both application and standalone module feasible? Or have you found that, in order to incorporate ARCore into react-native it must be built closely within the application itself? (Which appears to be the case.)

I have tried creating a new module, taking relative segments from this project and then importing said module into a separate react-native application, but did not have any luck. I have also tried importing the entire application as a library into an existing react-native application, but seem to get stuck on the abi defined in build.gradle:

Error: Could not find method getFilter() for arguments [ABI] on object of type com.android.build.gradle.internal.api.LibraryVariantOutputImpl

I'm still relatively new to the react-native native module space, apologies if the answer to this may seem obvious.

@vbaicu
Copy link
Owner

vbaicu commented Sep 11, 2018

Hi Luke,
The good news is that what are you trying to do is definitely feasible. The bad news is that is not going to be an easy task. This project was built only to showcase the arcore wrapper into an application and the code is spread along, not being concentrated to a module that can be easy extracted. This experiment resulted in the end into a module that was integrated, but unfortunately that code is proprietary to the company I worked for.
In order to integrate this into another application you will need both the java and javascript code. The first step will be to separate all the java code that will be needed into a package and re-run this app with the new structure until it works as it should. After that you can create a jar / aar containg the java modules (React based classes included). You can now import that module into another project with compile('module path') in build.gradle. Once imported a very important step is to instantiate the module in MainApplication.java like this:

import com.rnarcore.arview.ArViewModule;
import com.rnarcore.arview.ArViewPackage;
....

 @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
              new ArViewPackage()
      );
    }

I don't work on Android anymore so I have no time/ tools installed for updating / maintaining this project. After you manage to get it working feel free to make a pull request.

Hope your project goes well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant