Skip to content Skip to sidebar Skip to footer

Android Annotations And Flavors In Android Studio 1.0.1

i'm trying to add two flavors in my project, I already have android annotations and it's working fine without the favors, but when I'm adding the two favors the MainActivity_ clas

Solution 1:

I'm myself using AndroidAnnotations for a while now and I have a few projects that require product flavors as well. So far I managed to make it work.

My guess would be that you misconfigured your resourcePackageName in your apt.

Here is what I do in my (truncated) build.gradle file:

ext {
APP_NAME = "your app name here"
}

defaultConfig {
    applicationId APP_GROUP
    versionName APP_VERSION
    versionCode 1
    minSdkVersion 12
    targetSdkVersion 21
}

apt {
arguments {
    androidManifestFile variant.outputs[0].processResources.manifestFile
    resourcePackageName android.defaultConfig.applicationId
}
}

You might also want to have a custom applicationId for each flavor your using. You can do it that way:

productFlavors {
    flavor1 {
        applicationId android.defaultConfig.applicationId + ".flavor1"
    }
    flavor2 {
        applicationId android.defaultConfig.applicationId + ".flavor2"
    }
}

Hope this solves your issue ;)

Post a Comment for "Android Annotations And Flavors In Android Studio 1.0.1"