AndroidAnnotations与ButterKnife

sheikhdz 2018-04-22

因为AndroidAnnotations是自动构建了一个新的Activity
给重构代码带来很多的不方便
我推荐butterknife

引入方式:

    //AndroidAnnotations
    annotationProcessor "org.androidannotations:androidannotations:4.3.1"
    compile group: 'org.androidannotations', name: 'androidannotations-api', version: '4.3.1'

    //butterknife
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
    compile 'com.jakewharton:butterknife:8.8.0'


举例:butterknife
dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:design:25.3.1'
    compile 'com.squareup.retrofit2:retrofit:2.3.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    //Gson
    compile 'com.google.code.gson:gson:2.6.2'
    //zxing
    compile(project(':zxing-android-embedded')) { transitive = true }
    //butterknife
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.0'
    compile 'com.jakewharton:butterknife:8.8.0'
    //test
    testCompile 'junit:junit:4.12'
}

相关推荐