问题
I get this error "Cause: duplicate entry: AndroidManifest.xml" every time I want to build my project. I have cleaned and rebuild the project and it still gives this error. my merged manifest has no errors.
This the AndroidManifest.xml
<?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.dream.chat">
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<application
android:name="com.dream.chat.BaseApplication"
android:allowBackup="false"
android:appComponentFactory="whateverString"
android:hardwareAccelerated="true"
android:icon="@drawable/ic_logo_"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true"
tools:replace="android:allowBackup,android:appComponentFactory">
<activity
android:name="com.dream.chat.activities.MainActivity"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.dream.chat.activities.ChatActivity"
android:parentActivityName="com.dream.chat.activities.MainActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize">
<!--android:windowSoftInputMode="stateHidden|adjustResize|adjustPan">-->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.dream.chat.activities.MainActivity" />
</activity>
<activity
android:name="com.google.firebase.auth.internal.FederatedSignInActivity"
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleInstance"
android:permission="com.google.firebase.auth.api.gms.permission.LAUNCH_FEDERATED_SIGN_IN"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
tools:replace="android:launchMode" />
<activity android:name="com.dream.chat.activities.ImageViewerActivity" />
<service
android:name="com.dream.chat.services.FirebaseChatService"
android:enabled="true" />
<service android:name="com.dream.chat.services.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<receiver
android:name="com.dream.chat.receivers.ConnectivityReceiver"
android:enabled="true">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<!-- https://developers.google.com/places/android-sdk/signup -->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR_API_KEY" />
<provider
android:name="com.dream.chat.utils.MyFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true"
>
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
<activity
android:name="com.dream.chat.activities.ContactViewerActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.dream.chat.activities.ChatDetailActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.dream.chat.activities.SignInActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoTitle"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.dream.chat.activities.CallScreenActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.dream.chat.activities.IncomingCallScreenActivity"
android:screenOrientation="portrait" />
<activity
android:name="com.dream.chat.activities.SplashActivity"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoTitle"
android:windowSoftInputMode="stateHidden|adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name="com.google.firebase.components.ComponentDiscoveryService" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.auth.FirebaseAuthRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<meta-data
android:name="com.google.firebase.components:com.google.firebase.iid.Registrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
<service
android:name="com.dream.chat.services.FetchMyUsersService"
android:exported="false" />
<service
android:name="com.dream.chat.services.SinchService"
android:enabled="true"
android:exported="false" />
<activity
android:name="com.dream.chat.activities.ChooseSignInActivity"
android:label="@string/title_activity_choose_sign_in"
android:theme="@style/AppTheme" />
<activity
android:name="com.dream.chat.activities.ContactActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<activity
android:name="com.dream.chat.activities.PrivacyPolicyActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize" />
<meta-data
android:name="com.dream.chat.status.glideProgressBar.OkHttpProgressGlideModule"
android:value="GlideModule" />
<activity
android:name="com.dream.chat.activities.StatusStoriesActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/FullScreenVideoTheme" />
<activity
android:name="com.dream.chat.activities.CallListActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan" />
</application>
</manifest>
This is the manifest file for the library /stories/AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rahuljanagouda.statusstories">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.rahuljanagouda.statusstories.glideProgressBar.OkHttpProgressGlideModule"
android:value="GlideModule" />
<activity android:exported="true" android:name="com.rahuljanagouda.statusstories.StatusStoriesActivity" />
</application>
</manifest>
This is the app/build.gradle
//import com.google.gms.googleservices.GoogleServicesPlugin
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
group = 'com.github.rahuljanagouda'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
repositories {
google()
flatDir {
dirs 'libs'
}
}
android {
lintOptions {
checkReleaseBuilds false
abortOnError false
}
compileSdkVersion 29
defaultConfig {
applicationId "com.dream.chat"
minSdkVersion 28
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
buildToolsVersion = '29.0.3'
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'
exclude("META-INF/*.kotlin_module")
exclude 'project.properties'
exclude 'META-INF/INDEX.LIST'
//exclude 'META-INF/AndroidManifest.xml'
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation(name: 'sinch-android-rtc', version: '+', ext: 'aar')
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation('com.googlecode.ez-vcard:ez-vcard:0.10.4') {
exclude group: 'org.freemarker'
}
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.google.firebase:firebase-core:17.5.0'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.firebase:firebase-messaging:20.2.4'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.eyalbira.loadingdots:loading-dots:1.0.2'
implementation 'com.iceteck.silicompressorr:silicompressor:2.1'
implementation 'com.kbeanie:multipicker:1.6@aar'
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
implementation 'com.vanniktech:emoji-google:0.6.0'
implementation 'com.mxn.soul:flowingdrawer-core:2.0.0'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.jakewharton:butterknife:10.2.3'
implementation project(path: ':statusstories')
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.3'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.daasuu:animateHorizontalProgressBar:0.2.4'
implementation 'com.chootdev:timezago:1.1.8'
implementation 'com.karumi:dexter:6.2.1'
implementation files('libs/libphonenumber-4.1.jar')
implementation 'com.github.bumptech.glide:glide:4.11.0'
// OkHttp3
implementation 'com.github.bumptech.glide:okhttp3-integration:4.11.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation('com.google.cloud:google-cloud-translate:1.95.1') {
exclude group: 'org.apache.httpcomponents'
exclude group: 'org.json', module: 'json'
}
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.github.adrielcafe:AndroidAudioConverter:0.0.8'
annotationProcessor 'com.google.cloud:google-cloud-translate:1.95.1'
implementation 'com.toptoche.searchablespinner:searchablespinnerlibrary:1.3.1'
}
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
apply plugin: 'com.google.gms.google-services'
//GoogleServicesPlugin.config.disableVersionCheck = true
build.gradle
// Top-level build file where Status can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url 'https://maven.fabric.io/public'
}
jcenter()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.realm:realm-gradle-plugin:5.4.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'io.fabric.tools:gradle:1.31.2'
// NOTE: Do not place Status application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { name 'glide-snapshot'; url 'http://oss.sonatype.org/content/repositories/snapshots' }
maven { url "https://jitpack.io" }
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
回答1:
I found out what the problem was, I forgot to delete the .iml file in the library folder, I deleted the file and the error was cleared. Although am still facing some bugs in the code but not related to this question I have posted.
来源:https://stackoverflow.com/questions/63551877/cause-duplicate-entry-androidmanifest-xml-with-a-project-having-two-manifest