问题描述
每次我要构建项目时,都会出现此错误“原因:重复的条目:AndroidManifest.xml”。 我已经清理并重建了项目,但仍然出现此错误。 我的合并清单没有错误。
这是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>
这是/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>
这是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
}
解决方法
我发现了问题所在,忘记了删除库文件夹中的 .iml 文件,删除了该文件,并清除了错误。 虽然我仍然遇到代码中的一些错误,但是与我发布的这个问题无关。