Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Linking does not seem to work #164

Closed
Mo-k-tec opened this issue Jan 26, 2016 · 13 comments
Closed

Linking does not seem to work #164

Mo-k-tec opened this issue Jan 26, 2016 · 13 comments
Labels

Comments

@Mo-k-tec
Copy link

I followed all steps but when i build the android app i get the following error.

A problem occurred configuring project ':app'.
> Cannot evaluate module react-native-camera : Configuration with name 'default' not found.

I added in the told files

new RCTCameraPackage()

include ':react-native-camera'
project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android')

dependencies {
  compile project(':react-native-camera')
  compile fileTree(dir: "libs", include: ["*.jar"])
  compile "com.android.support:appcompat-v7:23.0.1"
  compile "com.facebook.react:react-native:0.18.+"
}

Any ideas?

Regards,
Mo

@dangnelson
Copy link

I'm having the same problem.

I also don't see how to "Modify the ReactInstanceManager.builder() calls chain in android/app/main/java/.../MainActivity.java to include:"

I don't have any references in my MainActivity.java file to ReactInstanceManager.

My path to MainActivity.java is also different:
android/app/src/main/java/com/.../MainActivity.java

I running the latest version of RN.

@dangnelson
Copy link

This issue is related to React-Native 0.18. Here's a related solution:
react-native-image-picker/react-native-image-picker#74

I'll try to get a working version from that.

@dangnelson
Copy link

Tagging @farmisen since he was the original source for the documentation.

@rpopovici
Copy link
Contributor

I linked this project with "git+https://github.com/lwansbrough/react-native-camera.git" in package.json instead of using npm version ^0.3.8 and it works this way
It looks like the npm repository was not update to the latest version

@ardowz
Copy link

ardowz commented Jan 26, 2016

In MainActivity.java

add this line:
import com.lwansbrough.RCTCamera.RCTCameraPackage;

before the class, that should do the trick.Also, the current nom release version does not have the android support yet. You will need to do npm install react-native-camera@[git clone URL here] --save for you to get all the files

@dangnelson
Copy link

Worked. Thanks @ardowz

Here's what my final MainActivity looks like:

package com.myapp;

import com.facebook.react.ReactActivity;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;

import com.lwansbrough.RCTCamera.RCTCameraPackage; // IMPORT REACT-NATIVE_CAMERA
import java.util.Arrays;
import java.util.List;

public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "myapp";
    }

    /**
     * Returns whether dev mode should be enabled.
     * This enables e.g. the dev menu.
     */
    @Override
    protected boolean getUseDeveloperSupport() {
        return BuildConfig.DEBUG;
    }

   /**
   * A list of packages used by the app. If the app uses additional views
   * or modules besides the default ones, add more packages here.
   */
    @Override
    protected List<ReactPackage> getPackages() {

      return Arrays.<ReactPackage>asList(
        new RCTCameraPackage(), // ADD REACT-NATIVE_CAMERA
        new MainReactPackage()
      );
    }
}

@ardowz
Copy link

ardowz commented Jan 26, 2016

Nice. I managed to make mine to compile, but whenever I try to run it on my phone. I get an error which is in (#165) was wondering if you guys made it to work in android completely.

@dangnelson
Copy link

Nope. Running into the same issue.

@Mo-k-tec
Copy link
Author

Also doesn't work here.

npm install react-native-camera@https://github.com/lwansbrough/react-native-camera.git --save
rnpm link react-native-camera

And then add the changes @ardowz said + @dangnelson

@lwansbrough
Copy link
Collaborator

Hi all, please try with the latest commits from master.

@lwansbrough lwansbrough added the Bug label Feb 1, 2016
@awitherow
Copy link

following the steps from @dangnelson & running the following worked in terms of building, haven't tested it yet on a device.

npm i react-native-camera@https://github.com/lwansbrough/react-native-camera.git --save

@mkraft
Copy link

mkraft commented Feb 3, 2016

@rpopovici Worked for me, thanks.

@ackdav
Copy link

ackdav commented Sep 13, 2016

I solved it like this..
instead of importing:
import com.lwansbrough.RCTCamera.*;
do this:
import com.lwansbrough.RCTCamera.RCTCameraPackage;

@ackdav ackdav mentioned this issue Sep 13, 2016
rt2zz pushed a commit that referenced this issue Sep 13, 2016
for everyone that links it manually  - see: #164
@rt2zz rt2zz closed this as completed Sep 13, 2016
mortondev911 pushed a commit to mortondev911/React-Native-Camera that referenced this issue Dec 18, 2020
for everyone that links it manually  - see: react-native-camera/react-native-camera#164
sunil-dev7 added a commit to sunil-dev7/react-native-camera that referenced this issue Jun 11, 2021
for everyone that links it manually  - see: react-native-camera/react-native-camera#164
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

9 participants