Android integration troubleshooting

If the Android integration of our SDK didn't go as smooth as expected, maybe you faced one of these issues:

Missing Plot Projects repository

This error occurs when the Plot Projects Maven repository was not specified as a project repository.

Behaviour:

ERROR: Failed to resolve: com.plotprojects:plot-android:3.13.0

Fix:

Ensure that your repositories list includes our repository.

allprojects {
    repositories {
        google()
        jcenter()

        // allow gradle to find the Plot Projects Plugin
        maven {
            url 'https://maven-repo.plotprojects.com'
        }
    }
}

Android dependency version conflict

Dependency issues can take many forms, some occur during code compilation but others only occur during runtime. Therefore, we show some examples of similar error messages that you might face when integrating our SDK. As for the provided fix, it's not a predefined solution but a method to pinpoint and solve such troubles.

Behaviour:

Android Studio sometimes warns about these conflicts, as seen in the figure below:

Library Conflict

Example error message during runtime caused by a com.android.support:support-v4 conflict:

java.lang.NoSuchMethodError: No direct method (Landroid/content/Context;Ljava/lang/String;)V in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes
Fix:
  1. Make sure you have the correct dependencies as specified in the integration guide.
  2. Run the :dependencies Gradle task.
  3. You should get something similar to this:
                    ...
                    +--- com.plotprojects:plot-android:3.+ -> 3.13.0
        |    +--- com.android.support:support-compat:27.1.1 -> 28.0.0
        |    |    +--- com.android.support:support-annotations:28.0.0
        |    |    +--- com.android.support:collections:28.0.0
        |    |    |    \\--- com.android.support:support-annotations:28.0.0
        |    |    +--- android.arch.lifecycle:runtime:1.1.1
        |    |    |    +--- android.arch.lifecycle:common:1.1.1
        |    |    |    |    \\--- com.android.support:support-annotations:26.1.0 -> 28.0.0
        |    |    |    +--- android.arch.core:common:1.1.1
        |    |    |    |    \\--- com.android.support:support-annotations:26.1.0 -> 28.0.0
        |    |    |    \\--- com.android.support:support-annotations:26.1.0 -> 28.0.0
        |    |    \\--- com.android.support:versionedparcelable:28.0.0
        |    |         +--- com.android.support:support-annotations:28.0.0
        |    |         \\--- com.android.support:collections:28.0.0 (\*)
                    ...
    
  4. Check if any of the com.plotprojects:plot-android dependencies is conflicting with the dependencies of another dependency by comparing the resolved versions (right side of the ->). This is a common issue with support libraries when Plot Projects uses an older version than the one specified in the dependencies list or when the one used in our SDK is the latest but includes breaking changes.