Reputation: 725
I imported this project from eclipse. everything is sorted out but there is this one issue I'm stuck with.
I've a sharedPreference interface which is done using annotations
import com.googlecode.androidannotations.annotations.sharedpreferences.DefaultBoolean;
import com.googlecode.androidannotations.annotations.sharedpreferences.DefaultString;
import org.androidannotations.annotations.sharedpreferences.SharedPref;
@SharedPref
public interface RememberMePrefs {
@DefaultString("")
String email();
@DefaultString("")
String password();
@DefaultBoolean(true)
boolean enabled();
}
when I try to use this interface like this :
@Pref
RememberMePrefs_ rememberMePrefs;
it says "Cannot resolve symbol RememberMePrefs_"
this is my Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "xxxxxx"
minSdkVersion 16
targetSdkVersion 29
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
def AAVersion = '4.6.0'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
apt "org.androidannotations:androidannotations:$AAVersion"
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
implementation files('libs/android-support-v4.jar')
implementation files('libs/androidannotations-api-2.7.1.jar')
implementation files('libs/gson-2.2.2.jar')
implementation files('libs/saripaar-11242012.jar')
implementation files('libs/spring-android-core-1.0.1.RELEASE.jar')
implementation files('libs/spring-android-rest-template-1.0.1.RELEASE.jar')
implementation files('libs/actionbarsherlock.jar')
}
Any help will be appriciated as I've never worked on annotations before.
Upvotes: 0
Views: 372
Reputation: 12207
You are using the latest AndroidAnnotations library in your build.gradle, but importing the old namespace in your Java code.
You should import:
import org.androidannotations.annotations.sharedpreferences.DefaultBoolean;
import org.androidannotations.annotations.sharedpreferences.DefaultString;
import org.androidannotations.annotations.sharedpreferences.SharedPref;
This should be done in other classes as well, probably.
Upvotes: 0