Firstly, I am totally new to Android platform so please excuse me if I am committing any mistake. I am trying to build an android project using Gradle 3.0.0 version and using Google Android annotations api. Below is my project build.gradle
file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is my app build.gradle
apply plugin: 'com.android.application'
android {
defaultConfig {
applicationId "com.demo.see.android.app"
minSdkVersion 16
targetSdkVersion 26
versionCode 22
versionName "3.2.0"
compileSdkVersion 26
buildToolsVersion "26.0.2"
/*javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath true
}
}*/
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
/*apt {
arguments {
androidManifestFile ${variant.processResources.manifestFile}
resourcePackageName "com.demo.see.android.app"
}
}*/
ext.daggerVersion = '1.0.0';
ext.androidAnnotationsVersion = '2.4';
def AAVersion = '3.3.2'
//def AAVersion = "4.4.0"
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//annotationProcessor 'com.googlecode.androidannotations:androidannotations:2.4'
//compileOnly 'com.googlecode.androidannotations:androidannotations:2.4'
//implementation 'com.googlecode.androidannotations:androidannotations-api:2.4'
compile group: 'com.googlecode.androidannotations', name: 'androidannotations', version: '2.5.1'
annotationProcessor 'com.googlecode.androidannotations:androidannotations:2.5.1'
compileOnly 'com.google.android:android:4.1.1.4'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.code.gson:gson:2.2.2'
implementation 'com.google.inject:guice:2.0-no_aop'
implementation 'com.google.guava:guava:11.0'
implementation 'joda-time:joda-time:2.3'
implementation 'com.j256.ormlite:ormlite-android:4.31'
implementation 'org.roboguice:roboguice:1.1.2'
implementation 'org.apache.httpcomponents:httpmime:4.2.5'
testImplementation 'com.pivotallabs:robolectric:1.2'
testImplementation 'org.hamcrest:hamcrest-all:1.1'
testImplementation 'org.mockito:mockito-core:1.8.5'
testImplementation 'junit:junit:4.8.2'
//annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
//implementation "org.androidannotations:androidannotations-api:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
annotationProcessor "org.androidannotations:androidannotations-api:$AAVersion"*/
//implementation 'com.google.dagger:dagger:2.0'--
//annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
/* implementation "com.googlecode.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "com.googlecode.androidannotations:androidannotations:${androidAnnotationsVersion}:api"
/*apt "com.googlecode.androidannotations:androidannotations:${androidAnnotationsVersion}"
compile "com.googlecode.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
annotationProcessor "com.googlecode.androidannotations:androidannotations-api:${androidAnnotationsVersion}"
apt "com.squareup.dagger:dagger-compiler:${daggerVersion}"
compile "com.squareup.dagger:dagger:${daggerVersion}"*/
//compile 'com.google.dagger:dagger:2.0'
//annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
}
/*android.applicationVariants.each { variant ->
aptOutput = file("${project.buildDir}/source/generated/${variant.dirName}")
println "****************************"
println "variant: ${variant.name}"
println "manifest: ${variant.processResources.manifestFile}"
println "aptOutput: ${aptOutput}"
println "****************************"
variant.javaCompile.doFirst {
println "*** compile doFirst ${variant.name}"
aptOutput.mkdirs()
variant.javaCompile.options.compilerArgs += [
'-processorpath', configurations.apt.getAsPath(),
'-AandroidManifestFile=' + variant.processResources.manifestFile,
'-s', aptOutput
]
}
}*/
the exceptions revolves around the annotations usage. Note: The commented part mentioned in app.gradle are parts of trail and errors as I tried multiple permutation and combinations and got several exceptions like
`Execution failed for task ':app:javaPreCompileDebug'.
Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation
processor. Please add them to the annotationProcessor configuration.
- androidannotations-2.5.1.jar
(com.googlecode.androidannotations:androidannotations:2.5.1)`
currently, I am getting this error
Error: Unexpected error.
Please report an issue on AndroidAnnotations, with the following content: java.lang.IllegalStateException:
Could not find the AndroidManifest.xml file,
going up from path [/home/bhargav/See/see-android/app/build/generated/source/apt/debug] found using dummy file [file:///home/bhargav/See/see-android/app/build/generated/source/apt/debug/dummy1513070341263.java] (max atempts: 10)
Apart from that I have also enabled annotation processors from File> other Setting > default setting > compiler >annotation processing
I have gone through many links like below mentioned
Android studio + Gradle + Android Annotations
Androidannotations + Android Studio ( almost working )
even if after figuring out a workaround way via some configuration tuning I got error like could not found symbol Eactivity & robojuice
on lines of
import com.googlecode.androidannotations.annotations.EActivity;
import com.googlecode.androidannotations.annotations.RoboGuice;
Version which I am using in this project
- Android studio - 3.0.1
- Gradle - 3.0.0
- Java 1.8 (Android recomendation)
folder structure