Android Studio 当包含 .aar 模块时出现错误 :Execution failed for task ':app:processDebugManifest' . [Duplicat]

标签 android android-studio compiler-errors

当我在 android studio 中包含 compile project(':telrlibrary-release-1') aar 模块时。它导致以下错误

Information:Gradle tasks [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]
Error:Execution failed for task ':app:processDebugManifest'.> Manifest merger failed with multiple errors, see logs

这是我的主要项目构建点 gradle 文件。我包含了项目编译项目(':telrlibrary-release-1')并且它出错了

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
maven { url 'https://maven.fabric.io/public' }
}


android {
lintOptions {
    abortOnError false
}
signingConfigs {
    config {
        keyAlias 'rrrrr_app'
        keyPassword 'rrrrr'
        storeFile file('/home/apps/Desktop/Build/androidkey.jks')
        storePassword 'jhgjhgj'
    }
}
dexOptions {
    javaMaxHeapSize "4g"
    preDexLibraries = false
}
compileSdkVersion 25
buildToolsVersion "25.0.3"

defaultConfig {
    multiDexEnabled = true
    applicationId "com.rrrrr.app"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 7
    versionName "1.6"

}

productFlavors {
}
packagingOptions {

    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'

}
buildTypes {
    release {
        signingConfig signingConfigs.config
        minifyEnabled false
        debuggable false
        jniDebuggable false
        renderscriptDebuggable false
        zipAlignEnabled true
        proguardFile '/home/apps/Projects/app/proguard-rules.pro'
    }
}
}

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')

compile project(':telrlibrary-release-1')
compile files('libs/twitter4j-core-4.0.3.jar')
androidTestCompile('com.android.support.test.espresso:espresso- core:2.2.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'
compile('org.simpleframework:simple-xml:2.7.1', {
    exclude group: 'stax', module: 'stax'
    exclude group: 'stax', module: 'stax-api'
    exclude group: 'xpp3', module: 'xpp3'
})
compile 'com.koushikdutta.ion:ion:2.1.6'
compile 'com.facebook.android:facebook-android-sdk:4.9.0'
compile 'com.android.support:design:23.1.1'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'net.simonvt.menudrawer:menudrawer:3.0.6'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services-auth:8.4.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile 'com.google.android.gms:play-services-maps:8.4.0'
compile 'com.firebase:firebase-client-android:2.5.0'
/*    compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'*/
compile 'com.squareup.picasso:picasso:2.5.2'
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
    transitive = true;
}
testCompile 'junit:junit:4.12'
}

主要项目 list

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      package="com.rrrrr.app">

<uses-sdk android:targetSdkVersion="23"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-permission android:name="android.permission.CALL_PHONE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.GET_TASKS"/>

<uses-feature
    android:name="android.hardware.camera"
    android:required="false"/>
<uses-feature
    android:name="android.hardware.camera.autofocus"
    android:required="false"/>

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

<permission
    android:name="com.rrrrr.app.permission.C2D_MESSAGE"
    android:protectionLevel="signature"/>

<uses-permission android:name="com.rrrrr.app.permission.C2D_MESSAGE"/>
<uses-permission android:name="android.permission.C2D_MESSAGE"/>

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"/>

<!-- android:supportsRtl="true" -->
<application
    android:name=".helper.rrrrr"
    android:allowBackup="true"
    android:hardwareAccelerated="true"
    android:icon="@mipmap/appicon"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:supportsRtl="true"
    android:theme="@style/MyMaterialTheme">
    <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/app_id"
        tools:ignore="ManifestResource"/>
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version"/>

    <activity
        android:name="com.facebook.FacebookActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Translucent.NoTitleBar"/>
    <activity
        android:name=".activity.HomeActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Holo.Light.NoActionBar"
        android:windowSoftInputMode="adjustNothing">
        <intent-filter>
            <action android:name="android.intent.action.SEND_MULTIPLE"/>

            <category android:name="android.intent.category.DEFAULT"/>

            <data android:mimeType="image/*"/>
        </intent-filter>
    </activity>
    <activity
        android:name=".activity.SplashActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme">
        <intent-filter>
            <action android:name="android.intent.action.MAIN"/>

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>

    <receiver
        android:name=".broadcast.FirebaseBroadcastReceiver"
        android:exported="true">
        <intent-filter>
            <action android:name="com.rrrrr.app.sendFireBaseBroadCast"/>

            <category android:name="com.rrrrr.app"/>
        </intent-filter>
    </receiver>
    <receiver
        android:name=".GCM.GcmBroadcastReceiver"
        android:exported="true"
        android:permission="com.google.android.c2dm.permission.SEND">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>

            <category android:name="com.motary.app"/>
        </intent-filter>
    </receiver>

    <service
        android:name=".GCM.GcmIntentService"
        android:exported="false">
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
            <action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
        </intent-filter>
    </service>

    <activity
        android:name=".activity.BaseActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.CropActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"/>
    <activity
        android:name=".activity.Signup"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.PlateRequestSubmissionActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.Signin"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.ForgotPasswordActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.ProfileActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.ResetPasswordActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>

    <meta-data
        android:name="io.fabric.ApiKey"
        android:value="hidden"/>
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="hidden"/>

    <activity
        android:name=".activity.RequestSubmissionActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:label="@string/title_activity_request_submission"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.CarDetailsActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"
        android:windowSoftInputMode="adjustNothing">
        <intent-filter>
            <action android:name="android.intent.action.SEND_MULTIPLE"/>

            <category android:name="android.intent.category.DEFAULT"/>

            <data android:mimeType="image/*"/>
        </intent-filter>
    </activity>
    <activity
        android:name=".activity.ChatActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.LicensePlateDetailsActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.PostLicensePlateActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <activity
        android:name=".activity.PaymentActivity"
        android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
        android:screenOrientation="portrait"
        android:theme="@style/MyMaterialTheme"/>
    <!--
            <service
                android:name="com.paypal.android.sdk.payments.PayPalService"
                android:exported="false"/>

            <activity
                android:name="com.paypal.android.sdk.payments.PaymentActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
            <activity
                android:name="com.paypal.android.sdk.payments.LoginActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
           <activity
                android:name="com.paypal.android.sdk.payments.PaymentMethodActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
            <activity
                android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
            <activity
                android:name="com.paypal.android.sdk.payments.PayPalFuturePaymentActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
            <activity
                android:name="com.paypal.android.sdk.payments.FuturePaymentConsentActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
            <activity
                android:name="com.paypal.android.sdk.payments.FuturePaymentInfoActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>
            <activity
                android:name="io.card.payment.DataEntryActivity"
                android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation|locale"
                android:screenOrientation="portrait"
                android:theme="@style/MyMaterialTheme"/>-->
    <activity android:name=".luminous.pick.CustomGalleryActivity">
        <intent-filter>
            <action android:name="luminous.ACTION_PICK"/>
            <action android:name="luminous.ACTION_MULTIPLE_PICK"/>

            <category android:name="android.intent.category.DEFAULT"/>
        </intent-filter>
    </activity>
    <activity
        android:name=".activity.NotificationActivity"
        android:theme="@style/Theme.CustomTranslucent">

    </activity>
</application>

aar模块的build.gradle。我使用新模块和 .aar 项目导入了这个模块

 configurations.maybeCreate("default")
 artifacts.add("default", file('telrlibrary-release-1.aar'))

项目层次结构图 enter image description here 事件注销

    1:15 PM Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

1:15 PM Gradle build finished with 1 error(s) in 3s 483ms

Gradle 控制台

    Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies]

Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2531Library
:app:prepareComAndroidSupportAppcompatV72531Library
:app:prepareComAndroidSupportCardviewV72340Library
:app:prepareComAndroidSupportConstraintConstraintLayout102Library
:app:prepareComAndroidSupportDesign2311Library
:app:prepareComAndroidSupportMediarouterV72300Library
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library
:app:prepareComAndroidSupportRecyclerviewV72311Library
:app:prepareComAndroidSupportSupportCompat2531Library
:app:prepareComAndroidSupportSupportCoreUi2531Library
:app:prepareComAndroidSupportSupportCoreUtils2531Library
:app:prepareComAndroidSupportSupportFragment2531Library
:app:prepareComAndroidSupportSupportMediaCompat2531Library
:app:prepareComAndroidSupportSupportV42531Library
:app:prepareComAndroidSupportSupportVectorDrawable2531Library
:app:prepareComCrashlyticsSdkAndroidAnswers138Library
:app:prepareComCrashlyticsSdkAndroidBeta116Library
:app:prepareComCrashlyticsSdkAndroidCrashlytics257Library
:app:prepareComCrashlyticsSdkAndroidCrashlyticsCore2310Library
:app:prepareComFacebookAndroidFacebookAndroidSdk490Library
:app:prepareComGoogleAndroidGmsPlayServices840Library
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library
:app:prepareDarahimTelrlibraryRelease1UnspecifiedLibrary
:app:prepareIoFabricSdkAndroidFabric1312Library
:app:prepareNetSimonvtMenudrawerMenudrawer306Library
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:mergeDebugShaders UP-TO-DATE
:app:compileDebugShaders UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:processDebugManifest
C:\Users\mu\Desktop\myapp\app\src\main\AndroidManifest.xml:53:9-39 Error:
    Attribute application@icon value=(@mipmap/appicon) from AndroidManifest.xml:53:9-39
    is also present at [myapp:telrlibrary-release-1:unspecified] AndroidManifest.xml:18:9-43 value=(@mipmap/ic_launcher).
    Suggestion: add 'tools:replace="android:icon"' to <application> element at AndroidManifest.xml:49:5-273:19 to override.
C:\Users\mu\Desktop\myapp\app\src\main\AndroidManifest.xml:50:9-41 Error:
    Attribute application@name value=(com.rrrr.app.helper.MotaryApp) from AndroidManifest.xml:50:9-41
    is also present at [myapp:telrlibrary-release-1:unspecified] AndroidManifest.xml:16:9-59 value=(com.telr.mobile.sdk.TelrApplication).
    Suggestion: add 'tools:replace="android:name"' to <application> element at AndroidManifest.xml:49:5-273:19 to override.
C:\Users\mu\Desktop\myapp\app\src\main\AndroidManifest.xml:57:9-47 Error:
    Attribute application@theme value=(@style/MyMaterialTheme) from AndroidManifest.xml:57:9-47
    is also present at [myapp:telrlibrary-release-1:unspecified] AndroidManifest.xml:21:9-40 value=(@style/AppTheme).
    Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:49:5-273:19 to override.
C:\Users\mu\Desktop\myapp\app\src\main\AndroidManifest.xml:6:5-46 Error:
    uses-sdk:minSdkVersion 15 cannot be smaller than version 21 declared in library [myapp:telrlibrary-release-1:unspecified] C:\Users\mu\.android\build-cache\1cd525d2640e923ca7aab868b0d3fdaa85853546\output\AndroidManifest.xml
    Suggestion: use tools:overrideLibrary="com.telr.mobile.sdk" to force usage


See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

:app:processDebugManifest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugManifest'.
> Manifest merger failed with multiple errors, see logs

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.238 secs

最佳答案

您已声明:

appTheme: myMaterialTheme 声明了两次,可能在应用程序和 aar 包内

和ic_launcher 和appicon 等其他一些东西一样

观察它给出的建议:

add 'tools:replace="android:name"' to <application> element

关于Android Studio 当包含 .aar 模块时出现错误 :Execution failed for task ':app:processDebugManifest' . [Duplicat],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46192789/

相关文章:

java - 如何修复错误 :java. util.concurrent.ExecutionException : com. android.ide.common.process.ProcessException:

android - 如何在不打开谷歌浏览器的情况下在应用程序中打开文档文件?

c# - Linq 中的 Sql IN 子句等效

typescript - 有没有办法在 TypeScript 中递归解包函数类型?

oracle - 触发器中的SQL IF ELSE语句

android - 如何在android studio中集成google meet

javascript - 使用 Android 网络浏览器上传图书馆照片

java - SingleView ImageLoader 显示 NullPointerException

java - 应用程序在 android.support.v7.widget.Space 上崩溃

java - Android Studio抛出 "android.content.res.Resources$NotFoundException"