0

I'm trying to implement the marketing cloud SDK on Android. Doing that, I need to set up firebase in my app. as written in the SDK implementation tutorial, the SDK works only with firebase-core version 18.x.x (I guess it means a minimum version of 18):

enter image description here

however, with an implementation of version 18, I receive an error saying that the version doesn't exists. So I looked up on firebase releases, and found out that the latest firebase-core version is 17.0.1, which still raises errors in my app:

enter image description here

These are the errors I get whenever I try to build my app using firebase-core 17.0.1 (the latest version):

Unresolved reference: MarketingCloudSdk
Unresolved reference: MarketingCloudConfig
Unresolved reference: setApplicationId
Unresolved reference: setAccessToken
Unresolved reference: setSenderId
Unresolved reference: setMarketingCloudServerUrl
Unresolved reference: setMid
Unresolved reference: setNotificationCustomizationOptions
Unresolved reference: NotificationCustomizationOptions
Unresolved reference: ic_notification_icon
Unresolved reference: Context
Cannot infer a type for this parameter. Please specify it explicitly.

So, is there still a way to use firebase-core 18? or fix my errors using version 17.0.1?

<=====UPDATE=====>

that's the initialization code in MainActivity.kt:

class MainActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    setContentView(R.layout.activity_main)

    MarketingCloudSdk.init(this, MarketingCloudConfig.builder().apply {
        setApplicationId("b321db28-31b8-419b-84b4-82adde006da9")
        setAccessToken("oJA33MDl3MRGoOKto7Ze0Gpt")
        setSenderId("586779523703")
        setMarketingCloudServerUrl("https://mcx8phgy1fbtrln9dy0jnj9y9t61.device.marketingcloudapis.com/")
        setMid("7231513")
        setNotificationCustomizationOptions(
            NotificationCustomizationOptions.create(R.drawable.ic_notification_icon)
        )
        // Other configuration options
    }.build(this as Context)) { status ->
        // TODO handle initialization status
    }
  }
}
1

You should be using version 17.0.1 of firebase-core.

The SDK docs page uses a shared variable for the Firebase major version number, which is no longer correct since Google is publishing no longer publishing the same major version update for all Firebase libraries at the same time.

The docs will be updated shortly to reflect the correct version.

| improve this answer | |
  • Thanks! but I've already said that I tried to use version 17.0.1 but I get the errors mentioned above. I've followed the implementation rules step by step and double-checked my build-gradle file, and still I keep getting these errors – Omri Brandes Jul 30 '19 at 9:57
  • Try removing the firebase-core dependency from your app. The google-services plugin should pull in the necessary dependencies with the correct versions. – Seth Jul 30 '19 at 12:42
0

Seth got it right. First of all, I didn't have to use the core library. Afterwards I've realized that implementing the SDK is not enough, I had to import the required libraries from the SDK to my mainActivity code.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.