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

Please don't pin your play-services dependency at a particular version #78

Closed
christocracy opened this issue Aug 15, 2016 · 14 comments · Fixed by #82
Closed

Please don't pin your play-services dependency at a particular version #78

christocracy opened this issue Aug 15, 2016 · 14 comments · Fixed by #82

Comments

@christocracy
Copy link
Contributor

It causes issues with other libs when a 3rd-party library, like yours, pins its play-services dependencies at a particular version.

eg:

Unknown source file : com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/iid/MessengerCompat$1;
Unknown source file :   at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
Unknown source file :   at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
Unknown source file :   at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
Unknown source file :   at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
Unknown source file :   at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
Unknown source file :   at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
Unknown source file :   at com.android.dx.command.dexer.Main.run(Main.java:277)
Unknown source file :   at com.android.dx.command.dexer.Main.main(Main.java:245)
Unknown source file :   at com.android.dx.command.Main.main(Main.java:106)

You have

compile 'com.google.android.gms:play-services-gcm:8.3.0'

You need to change it to:

compile 'com.google.android.gms:play-services-gcm:+'
@jerson
Copy link

jerson commented Aug 15, 2016

same here :/ , cc @rebeccahughes change it please

@christocracy
Copy link
Contributor Author

christocracy commented Aug 15, 2016

In addition, I question the wisdom of including the entire ‘play-services-gcm` just to fetch the gcm identifier. This should be the responsibility of some other module which is doing Push requests. This module has no business dealing with this.

@GantMan
Copy link
Contributor

GantMan commented Aug 16, 2016

Please issue a PR with this fix. Agreed a pinned play services is bad.

@christocracy
Copy link
Contributor Author

@antoinerousseau
Copy link
Contributor

I suppose it's the same for com.facebook.react:react-native:0.11.+ that can be replaced by com.facebook.react:react-native:+?
https://github.com/rebeccahughes/react-native-device-info/blob/master/android/build.gradle#L22

@esutton
Copy link

esutton commented Aug 25, 2016

This caused me much lost time searching for solutions after I upgraded my packages. Will a fix be released soon?

@christocracy
Copy link
Contributor Author

12 open PRs and the author hasn't even commented on this thread.

In the meantime, pin this plugin dep in your app 0.9.3

@GantMan
Copy link
Contributor

GantMan commented Aug 25, 2016

I'm at React Rally, but I can help. Link me to the PR that fixes this. Rebecca is not actively maintaining this repo, she identified she had to move on to other tasks. As a community we're aiming to keep this live.

@antoinerousseau
Copy link
Contributor

the PR that fixes this is in this thread just above... it's #82

@GantMan
Copy link
Contributor

GantMan commented Aug 25, 2016

ty @antoinerousseau

@marlenabowen
Copy link

Hi @antoinerousseau - it seems like this line is always getting the latest version of play services, which is actually causing recurrent problems for me. My app spontaneously starts crashing when a new version of play services comes out, and I keep having to update my play services version (which is not ideal due to other libraries and tools I am using). When I hardcode this line to 11.6.2, I no longer see the crashes. Rather than fork this project just so I can hardcode a play services version, can you recommend another solution to this issue? This library is very useful to me, but it's causing some instability in my app due to the issue described above. I'd really appreciate any advice you might be able to offer. Thank you!

@antoinerousseau
Copy link
Contributor

Hi @mebowen, after reading this, it seems that specifying + as a gradle version is indeed a bad practice. We should pin the required minimum version instead.

@marlenabowen
Copy link

@antoinerousseau you've made me so happy! I will test out 9.6.1 and will open a PR if that fixes my problem. Thanks!

@marlenabowen
Copy link

marlenabowen commented Dec 22, 2017

9.6.1 does not work for me, but from the link you posted, I found another solution:

adding something like

allprojects {
    .
    .
    .
    configurations.all {
        resolutionStrategy {
            force 'com.google.android.gms:play-services-gcm:11.6.2'
        }
    }
}

to my android project's build.gradle file seems to fix the issue.

This issue was closed.
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

Successfully merging a pull request may close this issue.

6 participants