frostney / react-native-create-library

:notebook: Command line tool to create a React Native library with a single command
MIT License
1.45k stars 113 forks source link

Android External Libraries has react-native 0.20.1 #48

Closed sinewave440hz closed 6 years ago

sinewave440hz commented 6 years ago

First, thank you for a great project!

I'm having some trouble with the android project. When I create a new library and open it for the first time in Android Studio, I see that react-native-0.20.1 is used in the External Libraries (visible in the Project view). (Before I realised this I was having trouble because I wanted to use ReadableArray's toArrayList method, which came later in RN). Clearly this is because this is what's available on MavenCentral (0.20.1 is visible if you search on MavenCentral's site).

I managed to get a later RN version into the external libraries by removing mavenCentral() and adding what is typically found in a RN android project:

mavenLocal()
jcenter()
maven {
    // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
    url "$rootDir/../node_modules/react-native/android"
}

But then I had problems in the host project I was using the library in, the packager was complaining about multiple RN versions. I previously had my library working fine in the same host project (although with RN 0.20.1, though I didn't know it!).

I'm no android expert unfortunately. How should I go about configuring the library so that I can develop java within Android Studio and be sure that the library works correctly in the host?

Thanks, hope someone can help!

maicki commented 6 years ago

@thorbenprimke Would this be resolved via #59?

thorbenprimke commented 6 years ago

Yes, #59 resolved this.

@sinewave440hz - what you did there is correct (except mavenLocal and jcenter shoudl be below the maven for the RN folder).