Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Android Studio + Gradle + Annotations to work together

I've been trying to get annotations to work in my gradle file so that I can use it with dagger, thus far with little success. Here is my gradle file (using android studio 1.0 and gradle 1.0.0-rc4), to which I receive the following error when I try to sync:

Error:No such property: projectDependencies for class: com.android.build.gradle.internal.api.ApplicationVariantImpl_Decorated

Gradle file:

buildscript {
repositories {

    mavenCentral()
}

dependencies {

    classpath 'com.android.tools.build:gradle:1.0.0-rc4'
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4+'
}
}

apply plugin: 'com.android.application'
apply plugin: 'android-apt'


repositories {

mavenCentral()
}

android {
compileSdkVersion 21
buildToolsVersion '21.1.1'

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
}
lintOptions {
    checkReleaseBuilds false
    abortOnError false
    disable 'InvalidPackage'
}

buildTypes {
    release {
        minifyEnabled true
        proguardFile 'proguard-android.txt'
    }

    debug {
        minifyEnabled true
        proguardFile 'proguard-android.txt'
    }

}

dexOptions {
    preDexLibraries = false
}
}


apt {
arguments {
    androidManifestFile variant.processResources.manifestFile
    resourcePackageName 'my_package_name'
}
}

dependencies {
...

// Dependency Injection
compile 'com.squareup.dagger:dagger:1.2.2'
provided 'com.squareup.dagger:dagger-compiler:1.2.2'
...

apt 'org.androidannotations:androidannotations:3.0.1'          
compile 'org.androidannotations:androidannotations-api:3.0.1'  
compile fileTree(dir: 'libs', include: ['*.jar'])

}
like image 970
Jon Avatar asked May 14 '26 10:05

Jon


1 Answers

I'm not sure if this would be an answer to the entirety of your question but that error can be fixed by:

replacing this line: androidManifestFile variant.processResources.manifestFile

to: androidManifestFile variant.outputs[0].processResources.manifestFile

according to this reference

like image 56
serkanozel Avatar answered May 16 '26 00:05

serkanozel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!