Manifest merger failed with multiple errors while updating to API 26 in android

匿名 (未验证) 提交于 2019-12-03 09:02:45

问题:

I tried updating my gradle with API 26 (Android Studio 2.3.3). But I am getting the following error while compiling the project.

Here is the screenshot of the error I am getting:

Application level build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.  buildscript {     repositories {         jcenter()     }     dependencies {         classpath 'com.android.tools.build:gradle:2.3.3'         classpath "io.realm:realm-gradle-plugin:3.5.0"         // NOTE: Do not place your application dependencies here; they belong         // in the individual module build.gradle files     } }  allprojects {     repositories {         jcenter()         maven { url 'https://jitpack.io' }         maven { url "https://maven.google.com" }     } }  task clean(type: Delete) {     delete rootProject.buildDir } 

This is my Merged Manifest:

If I remove tools:replace="android:value" from the application tag. I am getting below error.

This is my build.gradle file:

apply plugin: 'com.android.application' apply plugin: 'realm-android'  android {     compileSdkVersion 26     buildToolsVersion "26.0.2"     defaultConfig {         applicationId "com.ignite.a01hw909350.kolamdemo"         minSdkVersion 19         targetSdkVersion 26         versionCode 1         versionName "1.0"         vectorDrawables.useSupportLibrary = true         testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"         ndk {             abiFilters "armeabi", "armeabi-v7a", "x86", "mips"         }     }     buildTypes {         release {             minifyEnabled false             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'         }     }     aaptOptions {         noCompress 'KARMarker'         noCompress 'armodel'     }  } dependencies {     compile fileTree(include: ['*.jar'], dir: 'libs')     androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {         exclude group: 'com.android.support', module: 'support-annotations'     })     compile project(':KudanAR')     compile "com.android.support:support-compat:26.0.2"     compile 'com.android.support:appcompat-v7:26.0.2'     compile 'com.android.support.constraint:constraint-layout:1.0.2'     compile 'com.android.volley:volley:1.0.0'     compile 'nl.dionsegijn:konfetti:1.0.2'     compile 'me.zhanghai.android.materialprogressbar:library:1.4.1'     compile 'io.palaima:smoothbluetooth:0.1.0'     compile 'com.android.support:recyclerview-v7:26.0.2'     compile 'com.afollestad.material-dialogs:core:0.9.3.0'     compile 'com.flurgle:camerakit:0.9.17'     compile 'com.github.zhukic:sectioned-recyclerview:1.0.0'     compile 'com.android.support:cardview-v7:26.0.2'     compile 'com.prolificinteractive:material-calendarview:1.4.3'     compile 'com.github.bumptech.glide:glide:3.8.0'     compile 'com.android.support:design:26.0.2'     compile 'com.github.barteksc:android-pdf-viewer:2.4.0'     compile 'org.rajawali3d:rajawali:1.1.668@aar'     compile 'com.tapadoo.android:alerter:2.0.0'     compile 'com.google.android.gms:play-services-location:11.0.4'     compile 'com.github.GoodieBag:ProtractorView:v1.2'     compile 'com.android.support:gridlayout-v7:26.0.2'     compile 'com.stepstone.stepper:material-stepper:3.3.0'     compile 'pub.devrel:easypermissions:0.4.3'     compile 'com.intuit.sdp:sdp-android:1.0.4'     compile 'com.github.apl-devs:appintro:v4.2.2'     compile 'com.airbnb.android:lottie:2.2.5'     testCompile 'junit:junit:4.12' } 

This is my Manifest.xml file:

    <?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.ignite.a01hw909350.kolamdemo">      <uses-permission android:name="android.permission.CAMERA" />     <uses-permission android:name="android.permission.INTERNET" />     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />     <uses-permission android:name="android.permission.BLUETOOTH" />     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />     <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />     <uses-permission android:name="android.permission.READ_PHONE_STATE" />      <supports-screens android:requiresSmallestWidthDp="320" />     <supports-screens android:xlargeScreens="true" />      <application         android:name=".AppController"         android:allowBackup="true"         tools:replace="android:value"         android:hardwareAccelerated="true"         android:icon="@mipmap/ic_launcher"         android:label="@string/app_name"         android:largeHeap="true"         android:roundIcon="@mipmap/ic_launcher_round"         android:supportsRtl="true"         android:theme="@style/AppTheme">          <!-- <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/> -->         <activity             android:name=".ARCameraActivity"             android:configChanges="orientation|screenSize"             android:screenOrientation="fullSensor" />         <activity             android:name=".RegistrationActivity"             android:screenOrientation="portrait"             android:windowSoftInputMode="adjustResize" />         <activity             android:name=".LoginActivity"             android:screenOrientation="portrait"             android:windowSoftInputMode="adjustResize" />         <activity             android:name=".SplashActivity"             android:screenOrientation="portrait">              <!-- android:theme="@style/SplashTheme"> -->             <intent-filter>                 <action android:name="android.intent.action.MAIN" />                  <category android:name="android.intent.category.LAUNCHER" />             </intent-filter>         </activity>         <activity             android:name=".MenuActivity"             android:screenOrientation="portrait" />         <activity             android:name=".ScanAndDrawActivity"             android:screenOrientation="portrait" />         <activity             android:name=".GalleryActivity"             android:screenOrientation="portrait" />         <activity             android:name=".PdfKolamActivity"             android:screenOrientation="portrait" />          <service             android:name=".BluetoothService"             android:enabled="true"             android:exported="true">             <intent-filter>                 <action android:name="com.ignite.a01hw909350.kolamdemo.BluetoothService" />             </intent-filter>         </service>          <receiver             android:name=".MyScheduleReceiver"             android:enabled="true">             <intent-filter>                 <action android:name="android.bluetooth.adapter.action.STATE_CHANGED" />             </intent-filter>         </receiver>          <activity             android:name=".BotDialogActivity"             android:launchMode="singleInstance"             android:noHistory="true"             android:theme="@style/AppTheme" />         <activity android:name=".ModelActivity" />         <activity android:name=".PanchangActivity" />         <activity android:name=".LoadLevelActivity" />          <receiver             android:name=".MyStartServiceReceiver"             android:exported="true" />          <service             android:name=".services.AlarmService"             android:enabled="true">             <intent-filter>                 <action android:name="NOTIFICATION_SERVICE" />             </intent-filter>         </service>          <receiver             android:name=".BootReceiver"             android:enabled="true">             <intent-filter>                 <action android:name="android.intent.action.BOOT_COMPLETED" />                 <action android:name="android.intent.action.QUICKBOOT_POWERON" />             </intent-filter>         </receiver>         <activity android:name=".CurrentPanchangActivity" />         <activity android:name=".FragmentDemoActivity" />         <activity             android:name=".VideoPlayerActivity"             android:screenOrientation="landscape" />         <activity android:name=".IntroActivity"/>     </application>  </manifest> 

I have also added the new url in my application level gradle which google has recently introduced.

What is the problem in my Manifest.xml. I never got such error before updating to API 26. What can be the possible solution for this?

回答1:

Add below line in your manifest file's application tag

tools:replace="android:value" 


回答2:

If you concentrate a little bit you can find the solution, It said that the READ_PHONE_STATE is duplicated delete one of them and it said to add tools:replace="android:value" to you application tag at the manifest. Then clean and rebuild your project



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!