Gradle does not recognize the AndroidManifest.xml file in the processDebugMainManifest task, despite the file existing in the specified path

I am working on an Android project in Android Studio, and each time I try to build or sync the project, I encounter the following error:

python

A problem was found with the configuration of task ':app:processDebugMainManifest' (type 'ProcessApplicationManifest').
- In plugin 'com.android.internal.version-check' type 'com.android.build.gradle.tasks.ProcessApplicationManifest' property 'mainManifest' specifies file 'E:\15kmes\GESTIONALOYA\APP\gestionalo\app\src\main\AndroidManifest.xml' which doesn't exist.

Reason: An input file was expected to be present but it doesn't exist.
Possible solutions:
  1. Make sure the file exists before the task is called.
  2. Make sure that the task which produces the file is declared as an input.

Environment Details:

  • Operating System: Windows 10
  • Project Path: E:\15kmes\GESTIONALOYA\APP\gestionalo
  • Gradle Version in gradle-wrapper.properties: Gradle 8.7
  • JDK: Java 17
  • Android Studio: Latest stable version
  • Path to AndroidManifest.xml: E:\15kmes\GESTIONALOYA\APP\gestionalo\app\src\main\AndroidManifest.xml

What I’ve Tried So Far:

  1. Verifying the Existence of the AndroidManifest.xml File: I have confirmed that the AndroidManifest.xml file is in the path E:\15kmes\GESTIONALOYA\APP\gestionalo\app\src\main. I even tried replacing the file with a new one to ensure it’s not corrupted.
  2. Permissions: I checked that the AndroidManifest.xml file and the containing folder (src/main) have proper read and write permissions.
  3. Configuration in build.gradle:
  • I configured the app/build.gradle file to ensure the sourceSets block points to the correct manifest file:

groovy

sourceSets {
    main {
        manifest.srcFile 'src/main/AndroidManifest.xml'
        java.srcDirs = ['src/main/java']
        res.srcDirs = ['src/main/res']
        assets.srcDirs = ['src/main/assets']
        jniLibs.srcDirs = ['src/main/jniLibs']
    }
}
  • I tried using both absolute and relative paths, but the error persists.
  1. Syncing and Rebuilding the Project: After each change, I sync the project and try a full rebuild. This has not resolved the issue.
  2. Clearing the .gradle Folder:
  • I deleted the .gradle folder in the project directory (E:\15kmes\GESTIONALOYA\APP\gestionalo\.gradle) to force a cache and configuration regeneration. Then, I rebuilt the project, but the issue remains.
  1. Changing the Gradle Version:
  • I tried changing the Gradle version in gradle-wrapper.properties to previous versions, such as 7.5 and 8.3, but I encounter the same error regardless of the version.
  1. Java and Gradle Configurations:
  • I confirmed that the Java version in JAVA_HOME and in Android Studio match (Java 17).
  • I also tried launching the project with different JDK versions to check for compatibility issues, but the error did not change.
  1. Gradle Commands with --stacktrace and --info:
  • I ran the ./gradlew build --stacktrace --info command to get more error details, and it consistently points to the AndroidManifest.xml file not being found in the specified path.

Summary: Despite all the above attempts, the error persists, and Gradle continues to fail to recognize the AndroidManifest.xml file in the specified path, even though the file is indeed there.

Question: Has anyone experienced a similar problem or can suggest other methods to solve this issue? I am looking for help in identifying if there are any additional configurations or tool version conflicts that could be causing this. Any suggestions would be greatly appreciated.

1 Like

I am facing the same problem, did you find any solution?