標籤:android 開發架構
以前給大家介紹的xUtils是國內比較火的快速開發架構,但是它的註解機制不是太穩定而且註解可選也比較少,今天給大家介紹一個國外的一個架構主要專註於註解的開發,簡化Android代碼編寫,因為配置注意事項較為複雜,所以先詳細介紹一下配置:
git官網:https://github.com/excilys/androidannotations
下載完解壓目錄如上,AndroidAnnotations是源碼工程,example是例子工程,
開啟\examples\HelloWorldEclipse,如下:
複製 compile-libs檔案夾到自己的工程根目錄,開啟libs檔案夾 複製androidannotations-api-3.0.1.jar
到自己工程的libs檔案夾下。如下:
選中自己工程 project->properties->Java build path->libraries->add jars把androidannotations-api-3.0.1.jar添加進來
如下:
開啟 Java compiler,選中enable project specific settings 設定compiler compliance level 1.6以上,如下:
接著選中annotation processing選中enable annotation processing,如下:
接著展開annotation processing選中factory path->add jars 把compile-libs下的androidannotation-xxx.jar添加進來。如下:
androidannotation-xxx.jar是工程編譯檔案,androidannotations-api-3.0.1.jar是api調用檔案。
注意事項:
若需要混淆打包請在proguard-project.txt添加:-dontwarn org.springframework.**
如有問題請留言,轉載註明出處。