0

I'm trying to build an android app for custom hardware, Android 8.x, in Kotlin. I need to be able to send simple and custom notifications to devices.

Reading the getting started doc on: https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/sdk-implementation/implement-sdk-google.html

I need to add dependancies implementation 'com.google.firebase:firebase-messaging:20.2.4' implementation 'com.salesforce.marketingcloud:marketingcloudsdk:7.2.0'

When I re-sync I get this error:

Failed to resolve: com.salesforce.marketingcloud:marketingcloudsdk:7.2.0 Show in Project Structure dialog Affected Modules: app

What have I missed? BTW: This code was written using straight Firebase messaging, so I still want to use my FirebaseMessagingService, and other custom code.

Thanks Tom

Question: Does it matter I WANT to use Firebase 20.2.4

3
  • Did you add the repository? I literally just added the repository and the dependency to a Hello World project and this works as expected (ref. salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/…)
    – Bill Mote
    Commented Sep 15, 2020 at 17:35
  • I jus tried myself. Android Studio new Kotlin project Only change was to add these lines to Gradle implementation 'com.google.firebase:firebase-messaging:20.2.4' implementation 'com.salesforce.marketingcloud:marketingcloudsdk:7.2.0' Same results : Failed to resolve: com.salesforce.marketingcloud:marketingcloudsdk:7.2.0 Commented Sep 15, 2020 at 17:51
  • You're not doing step 1. See my comment above.
    – Bill Mote
    Commented Sep 15, 2020 at 18:47

2 Answers 2

0

I'm running into the same problem Tom is seeing. I just created a new project in Android Studio 4.0.1. Just a simple Kotlin single Activity app min SDK 21, compile SDK 29.

I added the following to the project gradle.build: maven { url "https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/repository" }

And then the following to the module gradle.build: implementation "com.salesforce.marketingcloud:marketingcloudsdk:$marketingcloudsdk_version"

I also took a look at your the LearningApp (https://github.com/salesforce-marketingcloud/MarketingCloudSDK-Android), and copied all of the settings over to my application with no luck.

I cloned the LearningApp, and it had no problem getting the Salesforce SDK. I also upgraded to the latest everything in the project, and still the LearningApp worked.

I compared everything I could think of between the sample app I created and the LearningApp...it all looked the same. However, I did notice that in Settings>Build>Remote Jar Repos that the Salesforce repo was missing (even thought it was added to the gradle file.)
enter image description here

So, I manually added the repo...still no luck! Anything else you can think of Bill?

It doesn't seem as simple as just forgetting to add the repo to the gradle file. Something else seems to be going on here.

3
  • OK, after doing some more testing, I was able to get it work with the following... implementation 'com.salesforce.marketingcloud:marketingcloudsdk:7.1.+' For some reason, it doesn't like 7.2.0. And then after that synced, I changed 7.1.+ back to 7.2.0 and it worked!!! Not sure why, but hopefully that works for you Tim.
    – kvertner
    Commented Sep 18, 2020 at 4:52
  • Interesting. I will see if I can replicate this on a "clean" machine.
    – Bill Mote
    Commented Sep 22, 2020 at 12:37
  • See my answer below. I was unable to reproduce the original posters issue and I did not have to do the version acrobatics that you experienced. I did all of this on a fresh OS installation with a fresh Android Studio installation to avoid any potential local caching issues, etc.
    – Bill Mote
    Commented Sep 22, 2020 at 14:12
0

You must add the repository to your module's build.gradle file. Adding the dependency alone does not tell Android Studio where to find the dependency. Ref. https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/sdk-implementation/implement-sdk-google.html#update-module-level-buildgradle-file

UPDATE

In an attempt to verify @kvertner's comment I did a fresh OS installation in VirtualBox. Installed Android Studio. Created a new application, updated the gradle files and added the MarketingCloudSdk to the application class. All of this without incident or needing to do any version hoop jumping as is noted above. Sorry you are struggling, but this must be related to your environment.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .