react-native-cookies
react-native-cookies copied to clipboard
Error: Import libraries to android "rnpm link"
The line of code import com.psykar.cookiemanager.CookieManagerPackage;
should be placed in the MainApplication.java file instead of MainActivity.java
I have same error
+1
+1 same error, I hope it can be fixed so that we can continue development. Thanks!
You can apply the quick fix below:
- Delete the line of code
import com.psykar.cookiemanager.CookieManagerPackage;
inMainActivity.java
- Add
import com.psykar.cookiemanager.CookieManagerPackage;
toMainApplication.java
- Add following code to
MainApplication.java
:
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new CookieManagerPackage() // Add this code
);
}
Hope this help!
Or just use react-native link
, we fixed it there
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",
Same for me getting errors still
Strange, MainApplication thingy has been fixed in 0.29-rc2: https://github.com/facebook/react-native/commit/3c8a2eed92587ef3a79352b71073e4cfccb2a7df
Srry, mb. I just
react-native upgrade
and works fine
I use following steps to fix this problem:
- modify MainApplication.java as hieudole sad above.
- npm upgrade -g rnpm
- rnpm link react-native-cookies
then use react-native run-android, it is working.
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.
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
react-native unlink <name-of-library>
should do the trick
@hieudole, How do we do this in Expo app, since my android packages not present in project directory?
@kssujithcj AFAIK Expo app doesn't support custom native modules