opened
ahornerr
username_0
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 1s
13 actionable tasks: 1 executed, 12 up-to-date
```

[Link to full modified build.gradle](https://gist.github.com/username_0/3a82d3958a79621d520c4284392a3f17)

Checking the generated path that the error spits out, `androidannotations/examples/kotlin/build/generated/source/kapt/some_flavorDebug/` is empty. 

Up a level at `androidannotations/examples/kotlin/build/generated/source/kapt/` there is an `androidannotations.log` file with the following contents:

```
14:31:52.154 [RMI TCP Connection(51)-127.0.0.1] ERROR o.a.i.h.AndroidManifestFinder:147 - Could not find the AndroidManifest.xml file, using  generation folder [androidannotations/examples/kotlin/build/generated/source/kapt/some_flavorDebug])
```

#### AndroidAnnotations version:
4.4.0-SHAPSHOT

#### Android compile SDK version:
25
'Could not find the AndroidManifest.xml file' error using AA 4.4.0-SNAPSHOT and Android Gradle plugin 3.0.0-alpha7 with productFlavors
issue
created
WonderCsabo
username_1
Thanks for the detailed bug report! Is this happening if you do not use
kotlin? Where is the generated full manifest is at in your case?
comment
created
ahornerr
username_0
It looks like the generated manifest is at `androidannotations/examples/kotlin/build/intermediates/manifests/full/some_flavor/debug/AndroidManifest.xml` but not in the `generated`folder.

I haven't tested without kotlin but I can tomorrow.
comment
created
ahornerr
username_0
@username_1 Swapping out `kapt` for `annotationProcessor`, disabling the `kotlin-apt` Gradle plugin, it appears to work.

It seems like kapt may be the issue here. I'm also getting a warning for both `kapt` and `annotationProcessor`:

```
warning: The following options were not recognized by any processor: '[resourcePackageName]'
```
comment
created
ahornerr
username_0
It appears that the `resourcePackageName` annotation processor issue is related to the Android Gradle plugin, see: https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#variant_api

This breaks my current workflow because each of my application flavors have different application IDs.
comment
created
WonderCsabo
username_1
The application ID may be different, but your resource package name should
be the same (this is the package where the R file is generated). In all my
projects I have the same Workflow as you. Moreover, I think the linked
change is not related to this.
comment
created
WonderCsabo
username_1
Thanks for the details. Please ignore that warning, it is a false positive,
and was always displayed.

@username_2 I thought we fixed this for kapt. WDYT?
comment
created
dodgex
username_2
@username_1 yes, but @username_0 states that the manifests are now generated in `build/intermediates/manifests/full/some_flavor/debug/AndroidManifest.xml` instead of `build/generated/source/[k]apt`. Maybe google changed the ouput directories once again.

We should investigate this, maybe we need to enhance/update the `GradleAndroidManifestFinderStrategy`. :/
comment
created
WonderCsabo
username_1
I found what is the problem. We still have the `kapt` block which tries to set the manifest according to the `variant`. @username_0 is right, this is not working anymore. However, we already find the manifest automatically, configuring the `androidManifestFile` in the `kapt` block is not necessary. I tried it, if you remove the `kapt` block, it will compile!
comment
created
dodgex
username_2
Not sure what you mean with `kapt` block?
comment
created
WonderCsabo
username_1
@username_2 eh, i missed the most important thing, the flavor. It is still not working.
comment
created
WonderCsabo
username_1
Okay, i see what is the problem now... The Java annotation processor uses this generation folder in the end: `flavor/buildtype` . However `kapt` uses this generation folder : `flavorBuildtype`. This is pretty tricky, because we have to parse the variant name into the two parts in some way...

I will report this to the Kotlin guys, maybe way agree to change this directory to be in par with the Java one.
comment
created
WonderCsabo
username_1
I created [this](https://youtrack.jetbrains.com/issue/KT-19245) issue. Let's see if they are willing to change this. If not, we have to come up with a workaround.
comment
created
dodgex
username_2
I voted for the issue. :+1:
comment
created
ahornerr
username_0
I was hoping it would be possible to hook into the Android Gradle variants API to fetch the generated manifest path but unfortunately it's the same broken API that is throwing the `resourcePackageName` error. We may need to wait for the Android build team to fix the variants API first.
comment
created
ahornerr
username_0
I did a bit more testing, getting my project back to a stable state with an older version of the Android Gradle plugin. Using v2.3.1 and the following `kapt` configuration, I have AA v4.4.0-SNAPSHOT working.

```groovy
kapt {
    arguments {
        arg("androidManifestFile", variant.outputs[0].processResourcesTask.manifestFile)
        arg("resourcePackageName", android.defaultConfig.applicationId)
    }
}
```

Both of these arguments are necessary - without either of them the build will fail.

Knowing that these two arguments are necessary, and that the Android Gradle plugin variants API is broken, it makes sense why AA isn't working for me with the 3.0.0-alpha plugin.
comment
closed
WonderCsabo
username_1
issue