Android Annotations号称 "是一个能够加速 Android 开发的开源框架,它可以帮助开发者处理
一些前后台任务、rest 服务、应用类、代码片段等,让开发者专注于真正重要的东西”。
为了看看实际效果,今天搭建环境,简单试用了一下(只是跑起来了。。。)
一、准备工作
- 在https://github.com/excilys/androidannotations下载源码及相关的jar包
- 按照https://github.com/excilys/androidannotations/wiki/Eclipse-Project-Configuration上的步骤配置Eclipse
二、运行Demo
将demo中examples\HelloWorldEclipse目录下的项目导入到Eclipse中,运行良好
三、运行简单工程
-
工程目录
-
配置Eclipse
-
代码
package com.example.tmptmp; import com.googlecode.androidannotations.annotations.EActivity; import android.app.Activity; @EActivity(R.layout.activity_first) public class FirstActivity extends Activity { }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/helloTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="17dp" android:layout_marginTop="15dp" android:text="TextView" /> </RelativeLayout>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.tmptmp" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.example.tmptmp.FirstActivity_" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
-
运行结果
可以正常运行
四、问题
疑问一: 为什么在manifest中配置Activity名字时要多加一个"_"
疑问二: 复杂项目中是否能正常使用,比如结合第三方的库
带着这两个问题,继续看看
相关推荐
Android annotations 注解 使用,一些使用的注解实现更好的编程
Android 注解入门,方便以后的学习,提高代码开发效率。
最新android-support-v4 .jar,android-support-annotations.jar
功能:完全注解框架,一切皆为注解:声明控件,绑定控件,设置监听,setcontentview,长按事件,异步线程,全部通过注解实现。 优点:完全的注解,使开发起来更加便利,程序员写的代码也更少。...
android-support-annotations.jar.zip
java.io.IOException: Could not parse XML from android/accounts/annotations.xml 原因:sdk下/platform-tools/api/annotations.zip这个文件里的xml文件不规范造成的。解决方法:到sdk目录下找到/platform-tools/...
android demo,annotations4.4.0和android studio3.0.1的配置使用的实现。实现了一个textview和button的title的设置和onclick的编写。
android-support-annotations-25.3.1.jar 最近版本jar包,可直接导入使用。
Android官方提供的一个注解库,它提供了许多有用的注解,这些注解的生命周期为源码时期,也就是在编译之后则不再保留,通常用于辅助代码上的静态检查
编译时遇到以下报错:app:...java.io.IOException: Could not parse XML from annotations/android/widget/annotations.xml 请将本文件替换SDK目录下的/platform-tools/api/annotations.zip文件,建议替换前备份原文件
最全的,解压后是jar文件,用于解决eclipse中 无法加载android.support.annotations的问题
support-annotations-28.0.0,自己用的eclipse的jar包,方便用户使用!
此存储库显示了一个不工作的 Android Annotations 示例,其中包含当前的 android-gradle 插件 1.4 和 Android Annotations 3.2 该应用程序由一个主应用程序模块和一个库模块组成。 两者都使用 Android 注释 (AA)。 ...
Android注解支持,Android support library从19.1版本开始引入了一个新的注解库,support-annotations.zip
编译时如果遇到以下报错:app:lintVitalRelease[Fatal Error] :43:...java.io.IOException: Could not parse XML from annotations/android/widget/annotations.xml 请将本文件替换SDK目录下的/platform-tools/api资源
赠送jar包:error_prone_annotations-2.3.2.jar; 赠送原API文档:error_prone_annotations-2.3.2-javadoc.jar; 赠送源代码:error_prone_annotations-2.3.2-sources.jar; 赠送Maven依赖信息文件:error_prone_...
赠送jar包:swagger-annotations-2.1.2.jar; 赠送原API文档:swagger-annotations-2.1.2-javadoc.jar; 赠送源代码:swagger-annotations-2.1.2-sources.jar; 赠送Maven依赖信息文件:swagger-annotations-2.1.2....
赠送jar包:swagger-annotations-1.5.20.jar; 赠送原API文档:swagger-annotations-1.5.20-javadoc.jar; 赠送源代码:swagger-annotations-1.5.20-sources.jar; 赠送Maven依赖信息文件:swagger-annotations-...