I have my project's build.gradle
located in myApp/app/
directory. AndroidManifest.xml
is in myApp/app/src/main
directory, at the same level as java/
and res/
directories.
When synchronizing the project, I receive notification about missing manifest file. No wonder, actually, when the path is really incorrect. Source file is set as:
sourceSets {
main {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
and the error notification says:
Error:Cause: java.io.FileNotFoundException: /home/aqv/AndroidStudioProjects/myApp/src/main/AndroidManifest.xml (No such file or directory)
When I change the source to:
sourceSets {
main {
manifest.srcFile 'main/AndroidManifest.xml'
}
}
the text changes to:
Error:Cause: java.io.FileNotFoundException: /home/aqv/AndroidStudioProjects/myApp/app/main/AndroidManifest.xml (No such file or directory)
As you can see, there is missing path fragment: myApp/app/src/
(when setting src/main/AndroidManifest.xml
path, the error says about looking for manifest file in myApp/src/main
, so it ommits the app/
directory).
Is it a kind of gradle's bug or my project is misconfigured?
Looking for solution I found one thread at SO, but the solution from there didn't work in my case. I have dependencies set as:
compile 'com.android.support:support-v4:19.1.0'
compile 'com.android.support:appcompat-v7:19.1.0'
Every app project must have an AndroidManifest. xml file (with precisely that name) at the root of the project source set. The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.
Every project in Android includes a Manifest XML file, which is AndroidManifest. xml, located in the root directory of its project hierarchy. The manifest file is an important part of our app because it defines the structure and metadata of our application, its components, and its requirements.
The Android manifest file helps to declare the permissions that an app must have to access data from other apps. The Android manifest file also specifies the app's package name that helps the Android SDK while building the app.
The AndroidManifest. xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.
Writing an answer since could be also issue for someone.
By default Android Studio creates multi module project. So you have build.gradle
in the root folder of your project and another build.gradle
in app folder:
<your project name>
/app
/src
build.gradle
build.gradle
settings.gradle
The parent build.gradle
is usually edited if you want to specify default settings for all subprojects. It looks odd since you have only one subproject for now.
The topic starter issue was that he was adding/modifying root build.gradle
instead of app folder build.gradle
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With