You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
I'm trying to get AA to work in Android Studio using Gradle and nothing seems to work. This is the error I'm getting:
: 20:21:07.345 [Daemon] ERROR o.a.h.AndroidManifestFinder:134 - Could not find the AndroidManifest.xml file, going up from path
This is a brand new android project. I haven't done anything except try to get AA working.
I've tried changing the paths in the sourcesets but it doesn't work. How can I get this to work with Android Studio? The code in the wiki for Gradle does not work
The AndroidManifest file is auto-discovered by recursively search in parent folders. So there is no reason to always specify the path to this file. It works pretty fine with IntelliJ and Gradle build with CLI.
However, the apt.arguments.androidManifestFile is here to resolve this cases where AndroidManifest couldn't be find.
@tbruyelle & @theDazzler > Could you give us your projects hierarchy to understand why you need to specify androidManifestFile ? Also, you should have an androidannotations.log file in your output folder. A copy/paste may be useful too ;)
The AndroidManifest file is auto-discovered by recursively search in parent folders. So there is no reason to always specify the path to this file. It works pretty fine with IntelliJ and Gradle build with CLI.
You mean AA is able to find the correct manifest, according to the current build variant (with Android NBS, final manifest are located in build/manifests/<build-variant>/AndroidManifest.xml).
That's something new, last time I looked at the sources (some months ago), AA just looked at the root folder.
@tbruyelle & @theDazzler > Could you give us your projects hierarchy to understand why you need to specify androidManifestFile ? Also, you should have an androidannotations.log file in your output folder. A copy/paste may be useful too ;)
I use the standard NBS hierarchy, I have a manifest pattern in src/main/, but the final manifests are in build/manifests/<build-variant>.
I tried to remove the apt.arguments.androidManifestFilet configuration, and it just doesn't work :
error: 10:01:18.84 [main] ERROR o.a.h.AndroidManifestFinder:134 - Could not find the AndroidManifest.xml file, going up from path [/Users/tbruyelle/projects/myproject/app/build/source/apt/debug] found using dummy file [] (max atempts: file:///Users/tbruyelle/projects/myproject/app/build/source/apt/debug/dummy1389344478084.java)
Ok, we don't work with the same type of project structure :)
I still fit maven hierarchy and my AndroidManifest is in root folder. As AA was originally designed for this, we're looking at the root folders.
I just did some tests and we should always specify androidManifestFile like you suggested. But resourcePackageName may not be override with flavors and in this case your config will crash because this argument will receive null.
I think we should update the wiki with this :
apt {
arguments {
androidManifestFile variant.processResources.manifestFile
// uncomment the following line if you redefine packageName in flavors// resourcePackageName android.defaultConfig.packageName
}
}
The problem with removing resourcePackageName is when you use the packageNameSuffix feature of NBS [1]. This feature is very useful and I think very used by NBS users, because it allows you to deploy different versions of the same application on the same device (for me it was the feature which make me switch from maven to NBS!).
So with packageNameSuffix, the package name may be different from the resource file package. For instance if I have the following configuration for the debug build :
I understand your point, but you're still talking of a project with custom config. I don't know if it's the case for most of the projects out there.
I don't really like to duplicate package name here, that's why I suggested to keep default behavior by leaving the config commented.
However, I'll update the wiki and try to explain all of this :)
No resource found that matches the given name (at 'icon' with value '@drawable/ic_launcher').
No resource found that matches the given name (at 'label' with value '@string/app_name').
No resource found that matches the given name (at 'theme' with value '@style/AppTheme').
No resource found that matches the given name (at 'label' with value '@string/app_name').
My project structure is the standard Android Studio project structure. I just made a new app and edited my build.gradle file, that's all.
It gives this error: "Main manifest missing from ../Annoation_test/app/AndroidManifest.xml".
Strange error, because giving your configuration androidManifestFile variant.processResources.manifestFile, the manifest path should be more something like build/manifests/<build-variant>/AndroidManifest.xml.
I changed it to that to try to get rid of the error. I don't know if that's how it should be. But my project is the standard structure. Here is a screenshot
From the screenshot yes it's standard structure, and so you dont need to redefine the sourcesets (moreover you redefined them badly, for instance resources.srcDirs = ['src/res'] is not correct, correct value is resources.srcDirs = ['src/main/res'])
How do you build your project. From Android Studio ? Did you try from command line with a simple ./gradlew app:assembleDebug ?
It took away the compile errors but none of the annotations are available in my app. For example, if I try to use @EActivity, it doesn't ask to import it.
Activity
tbruyelle commentedon Jan 10, 2014
I don't understand why the
apt { arguments {}}part has been commented in the wiki, but it shouldn't !Correct configuration for
android-aptand AA is :apt { arguments { resourcePackageName android.defaultConfig.packageName androidManifestFile variant.processResources.manifestFile } }DayS commentedon Jan 10, 2014
The AndroidManifest file is auto-discovered by recursively search in parent folders. So there is no reason to always specify the path to this file. It works pretty fine with IntelliJ and Gradle build with CLI.
However, the
apt.arguments.androidManifestFileis here to resolve this cases where AndroidManifest couldn't be find.DayS commentedon Jan 10, 2014
@tbruyelle & @theDazzler > Could you give us your projects hierarchy to understand why you need to specify
androidManifestFile? Also, you should have anandroidannotations.logfile in your output folder. A copy/paste may be useful too ;)tbruyelle commentedon Jan 10, 2014
You mean AA is able to find the correct manifest, according to the current build variant (with Android NBS, final manifest are located in
build/manifests/<build-variant>/AndroidManifest.xml).That's something new, last time I looked at the sources (some months ago), AA just looked at the root folder.
I use the standard NBS hierarchy, I have a manifest pattern in
src/main/, but the final manifests are inbuild/manifests/<build-variant>.I tried to remove the
apt.arguments.androidManifestFiletconfiguration, and it just doesn't work :DayS commentedon Jan 10, 2014
Ok, we don't work with the same type of project structure :)
I still fit maven hierarchy and my
AndroidManifestis in root folder. As AA was originally designed for this, we're looking at the root folders.I just did some tests and we should always specify
androidManifestFilelike you suggested. ButresourcePackageNamemay not be override with flavors and in this case your config will crash because this argument will receivenull.I think we should update the wiki with this :
apt { arguments { androidManifestFile variant.processResources.manifestFile // uncomment the following line if you redefine packageName in flavors // resourcePackageName android.defaultConfig.packageName } }WDYT ?
tbruyelle commentedon Jan 10, 2014
The problem with removing
resourcePackageNameis when you use thepackageNameSuffixfeature of NBS [1]. This feature is very useful and I think very used by NBS users, because it allows you to deploy different versions of the same application on the same device (for me it was the feature which make me switch from maven to NBS!).So with
packageNameSuffix, the package name may be different from the resource file package. For instance if I have the following configuration for the debug build :AA will fail with that error :
If you don't define your package in
android.defaultConfig(it's not mandatory, as it's already defined in the manifest), you can hard declare it :[1] http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Types
DayS commentedon Jan 10, 2014
I understand your point, but you're still talking of a project with custom config. I don't know if it's the case for most of the projects out there.
I don't really like to duplicate package name here, that's why I suggested to keep default behavior by leaving the config commented.
However, I'll update the wiki and try to explain all of this :)
DayS commentedon Jan 10, 2014
It should be better now.
@theDazzler > Could you update your config and tell us if it works now.
DayS commentedon Jan 12, 2014
This seems to work fine. I'm closing this issue then
theDazzler commentedon Jan 12, 2014
I will try it when I get home.
theDazzler commentedon Jan 14, 2014
I tried a few different solutions as suggested and none of them work. Here is my build.gradle:
It gives this error: "Main manifest missing from ../Annoation_test/app/AndroidManifest.xml". Then I changed the sourceSets to this:
which gives these errors:
My project structure is the standard Android Studio project structure. I just made a new app and edited my build.gradle file, that's all.
T12E commentedon Jan 14, 2014
Strange error, because giving your configuration
androidManifestFile variant.processResources.manifestFile, the manifest path should be more something likebuild/manifests/<build-variant>/AndroidManifest.xml.This is not the standard project structure : http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Project-Structure
theDazzler commentedon Jan 14, 2014
I changed it to that to try to get rid of the error. I don't know if that's how it should be. But my project is the standard structure. Here is a screenshot

tbruyelle commentedon Jan 14, 2014
From the screenshot yes it's standard structure, and so you dont need to redefine the sourcesets (moreover you redefined them badly, for instance
resources.srcDirs = ['src/res']is not correct, correct value isresources.srcDirs = ['src/main/res'])How do you build your project. From Android Studio ? Did you try from command line with a simple
./gradlew app:assembleDebug?Yougin commentedon Jan 18, 2014
Bumped into the same issue, the "androidManifestFile variant.processResources.manifestFile" resolved it. Thank you.
theDazzler commentedon Jan 18, 2014
I changed my build file to use this for srcSets:
It took away the compile errors but none of the annotations are available in my app. For example, if I try to use @EActivity, it doesn't ask to import it.
theDazzler commentedon Jan 18, 2014
I build my project using android studio. I ran ./gradlew app:assembleDebug and got: