react-native-cookies icon indicating copy to clipboard operation
react-native-cookies copied to clipboard

Error: Import libraries to android "rnpm link"

Open hieudole opened this issue 7 years ago • 15 comments

The line of code import com.psykar.cookiemanager.CookieManagerPackage; should be placed in the MainApplication.java file instead of MainActivity.java

hieudole avatar Jul 18 '16 11:07 hieudole

I have same error

dphov avatar Jul 19 '16 11:07 dphov

+1

ackdav avatar Jul 19 '16 14:07 ackdav

+1 same error, I hope it can be fixed so that we can continue development. Thanks!

afilp avatar Jul 20 '16 15:07 afilp

You can apply the quick fix below:

  1. Delete the line of code import com.psykar.cookiemanager.CookieManagerPackage; in MainActivity.java
  2. Add import com.psykar.cookiemanager.CookieManagerPackage; to MainApplication.java
  3. Add following code to MainApplication.java:
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new CookieManagerPackage() // Add this code
      );
    }

Hope this help!

hieudole avatar Jul 22 '16 03:07 hieudole

Or just use react-native link, we fixed it there

Kureev avatar Jul 25 '16 07:07 Kureev

getting same error. Not solve for me =/ My dep versions: "react": "15.2.1", "react-native": "0.30.0", "react-native-cookies": "1.0.2",

Lothav avatar Jul 25 '16 19:07 Lothav

Same for me getting errors still

gelobelo02 avatar Jul 26 '16 03:07 gelobelo02

Strange, MainApplication thingy has been fixed in 0.29-rc2: https://github.com/facebook/react-native/commit/3c8a2eed92587ef3a79352b71073e4cfccb2a7df

Kureev avatar Jul 26 '16 08:07 Kureev

Srry, mb. I just react-native upgrade and works fine

Lothav avatar Jul 26 '16 13:07 Lothav

I use following steps to fix this problem:

  1. modify MainApplication.java as hieudole sad above.
  2. npm upgrade -g rnpm
  3. rnpm link react-native-cookies

then use react-native run-android, it is working.

cbcye avatar Jul 31 '16 14:07 cbcye

I'd recommend to use react-native link instead of rnpm. We're about to deprecate rnpm as soon as it's merged into react-native core. We announce it when the first react-native release with rnpm on board will come into the world.

Kureev avatar Jul 31 '16 20:07 Kureev

Guys, How can I remove the rnpm's things here? Is it possible now?

Here solved the problem like @hieudole told us but, I'm not quite happy with that. It seems that before long it will crash again

adrianotadao avatar Oct 27 '16 10:10 adrianotadao

react-native unlink <name-of-library> should do the trick

Kureev avatar Oct 28 '16 14:10 Kureev

@hieudole, How do we do this in Expo app, since my android packages not present in project directory?

kssujithcj avatar Mar 16 '17 10:03 kssujithcj

@kssujithcj AFAIK Expo app doesn't support custom native modules

Kureev avatar Mar 16 '17 10:03 Kureev