I'm porting a module from Eclipse to Android Studio/Gradle, and need to specify the locations of my sources, resources, and manifest:
sourceSets {
main {
manifest {
srcFile './AndroidManifest.xml'
}
java {
srcDirs = ["src"]
}
resources {
srcDirs = ["resource"]
}
}
}
Android Studio/Gradle seems perfectly happy with my java
and resources
entries, but balks at my manifest
entry:
No signature of method: build_b4wnchd9ct4a5qt388vbbtbpz.sourceSets() is applicable for argument types: (build_b4wnchd9ct4a5qt388vbbtbpz$_run_closure2) values: [build_b4wnchd9ct4a5qt388vbbtbpz$_run_closure2@35290d54]
All of my googling and searching SO suggests that this should have worked.
Arctic Fox, 2020.3.1. Not sure which version of Gradle came with it.
Ahh, figured it out. Leaving here in case someone else has the same question.
Add an android.sourceSets.manifest.srcFile
entry to your module's build.gradle
file:
android {
...
sourceSets {
main {
manifest {
srcFile './AndroidManifest.xml'
}
}
}
}
or simply:
android {
...
sourceSets.main.manifest.srcFile './AndroidManifest.xml'
}
My biggest mistake was not putting the sourceSets
directive inside the android
directive.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.