Hanqing Zhao
Hanqing Zhao

Reputation: 25

Program type already present: com.flurry.android.Consent

Recently, I wanted to implement flurry analytics to my android app However, after I followed the instructions and run the program, I'd faced the error shown below.

Thank you so much for your help and appreciate it!

Program type already present: com.flurry.android.Consent

Message{kind=ERROR, text=Program type already present: com.flurry.android.Consent, sources=[Unknown source file], tool name=Optional.of(D8)}

The app-level gradle code are here:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "com.falcontech.falcontech"
        minSdkVersion 14
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies
        {
            implementation fileTree(include: ['*.jar'], dir: 'libs')
            implementation 'com.android.support:appcompat-v7:26.1.0'
            implementation 'com.android.support.constraint:constraint-layout:1.0.2'
            //implementation 'com.google.android.gms:play-services-plus:15.0.0'
            //$
            testImplementation 'junit:junit:4.12'
            androidTestImplementation 'com.android.support.test:runner:1.0.1'
            androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
            implementation files('/Users/Frank/Desktop/Desktop/flurry_Android_sdk 2/Flurry-Analytics/flurryAnalytics_10.0.0.jar')
            implementation 'com.google.android.gms:play-services-analytics:15.0.0'
        }

The application-level gradle are here:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {

        classpath 'com.android.tools.build:gradle:3.1.1'
        // Add this line
        classpath 'com.google.gms:google-services:3.2.0'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Upvotes: 0

Views: 788

Answers (2)

You may have the dependencies listed in the wrong gradle file. They should be in the same location as your jar is included in the original code posted.

In addition, you'll want to update minSdkVersion to 16, which is the minimum supported in 10.0.0.

Upvotes: 0

You can integrate via aar by adding the following in your main app's Gradle config file:

repositories {
    jcenter()
  }

dependencies {
    // Required for Flurry Analytics integration
    compile 'com.flurry.android:analytics:10.0.0@aar'
}

Remove the permissions you added to your Manifest file, and the jar files, then sync your gradle file. In your application class, make sure to include the following:

import com.flurry.android.FlurryAgent;
import static android.util.Log.VERBOSE;

Upvotes: 1

Related Questions