Проблема с com.github.PhilJay: библиотека MPAndroidChart - PullRequest
0 голосов
/ 11 ноября 2018

Привет, у меня проблема с com.github.PhilJay: библиотека MPAndroidChart. Я хочу добавить в свой проект, когда я синхронизирую свой проект, все в порядке, но когда я компилирую свой проект, появляется эта ошибка, и я не знаю, почему.

Проблема говорит: More than one file was found with OS independent path 'META-INF/proguard/androidx-annotations.pro'

Предполагалось, что я все расставил по местам

build.gradle (Модуль приложения)

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "company.eduardo.administradorfinanzas"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

repositories {
    jcenter()
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0-alpha'
    //noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'


    implementation 'com.google.android.gms:play-services-auth:16.0.1'
    implementation 'com.github.bumptech.glide:glide:4.8.0'
    implementation 'android.arch.persistence.room:runtime:1.1.1'
    annotationProcessor 'android.arch.persistence.room:compiler:1.1.1'

    // Room components
    implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
    annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
    androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"

// Lifecycle components
    implementation "android.arch.lifecycle:extensions:$rootProject.archLifecycleVersion"
    annotationProcessor "android.arch.lifecycle:compiler:$rootProject.archLifecycleVersion"
}
apply plugin: 'com.google.gms.google-services'

И мой build.gradle (Проект)

    // 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.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

        // 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
}

ext {
    roomVersion = '1.1.1'
    archLifecycleVersion = '1.1.1'
}

1 Ответ

0 голосов
/ 11 ноября 2018

либо используйте стабильную версию :

dependencies {
    // implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.github.PhilJay:MPAndroidChart:v3.0.2"
}

или ограничьте дубликат androidx-annotations.pro одной записью:

android {
    packagingOptions {
        pickFirst "META-INF/proguard/androidx-annotations.pro"
    }
}

также проверьте каталог libs, если дублирующая запись не происходит из *.jar, потому что файл androidx-annotations.pro звучит так, как если бы это был файл правил потребителя ProGuard, поскольку он часто предоставляется библиотекой. и плагин google-services в настоящее время будет иметь версию 4.1.0.

...