In one of my existing projects I already added the following libraries for use annotation shared preference
def AAVersion = "4.6.0"
dependencies {
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
}
Other objects are resolving but it isn't able to put() edit(), getOr() and get(). I manually added the module from below link, but I'm getting the same result
https://github.com/androidannotations/androidannotations
Here is the ISPreferenceUtils class
@SharedPref(value = SharedPref.Scope.UNIQUE)
public interface ISPreferenceUtils {
@DefaultBoolean(true)
boolean isFirstTime();
@DefaultBoolean(false)
boolean languageSelected();
@DefaultBoolean(false)
boolean selected();
@DefaultString("")
String selectedLocation();
@DefaultString(ISConstants.ENGLISH)
String language();
@DefaultString("")
String location();
@DefaultString("")
String userName();
@DefaultString("")
String userEmail();
@DefaultString("")
String sessionId();
@DefaultString("")
String apiToken();
@DefaultString("")
String mobileNumber();
@DefaultString("")
String userImage();
@DefaultString("")
String deviceId();
@DefaultString("")
String mobile();
@DefaultString("")
String userPassword();
@DefaultInt(0)
int userId();
@DefaultInt(0)
int locationId();
}
preferenceUtils is the object of the ISPreferenceUtils.
Here is my Gradle
def AAVersion = "4.6.0"
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.facebook.android:facebook-android-sdk:4.6.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.pacioianu.david:ink-page-indicator:1.2.0'
implementation 'com.github.jakob-grabner:Circle-Progress-View:v1.3'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.4.+'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation('com.github.hotchemi:permissionsdispatcher:2.4.0') {
exclude module: "support-v13"
}
annotationProcessor 'com.github.hotchemi:permissionsdispatcher-processor:2.4.0'
annotationProcessor 'com.github.AleksanderMielczarek:AndroidAnnotationsPermissionsDispatcherPlugin:2.0.3'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.google.firebase:firebase-database:10.2.1'
implementation 'com.google.firebase:firebase-core:10.2.1'
implementation 'com.google.firebase:firebase-crash:10.2.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
implementation('com.onesignal:OneSignal:3.10.5') {
exclude group: 'com.google.android.gms'
}
implementation 'jp.wasabeef:blurry:2.1.1'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation('ch.acra:acra:4.5.0') {
exclude group: 'org.json'
}
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4@aar') {
transitive = true;
}
implementation project(path: ':libraries:library')
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
annotationProcessor "org.androidannotations:roboguice:$AAVersion"
implementation "org.androidannotations:roboguice-api:$AAVersion"
implementation "org.roboguice:roboguice:3.0.1"
}
apply plugin: 'com.google.gms.google-services'
app-level Gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://plugins.gradle.org/m2/' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'io.fabric.tools:gradle:1.30.0'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.6'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://plugins.gradle.org/m2/' }
google()
mavenCentral()
mavenLocal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I tried a lot but It's not resolving. Can you pls help me.
you may have to add javaCompileOptions in the defaultConfig section of the app gradle file depending on your build types and flavors.
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
// If you have different applicationIds for buildTypes or productFlavors uncomment this block.
javaCompileOptions {
annotationProcessorOptions {
arguments = ["resourcePackageName": android.defaultConfig.applicationId]
}
}
}
See also here