ProgramingTip

OS 독립 경로 'META-INF / proguard / androidx-annotations.pro'가있는 파일이 두 개 이상 발견되었습니다.

bestdevel 2020. 12. 10. 20:56
반응형

OS 독립 경로 'META-INF / proguard / androidx-annotations.pro'가있는 파일이 두 개 이상 발견되었습니다.


내가 노력하고 안드로이드 WorkManager는 , 코드는 오류를 던지고있다 "이상의 파일이 OS 독립적 인 경로로 발견 된 'META-INF / 난독 화 / androidx-annotations.pro "실행할 때, 나는 시도 다음과 같은 대답은 , 그것은 도움이되지 않았습니다.

WorkManager 이야기

build.gradle (앱)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "rock.dmx.xaro.workmanagerexample"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


}

dependencies {
    def work_version = "1.0.0-alpha09"
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7: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 "android.arch.work:work-runtime:$work_version"
}

현재 기기 문제입니다. 아키텍처 구성 요소 릴리스 노트 는 문제를 간략하게 설명하고 alpha10작업 관리자 라이브러리 버전 까지 해결하는 솔루션을 제공합니다 .

기기 문제

다음 문제가 발생하는 경우 : "OS 독립 경로 'META-INF / proguard / androidx-annotations.pro'에서 두 개 이상의 파일이 발견되었습니다."문제를 해결하는 동안 임시 해결 방법으로 gradle 파일에 다음을 입력하십시오 . alpha10의 문제 :

 android {
     packagingOptions {
         exclude 'META-INF/proguard/androidx-annotations.pro'
     }
 }

따라서 귀하의 경우 android 섹션은 다음과 같은 경우입니다.

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "rock.dmx.xaro.workmanagerexample"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    // Temporary fix until alpha10
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

1.0.0-alpha10WorkManager 버전 에서 문제가 제대로 해결되어야합니다 .


내 앱의 build.gradle 섹션에 다음을 추가 할 때 오류가 발생합니다.

implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

AndroidX로 마이그레이션 한 후 :

  1. Android Studio의 Refactor 메뉴에서 Migrate to AndroidX ...를 선택합니다 .
  2. 마이그레이션이 실패 할 경우 프로젝트 를 zip 파일로 백업 하는 옵션을 확인하는 것이 좋습니다.
  3. 마이그레이션클릭하면 zip 백업을 저장할 위치를 선택하게됩니다.

지금까지 문제없이 지을 수 있습니다.


내 설정

Android 스튜디오 3.2.1
JRE : 1.8.0_152-release-1136-b06 x86_64
JVM : JetBrains
macOS 10.13.6의 OpenJDK 64 비트 서버 VM


build.gradle (app)에서 추가를 사용할 수 있습니다 ( TheStrikeBone 에 의해 답변 ).

android {
    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

또는 android.arch.work버전을 다음으로 다운 그레이드1.0.0-alpha08

dependencies {
    implementation 'android.arch.work:work-runtime:1.0.0-alpha08'
}

이것을 내 앱 build.gradle 파일에 추가하면 문제가 해결되었습니다.

android {
  packagingOptions {
    exclude 'META-INF/proguard/androidx-annotations.pro'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/ASL2.0'
  }
}

참고 URL : https://stackoverflow.com/questions/52518378/more-than-one-file-was-found-with-os-independent-path-meta-inf-proguard-android

반응형