LoginSignup
7
5

More than 5 years have passed since last update.

【今更感】AndroidAnnotations導入

Posted at

公式サイト

導入手順

自分はGradleで導入したので、ここではGradleでの導入方法を書きます。

公式のGet Startedはこちら
https://github.com/excilys/androidannotations/wiki/Configuration

build.gradle(Project)に色々追加

  • buildScriptのrepositoriesの向き先をjcenter()からmavenCentral()に変更
  • dependenciesに「android-aptを追加」
buildscript {
    repositories {
        mavenCentral() // 追加
        // jcenter() ※コメントアウト
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.5.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8' // 追加
    }
}

build.gradle(Module)に色々追加

  • android-aptをapply
  • dependenciesに「androidannotations」と「androidannotations-api」を追加
apply plugin: 'com.android.application'
apply plugin: 'android-apt' // 追加
def AAVersion = '4.0.0' // 追加

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.3"

    defaultConfig {
        applicationId "~~~"
        minSdkVersion 19
        targetSdkVersion 23
        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'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.android.support:design:23.2.1'
    apt "org.androidannotations:androidannotations:$AAVersion"
    compile "org.androidannotations:androidannotations-api:$AAVersion"
}

これでGradleをSyncしたらandroidannotationsを利用できるようになっていると思います。
試しにActivityをEActivityで書いてみましょう。

...続きは後で書きます。

7
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
5