3

Gradle build error - more than one library with package name android.support.v7.appcompat. This project has Chrome Cast in it, so is using android-support-v7-appcompat and CastCompanionLibary-android-master. Project structure is the following:

  • BaseGameUtils
  • CastCompanionLibrary-android-master
  • VideoBrowserActivity
  • android-support-v7-appcompat
  • android-support-v7-mediarouter
  • google-play-services_lib

Really tough error because the compiler doesn't give much information other than 'more than one library with package name 'android.support.v7.appcompat'. Understand why you don't want to be using different versions of the same library, but why doesn't the compiler reveal what versions are being used, and where they are being called from?

Trying to add leaderboard similar to type-a-number challenge (github example project)

There are a total of (7) build.gradle files. One for the top level and one for each of the packages listed above. Top level gradle file:

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

repositories {
    mavenCentral()
}
dependencies {
    classpath 'com.android.tools.build:gradle:1.0.0'
}

BaseGameUtils:

dependencies {
    compile 'com.android.support:appcompat-v7:20.0.+'
    compile 'com.android.support:support-v4:20.0.+'
    compile 'com.google.android.gms:play-services-games:6.5+'
    compile 'com.google.android.gms:play-services-plus:6.5+'
    compile 'com.google.android.gms:play-services-appstate:6.5+'
}

CastCompanionLibrary-android-master

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.android.support:appcompat-v7:20.0.+'
    compile project(':android-support-v7-mediarouter')
    compile 'com.google.android.gms:play-services-cast:6.5+'
    compile project(':BaseGameUtils')
}

VideoBrowserActivity

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':CastCompanionLibrary-android-master')
}

android-support-v7-appcompat

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

android-support-v7-mediarouter

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile project(':android-support-v7-appcompat')
}

google-play-services_lib

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

Any help is appreciated on this.

user3389961
  • 41
  • 1
  • 8
  • Why did you copy `android-support-v7-mediarouter` into your project? Why are you not using the `mediarouter_v7` artifact? – CommonsWare Mar 20 '15 at 21:17
  • this project began in eclipse and this is how it is described to set it up in instructions from Google. – user3389961 Mar 23 '15 at 14:21

2 Answers2

3

Just go through you project's libs folder not from the Android Studio but from you windows explorer/finder (for windows)/(for mac). And search for android.support.v7.appcompat. Any evidence found related to Apcompat (whether it is v4 or v7) is recommended to be deleted.

Hopefully your problem will be solved.

In your libs folder dont miss any sub directory that has libs folder.

Mohammad Arman
  • 7,020
  • 2
  • 36
  • 50
0

Follow the Steps

1) Remove This repository: implementation 'com.android.support:appcompat-v7:28.0.0'

2) Add This Repository implementation 'com.android.support:support-v4:21.0.3'

compile group: 'com.android.support', name: 'appcompat-v7', version: '26.0.1'

3) That's It You Are Ready To Go