Android AOP 之AspectJ(二)

本文介绍了如何在Eclipse环境下配置Android-AOP(AspectJ),包括安装Eclipse及AJDT插件、配置Android插件、添加aspectjweaver库、修改编译器为ajc等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境搭建:

本节介绍两种IDE下Android-AOP(AspectJ-环境配置)

一:Eclipse.

  • 最新idea下载链接网址:
  • Eclipse-AJDT插件安装:
  • 内容区域如下:Development builds for Eclipse 4.4
  • AJDT 2.2.4 dev builds for Eclipse 4.4
    Update Site URL:http://download.eclipse.org/tools/ajdt/44/dev/update
    Zip file:See below
    To install from a zip file, download the zip and point your p2 installer to that file. Then proceed as if it were a normal update site. Do not unzip the update site into the dropins directory.
  • 从eclipse官网下载软件之后。我们开始搭建Android-AOP aspectJ环境。
  • 需要下载eclipse,和eclipse的ajdt插件,eclipse官网有具体版本说明。
  • 安装eclipse对jdk版本要求: 
  • Installing Eclipse is relatively easy, but does involve a few steps and software from at least two different sources. Eclipse is a Java-based application and, as such, requires a Java runtime environment (JRE) in order to run.

    Eclipse 4.6 (Neon)

    Eclipse 4.6 (Neon)is scheduled for release on June 22, 2016.

    Consider using the Installer. Please see 6 Steps to Install Eclipse.

    A Java 8 JRE/JDK is required to run all Neon packages based on Eclipse 4.6. The reasoning behind requiring Java 8 are discussed here.

    Eclipse 4.5 (Mars)

    Eclipse 4.5 (Mars) was released on June 24, 2015.

    Consider using the new Installer! Please see 6 Steps to Install Eclipse.

    A Java 7 JRE/JDK is required for all Mars package downloads based on Eclipse 4.5. Information concerning tested configurations for Eclipse 4.5 is providedhere.

    Eclipse 4.4 (Luna)

    Eclipse 4.4 (Luna) was released on June 25, 2014.

    A Java 7 JRE/JDK is required for most of the Luna package downloads based on Eclipse 4.4. Information concerning tested configurations for Eclipse 4.4 is provided here.

    Eclipse 4.3 (Kepler)

    Eclipse 4.3 (Kepler) was released in June 2013.

    A Java 6 JRE/JDK is recommended for Eclipse 4.3. More information concerning tested configurations for Eclipse 4.3 is provided here.

  • android插件配置: 点击eclipse ->help->(install  new software) --> 弹出面板add  按钮。                                                                                  name: andorid xxx  url:http://dl-ssl.google.com/android/eclipse/

     环境配置:

               1.下载一个aspectjweaver-1.8.3.java   <@== 包括@Aspect,@Pointcut 等注解,下载完成需要添加到lib中

               2.将AJDT 解压,并将 features下所有问题,拷贝到eclipse目录下对应features下。
           plugins 目录下的文件拷贝到对应的eclipse 的plugins目录下。
               3.需要将java编译器改为ajc编译器。配置如下。配置如下需要修改工程根目录下的 .project文件。 

   <projectDescription>
           ...
              <buildSpec>
                   <buildCommand>
   <name>org.eclipse.ajdt.core.ajbuilder</name>  //将javaBuilder修改为这个。
   <arguments>
                                </arguments>
                   </buildCommand>
                      <buildCommand>
                            <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
                            <arguments>
                            </arguments>
                     </buildCommand>
                     <buildCommand>
                             <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
                              <arguments>
                              </arguments>
                     </buildCommand>
                    <buildCommand>
                              <name>com.android.ide.eclipse.adt.ApkBuilder</name>
                              <arguments>
                               </arguments>
                    </buildCommand>
              </buildSpec>
              <natures>
                     <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
                     <nature>org.eclipse.ajdt.ui.ajnature</nature>
                     <nature>org.eclipse.jdt.core.javanature</nature>
               </natures>
    </ projectDescription>

二:Android-Studio

   


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值