Android构建报错:mainMergedManifest文件不存在问题咨询
:app:processDebugManifest任务的文件不存在问题 Hey there, let's work through this manifest error step by step! I've gone through your project configs and noticed a few key issues that are likely causing this problem. Let's fix them one by one:
1. 移除重复的Firebase依赖
Looking at your app-level build.gradle, you've declared Firebase Authentication twice:
- One via the Firebase BOM (which is the correct modern way)
- Another with an older fixed version (
16.0.5)
This version conflict can break the manifest merging process. Remove the duplicate line:
// 删掉这一行 implementation 'com.google.firebase:firebase-auth:16.0.5'
2. 修正Google Services插件的配置
You've added com.google.gms:google-services as an implementation dependency in your app module, but this is incorrect. The Google Services plugin should be declared in your project-level build.gradle as a classpath dependency, not in the app module's dependencies.
步骤:
- Open your project root
build.gradlefile - Add the classpath entry (if not already present):
buildscript { dependencies { // 加入这一行(如果没有的话) classpath 'com.google.gms:google-services:4.3.4' } }
- Then remove this line from your app-level
build.gradledependencies:
// 删掉这一行 implementation 'com.google.gms:google-services:4.3.4'
3. 清理并重建项目
Manifest issues often get fixed by cleaning the build artifacts and rebuilding. Run these steps:
- In Android Studio, click
Build > Clean Project - Then click
File > Sync Project with Gradle Files - Finally, click
Build > Rebuild Project
If you prefer command line, run:
# Windows gradlew clean # macOS/Linux ./gradlew clean
Then sync and rebuild.
4. 检查Manifest文件的路径和结构
Double-check that your activity class paths in AndroidManifest.xml match your actual project structure. For example, .Activities.SplashActivity assumes your SplashActivity is in a package named com.example.sample.Activities. Make sure:
- The package name matches exactly (case-sensitive!)
- The activity files exist in the correct directory
5. 确认SDK和Build Tools已正确安装
Ensure you have the required SDK components installed via Android Studio's SDK Manager:
- Android 10 (API 29) SDK Platform
- Build Tools 29.0.2
If any of these are missing, install them and re-sync the project.
After trying all these steps, your manifest merging should work correctly, and the missing AndroidManifest.xml file should be generated during the build process.
内容的提问来源于stack exchange,提问作者Alex Csillag

