dantasfiles / AmplifyAndroidPush

Setting up a React Native app using AWS Amplify to receive Android Push Notifications

Home Page:https://medium.com/@dantasfiles/setting-up-android-push-notifications-with-aws-amplify-e6334c6356d8

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with build.

bneigher opened this issue · comments

Hello,

Thanks for your guide! I've been using amplify in my app for a while now, but since upgrading to RN 60+ it has been the main point of failure for builds of my app, specifically on the android side.

I've followed the steps in your guide regarding the changes to MY build.gradle files and it doesn't seem to be working.. I get the following error on build of my app.

> Task :app:checkReleaseDuplicateClasses FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkReleaseDuplicateClasses'.
> 1 exception was raised by workers:
  java.lang.RuntimeException: Duplicate class com.google.android.gms.gcm.PendingCallback found in modules jetified-firebase-jobdispatcher-0.6.0-runtime.jar (com.firebase:firebase-jobdispatcher:0.6.0) and jetified-play-services-gcm-16.1.0-runtime.jar (com.google.android.gms:play-services-gcm:16.1.0)

Due to the changes with the 2.x.x version of @aws-amplify/pushnotification, as you pointed out, our build.gradle files no longer accept:

implementation (project(':@aws-amplify_pushnotification'))

which is a bummer because in the past I needed to have:

implementation (project(':@aws-amplify_pushnotification')){
    exclude group: 'com.firebase'
    exclude group: 'com.google.android.gms', module: 'play-services-gcm'
}

in order to have the duplicate symbols issue not complain. I've checked that the build.gradle file of the previous (1.1.4) version and the most recent (2.1.5) use the same deps.

Since you're good enough and android builds to write a blog post about it - do you think you could help me figure out what someone who has class collisions would need to do?

Thanks!

When I open this repository and run cd android and ./gradlew :app:dependencies > ../dependencies.txt
I get

+--- project :@aws-amplify_pushnotification
|    \--- com.firebase:firebase-jobdispatcher:0.6.0

But I get no results for com.google.android.gms:play-services-gcm.

Where is your com.google.android.gms:play-services-gcm coming from?

@dantasfiles wow I never knew about that dependencies command. It led me to finding that react-native-device-info was the culprit. updating it from 2.x.x to 5.x.x fixed it. That dependency list is an excellent tool. hopefully if someone googling app:checkReleaseDuplicateClasses will find this ☝️

thanks 💪