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

> Error: more than one library with package name 'com.lufinkey.react.spotify' #28

Closed
robertoost opened this issue Jan 19, 2018 · 17 comments

Comments

@robertoost
Copy link
Contributor

robertoost commented Jan 19, 2018

In the instructions on how to install react-native-spotify through npm, you mention having to replace "@lufinkey/react-native-spotify" with "@lufinkey_react-native-spotify" in several .gradle files. This works during initial setup, but after linking the project again, and running npm i, my project broke down.

> Error: more than one library with package name 'com.lufinkey.react.spotify'

It seems the replaced versions of the string have been raised from the dead to haunt me, as both versions of the string are now present in my .gradle files.

    compile project(':@lufinkey/react-native-spotify')
    compile project(':@lufinkey_react-native-spotify')
include ':@lufinkey/react-native-spotify'
project(':@lufinkey/react-native-spotify').projectDir = new File(rootProject.projectDir, '../node_modules/@lufinkey/react-native-spotify/android')
include ':@lufinkey_react-native-spotify'
project(':@lufinkey_react-native-spotify').projectDir = new File(rootProject.projectDir, '../node_modules/@lufinkey/react-native-spotify/android')

Removing the lines that use a "/" does allow the project to start on android, but it fails immediately ( as shown in the image below ).
I have the feeling that this has something to do with this double module issue. Any thoughts on how to fix this?

See Image here

image

@lufinkey
Copy link
Owner

Yeah, as mentioned in the README, this is a bug with react-native link. It's been brought up multiple times in issues, but somehow it still isn't fixed, despite multiple people suggesting the very obvious solution of substituting the / with a _. I don't know when it'll be fixed, but this is just something we'll have to deal with until then, since I have to use a scoped package due to all the squatters on npm hosting half finished packages. 😒

@robertoost
Copy link
Contributor Author

I managed to find all duplicate entries. The fix for a double link is as follows:
remove the wrong lines from:

android/settings.gradle
android/app/build.gradle
android/app/src/main/java/.../MainApplication.java

Perhaps it'd be good to mention this fix for a double link in the instructions of your package install on npm?

@lufinkey
Copy link
Owner

lufinkey commented Jan 19, 2018 via email

@robertoost
Copy link
Contributor Author

I'd say add it to the bottom of readme on npm, and an installscript would be good aswell.

@robertoost
Copy link
Contributor Author

Perhaps a better solution for now would be to release the package under a different name. The current version breaks the project every time someone executes react-native-link. It's a minor annoyance for me, but the members of our team that are working on entirely different sections of the app are not having a good developer experience, to say the least.

@lufinkey
Copy link
Owner

I'd say use the GitHub package instead of the npm one. That's why I've maintained the master branch and the npm branch

@lufinkey
Copy link
Owner

If I were to release the package under a different name, do you have any recommendations?

@adebree
Copy link
Contributor

adebree commented Jan 23, 2018

How about: react-native-spotifysdk?

@lufinkey
Copy link
Owner

I tried that one. It collides with react-native-spotify-sdk because it's too similar

@adebree
Copy link
Contributor

adebree commented Jan 23, 2018

Oh, that's annoying! How about: rn-spotify-sdk It's the same prefix as for example rn-splash-screen

@adebree
Copy link
Contributor

adebree commented Feb 5, 2018

@lufinkey are you happy with the above suggestion? It would make use really happy if you could get the library published without the scoped prefix so we can workaround the react-native / gradle issue. Thanks!

@lufinkey
Copy link
Owner

lufinkey commented Feb 5, 2018

Yeah I'll try to deprecate the previous name and switch over on the next update

@Titozzz
Copy link

Titozzz commented Feb 26, 2018

I'll probably work on fixing react native link soon, just to let you know, because scoped packages are the new norm, and should not have to rename

@Titozzz
Copy link

Titozzz commented Mar 8, 2018

facebook/react-native#18275

@robertoost
Copy link
Contributor Author

Looks like the pull-request fixing this issue in react-native got approved! Will we be able to close this issue soon?

@lufinkey
Copy link
Owner

I'm still going to convert it away from a scoped package anyway, so I'm going to leave this open so that I remember to do that on the next release

@lufinkey
Copy link
Owner

the package has been rescoped as rn-spotify-sdk and pushed to npm

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

4 participants