AndroidAnnotations框架的部署及实现过程,及AndroidStudio3.0以上集成时无法编译,碰到的天坑的解决方式

 

昨天和一个好哥们一起探讨了一下AndroidAnnotations这个框架,发现网上面好多的博客都无法实现,因为在使用AndroidAnnotations需要在android studio上配置环境,很是有些麻烦。

  在使用完AndroidAnnotations后,我感觉对eventBus, Butterknife都没有好感了,因为AndroidAnnotations这个框架实在是太好用了,现在就将配置过程放在下面;

 

实现AndroidAnnotations这个框架,所以新建一个工程,在新建的工程下面,我们进入Project的目录查看方式

 

 

大家可以看到上图有两个build。gradle 文件,一个是在app文件夹下,一个是在MyApplication下的build。gradle,那么下面就要在这两个build.gradle下面做文章了,

首先打开MyApplication下的build。gradle我们需要在

 

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
    

    // 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.8'

最后效果:

dependencies {
    classpath 'com.android.tools.build:gradle:2.1.0'
   //在此处插入gradle配置目前最高是1.8版本,
    classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

 

这样MyApplication下的build.gradle文件就配置完了,配置好的MyApplication中的build.gradle完整代码:

 

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.0'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

 

 

 

 

 

 

 

再来配置app下的build.gradle:

打开

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值