Отслеживание these шагов для настройки android annotation
зависимости в проекте. Ссылка официального documentation.Как интегрировать андроид андроид в приложении Android?
Теперь создал sharedPreference
класс в проекте:
@SharedPref(value = SharedPref.Scope.UNIQUE)
public interface SampleApp {
@DefaultInt(0)
int appOpenedCount();
@DefaultInt(0)
int appOpenedCountVersionSpecific();
}
Я пытаюсь получить доступ к этим preferences
в андроида классе:
@SuppressLint("Registered")
@EApplication
public class HuntApp extends Application {
private static HuntApp appInstance;
private static Context mContext;
public static SampleApp_ appPref;
@Override
public void onCreate() {
super.onCreate();
appPref = new SampleApp_(this);
}
Но это бросает ошибку:
Error:(19, 19) error: cannot find symbol class SampleApp_
Я повторно подтвердил зависимости и шаги, но не смог построить проект. Что я здесь делаю неправильно? Любая помощь будет заметна.
Edit-1 AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<application
android:name=".HuntApp_"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity_"></activity>
</application>
Edit-2 Модуль Gradle файла:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
repositories {
mavenCentral()
mavenLocal()
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'android-apt'
def AAVersion = '3.3.2'
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName "com.app.huntapp"
logLevel 'INFO'
logFile '/var/log/aa.log'
}
}
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.app.huntapp"
minSdkVersion 19
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:design:24.0.0'
}
Вы добавили 'import'? Попробуйте перестроить свой проект. –
Извините. не понял. какой импорт? –
Я имею в виду строку 'import' класса SampleApp_ в HuntApp. –