Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

'Could not find the AndroidManifest.xml file' error using AA 4.4.0-SNAPSHOT and Android Gradle plugin 3.0.0-alpha7 with productFlavors #2028

@ahornerr

Description

@ahornerr

Using the latest 4.4.0-SNAPSHOT version of AA with the latest Android Gradle alpha, locating the AndroidManifest.xml file fails when using product flavors.

I believe this issue may also be related to #2024

Taken from the example here: https://github.com/WonderCsabo/androidannotations/blob/2024_example/examples/gradle/build.gradle

Make the following changes:

Modified the Gradle Android plugin to 3.0.0-alpha7 and enable Kotlin/Kapt

buildscript {
    dependencies {
        classpath "com.android.tools.build:gradle:3.0.0-alpha7"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.0"
    }
}

apply plugin: "kotlin-android"
apply plugin: "kotlin-kapt"

Added a flavorDimension of flavor and productFlavor of some_flavor

android {
    flavorDimensions "flavor"
    productFlavors {
        some_flavor {
            println "Defining the product flavor 'some_flavor'"
        }
    }
}

Modify AA dependency to use kapt instead of annotationProcessor

dependencies {
    kapt "org.androidannotations:androidannotations:$AAVersion"
}

Trying to compile the application with these changes throws an error, unable to locate AndroidManifest.xml in the generated folder.

# ./gradlew assembleSome_flavorDebug

> Configure project :
Defining the product flavor 'some_flavor'

w: The '-d' option with a directory destination is ignored because '-module' is specified
e: error: Could not find the AndroidManifest.xml file, using  generation folder [androidannotations/examples/kotlin/build/generated/source/kapt/some_flavorDebug])
e:

e: androidannotations/examples/kotlin/src/main/kotlin/org/androidannotations/gradle/activity/HelloAndroidActivity.kt: (1, 1): Some error(s) occurred while processing annotations. Please see the error messages above.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kaptSome_flavorDebugKotlin'.
> Compilation error. See log for more details

* 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

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])

Upon further research, I can see that the manifest is being generated to androidannotations/examples/kotlin/build/intermediates/manifests/full/some_flavor/debug/AndroidManifest.xml but it doesn't seem like AA is picking it up.

AndroidAnnotations version:

4.4.0-SHAPSHOT

Android compile SDK version:

25

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions