使用操作系统独立路径'AndroidManifest.xml'找到了多个文件

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用操作系统独立路径'AndroidManifest.xml'找到了多个文件相关的知识,希望对你有一定的参考价值。

我有一个多模块项目。在将Gradle更新为5.4.1并将android gradle插件更新为3.5.1版本之后,我开始出现以下错误:

Execution failed for task ':Android.OTT.Framework:mergeDebugJavaResource'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > More than one file was found with OS independent path 'AndroidManifest.xml'

这里是此模块的build.gradle

buildscript {
    rootProject.ext {
        support_version = '28.0.0'
        retrofit_version = '2.6.0'
        kodein_version = '6.2.1'
        butterknife_version = '9.0.0'
        joda_time_version = '2.10.2'
        rxjava_version = '2.2.10'
        rxandroid_version = '2.1.1'
        nanohttpd_version = '2.3.1'
        gson_version = '2.8.5'
        okio_version = '2.2.2'
        annimon_stream_version = '1.2.1'
        leak_canary_version = '1.6.3'
        ok_http_version = '3.12.1'
        lifecycle_version = '1.1.1'

        mockito_version = '2.28.2'
        mockito_kotlin_version = '2.1.0'
        kluent_version = '1.41'
    }

    repositories {
        google()
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://plugins.gradle.org/m2/' }
    }

    dependencies {
        // These docs use an open ended version so that our plugin
        // can be updated quickly in response to Android tooling updates

        // We recommend changing it to the latest version from our changelog:
        // https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
        classpath 'io.fabric.tools:gradle:1.+'

        classpath "com.jakewharton:butterknife-gradle-plugin:$butterknife_version"
    }
}

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'realm-android'
apply plugin: 'com.jakewharton.butterknife'

androidExtensions {
    experimental = true
}

repositories {
    google()
    maven { url 'https://maven.fabric.io/public' }
    mavenCentral()
    jcenter()
    maven { url "https://jitpack.io" }
    maven { url "https://dl.bintray.com/deltatre/exoplayer" }
}

allprojects {
    repositories {
        google()
        flatDir {
            dirs './divaLibs'
        }
        maven {
            url = "https://oss.sonatype.org/content/repositories/snapshots/"
        }
    }
}

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            consumerProguardFiles 'proguard-rules.pro'
        }
    }
    packagingOptions {
        exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    testOptions {
        unitTests.returnDefaultValues = true
    }
    dataBinding {
        enabled = true
    }
}

realm {
    syncEnabled = true
}

dependencies {
    api project(':Android.OTT.OfflineVideo')
    api project(':Android.OTT.D3Foundation')

    // START DIVA PLAYER
    implementation fileTree(include: ['*.jar', '*.aar'], dir: 'divaLibs')
    api files('divaLibs/divaandroidlib-release-4.7.2.aar')
    implementation 'com.deltatre.android.exoplayer:exoplayer:2.9.5.1'
    implementation 'com.github.davibe:MD360Player4Android:dev-SNAPSHOT'
    implementation 'com.google.ads.interactivemedia.v3:interactivemedia:3.10.2'

    api "com.google.code.gson:gson:$gson_version"
    api "joda-time:joda-time:$joda_time_version" // needed also by Diva
    implementation 'com.google.android.gms:play-services-base:16.1.0'
    implementation 'com.google.android.gms:play-services-ads:17.2.1'
    implementation 'com.google.android.gms:play-services-analytics:16.0.8'
    implementation 'com.google.android.gms:play-services-cast:16.2.0'
    implementation 'com.google.android.gms:play-services-cast-framework:16.2.0'
    implementation files('divaLibs/comscore-3.1502.26.jar')
    implementation 'com.google.vr:sdk-videowidget:1.180.0'

    //Firebase
    api 'com.google.firebase:firebase-messaging:18.0.0'
    api 'com.google.firebase:firebase-core:16.0.9'
    implementation 'com.google.android.gms:play-services-tagmanager:16.0.8'
    // Urban Airship - FCM
    api 'com.urbanairship.android:urbanairship-fcm:10.0.2'
    // Support
    api "com.android.support:design:$support_version"
    api "com.android.support:cardview-v7:$support_version"
    api "com.android.support:recyclerview-v7:$support_version"
    api "com.android.support:support-v4:$support_version"
    api "com.android.support:mediarouter-v7:$support_version"
    api "com.android.support:appcompat-v7:$support_version"
    api "com.android.support:support-v13:$support_version"
    api "com.android.support:customtabs:$support_version"
    api 'com.android.support.constraint:constraint-layout:1.1.3'
    api 'com.android.support:multidex:1.0.3'

    implementation "android.arch.lifecycle:viewmodel:$lifecycle_version"
    implementation "android.arch.lifecycle:extensions:$lifecycle_version"

    // Analytics
    api('com.crashlytics.sdk.android:answers:1.4.7@aar') {
        transitive = true
    }
    api('com.crashlytics.sdk.android:crashlytics:2.10.1@aar') {
        transitive = true
    }
    // Ui
    api 'me.relex:circleindicator:1.2.2@aar'
    api 'com.github.bumptech.glide:glide:4.9.0'
    implementation 'com.afollestad.material-dialogs:core:0.9.5.0'
    // RETROFIT
    api "com.squareup.retrofit2:retrofit:$retrofit_version"
    api "com.squareup.retrofit2:converter-gson:$retrofit_version"
    api "com.squareup.retrofit2:adapter-rxjava2:$retrofit_version"
    // ok http
    implementation "com.squareup.okhttp3:okhttp:$ok_http_version"
    implementation "com.squareup.okhttp3:logging-interceptor:$ok_http_version"
    // Rx
    api "io.reactivex.rxjava2:rxandroid:$rxandroid_version"
    api "io.reactivex.rxjava2:rxjava:$rxjava_version"
    api 'com.jakewharton.rxbinding2:rxbinding:2.2.0'
    // IoC
    api "org.kodein.di:kodein-di-generic-jvm:$kodein_version"
    api "org.kodein.di:kodein-di-framework-android-support:$kodein_version"
    // Usefull
    api "com.annimon:stream:$annimon_stream_version"
    api "com.jakewharton:butterknife:$butterknife_version"
    kapt "com.jakewharton:butterknife-compiler:$butterknife_version"
    api 'com.jakewharton.timber:timber:4.7.1'
    implementation "com.squareup.okio:okio:$okio_version"
    implementation "org.nanohttpd:nanohttpd:$nanohttpd_version"
    implementation 'online.devliving:securedpreferencestore:0.7.4'
    api 'com.jakewharton:process-phoenix:2.0.0'

    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

    // TV
    api "com.android.support:leanback-v17:$support_version"

    // Leak Canary
    debugImplementation "com.squareup.leakcanary:leakcanary-android:$leak_canary_version"
    releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$leak_canary_version"
    debugImplementation "com.squareup.leakcanary:leakcanary-support-fragment:$leak_canary_version"

    testImplementation 'junit:junit:4.12'
    testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:$mockito_kotlin_version"
    testImplementation "org.mockito:mockito-inline:$mockito_version"
    testImplementation "org.amshove.kluent:kluent-android:$kluent_version"

    // Exomedia
    implementation 'com.devbrackets.android:exomedia:4.3.0'

    androidTestImplementation "org.mockito:mockito-android:$mockito_version"
}

这里是项目的build.gradle

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

buildscript {
    ext.kotlin_version = '1.3.50'
    repositories {
        google()
        maven { url 'https://maven.fabric.io/public' }
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.1'
        classpath 'io.fabric.tools:gradle:1.+'
        classpath 'io.realm:realm-gradle-plugin:5.11.0'
        classpath 'com.google.gms:google-services:4.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://maven.fabric.io/public' }
    }
}

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

我看到了很多类似one的问题。但这不是我的情况,因为我不能只忽略AndroidManifest.xml文件。预先感谢!

答案

基于发生错误的位置-在mergeDebugJavaResource gradle任务中以及关于多个Android清单的错误消息中,我可以假设问题在于有多个清单(例如,一个清单用于调试,一个清单用于生产),并且是不正确的manifest merging rules

以上是关于使用操作系统独立路径'AndroidManifest.xml'找到了多个文件的主要内容,如果未能解决你的问题,请参考以下文章

如何解决“在Android独立路径中找到多个文件'project.properties'”Android Studio 3.0 Beta-6中的错误

实现错误 - picasso:2.71828(发现多个文件具有独立于操作系统的路径)

config

在 gradle:3.0.0 上找到多个文件,其独立于操作系统的路径为“META-INF/ASL2.0”

/home文件夹重新划分独立分区

node.js中path路径操作