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.

Cannot pass resourcePackageName to new annotationProcessor #1964

@AleksanderMielczarek

Description

@AleksanderMielczarek

Hi,

apt plugin is not compatible with Gradle build tools 2.3.0 so I've switched to annotationProcessor and used approach suggested here.

I have two different applicationId based on flavor. I cannot build flavor dev. AA is looking in wrong package (should use "com.my.app" but instead "com.my.app.debug" is used). Flavor prod, which has default applciationId works. This setup works with apt and 2.2.3 tools.

I think resourcePackageName is not passed properly to AA.

Log:

14:23:45.477 [Daemon worker Thread 23] ERROR o.a.i.r.ProjectRClassFinder:47 - The generated com.my.app.debug.R class cannot be found`

build.gradle:

apply plugin: 'com.android.application'

android {
 
    defaultConfig {
        applicationId "com.my.app"   
    }

    productFlavors {    
        dev {
            applicationId "com.my.app.debug"           
        }
        prod {
            applicationId "com.my.app"           
        }
    }
}

android.applicationVariants.all { variant ->
    variant.variantData.variantConfiguration.javaCompileOptions.annotationProcessorOptions.arguments =
            ['androidManifestFile': variant.outputs[0]?.processResources?.manifestFile?.absolutePath,
             'resourcePackageName': android.defaultConfig.applicationId]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions