ant androidannotations 配置

时间 : 15-01-26 栏目 : Android, 移动开发 作者 : noway 评论 : 0 点击 : 739 次

https://github.com/excilys/androidannotations/wiki/Building-Project-Ant

Building Project Ant

Damien edited this page  · 29 revisions

09/11/2014 The 3.2 release is out !

Using AndroidAnnotations

Questions?

Enjoying AndroidAnnotations

Improving AndroidAnnotations

Clone this wiki locally

 Clone in Desktop

What you should know before starting

AndroidAnnotations works by generating code at compile time.

AndroidAnnotations provides two jars:

  • androidannotations-X.Y.jar is needed to generate the code at compile time. There is no reason to keep this jar at runtime because:
    • Its code will never be executed at runtime.
    • It makes your APK size bigger than needed.
  • androidannotations-X.Y-api.jar only contains the code you need at runtime.

Prerequisites

  • This tutorial is based on the SDK v19. If you use another version, you may need to adapt this tutorial.
  • if you don't already have a build.xml file, you can easily generate one:
android update project --path "$PROJECT_ROOT$"

How to

  • Create a new folder at the root of your project (compile-libs would be a good candidate) and put androidannotations-X.Y.jar in this folder.
  • Put androidannotations-X.Y-api.jar in the $PROJECT_ROOT$/libs
  • Create a custom_rules.xml Ant file next to your build.xml Ant script. Thebuild.xml script generated by the Android tools automatically importscustom_rules.xml if it exists. This enables you to customize the build, without having to modify build.xml, which can therefore be easily updated.
  • Add properties for the generated source folder in custom_rules.xml
    <property name="generated.dir" value=".apt_generated" />
    <property name="generated.absolute.dir" location="${generated.dir}" />
    <property name="java.compilerargs" value="-s &apos;${generated.absolute.dir}&apos;" />

Note: In some case you may have to replace .apt_generated by gen to make the whole thing works.

  • Override the -pre-compile target in custom_rules.xml
    <target name="-pre-compile">
        <mkdir dir="${generated.absolute.dir}" />
    </target>
  • Override the -compile target in custom_rules.xml
    • Open $ANDROID_SDK_ROOT$/tools/ant/build.xml
    • Locate the -compile target in this file:
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile">
 ...
</target>
  • Copy the target and its content into custom_rules.xml
  • Modify the classpath when javac is invoked by adding a <fileset> node, and configure javac to generates the sources in a dedicated folder:
<target name="-compile" ...>
...
            <path id="project.javac.classpath">
                ...
+               <fileset dir="compile-libs" includes="*.jar"/>
            </path>
...
</target>
  • You should now be able to build you project using ant:
ant clean release

Next steps

Potential issues

  • If you put the two AndroidAnnotations jars in the $PROJECT_ROOT$/libs you will encounter the following error:
java.lang.IllegalArgumentException: already added: Lcom/googlecode/androidannotations/annotations/AfterViews;

androidannotations-X.Y-api.jar is a subset of androidannotations-X.Y.jar. So each class inandroidannotations-X.Y-api.jar is present in androidannotations-X.Y.jar.

This error is thrown when the dx command is invoked and two classes with the same name and package name are detected. To prevent this error you have to moveandroidannotations-X.Y.jar file away from the $PROJECT_ROOT$/libs folder.

  • Anything else? Contact us on the mailing list, or create an issue, and we'll try to help you.
  • After upgrading the Android SDK, the content of$ANDROID_SDK_ROOT$/tools/ant/build.xml may have changed. Therefore, your ant build may be broken. The solution is to replace the content of the -compiletarget in custom_rules.xml with the new -compile target content defined in$ANDROID_SDK_ROOT$/tools/ant/build.xml

本文标签

除非注明,文章均为( noway )原创,转载请保留链接: http://blog-old.z3a105.com/?p=404

ant androidannotations 配置:等您坐沙发呢!

发表评论





       ==QQ:122320466==

 微信    QQ群


0

Aujourd’hui, une partie avec le développement du e-commerce, achats en ligne est devenu une partie de la vie pour beaucoup de gens. La mariage a commencé achats en ligne. Si vous choisissez achats les mariages en ligne, il peut être beaucoup moins cher que le salon de la Robe de mariée pas chermariée local, réduisant le budget de mariage. vous pouvez avoir beaucoup de choix si acheter de mariage en ligne. vous pouvez ramasser une robe de mariée bon marché sur Internet.
Piercing fascinerande figur, och nu tittar vi på 2016 senast brudklänning, kan du vara den vackraste bruden det!2016 senaste Bra brudklänning, söt temperament Bra design, romantiska spetsar blomma kjol, som du lägger till en elegant och charmig temperament.Kvinnan tillbaka mjuka linjer, människor brudklänningofta få en känsla av oändlig frestelse. Fall 2016 mässan, lämnar uppgifter om ditt bröllop charmig.
Yesterday afternoon, the Chinese team was training in the Guangzhou Gymnasium, when the reporter asked Zhao Yunlei the feeling of wearing the new cheap jersey , cheap jerseys online shopshe readily took a shirt from the bag crumpled ball to reporters, and she said with a smile: ” This shirt is light. ”Zhao Yunlei said: “Our material is very light like with the clothes of the tennis King Nadal, Federer, after the sweat, sweat does not drip down to the ground, when we do move, it is easy pace slipping if the sweat drip on the floor.”Tennis players Zhang Yawen, told reporters: “You might think the clothes attached to the body, fearing we swing will be affected, in fact, we do not feel anything, because the clothes are very light, very soft, put on quite comfortable. And it’s particularly good clothes to dry, washing and will dry in 15 minutes. ”
China’s sports enthusiasts NFL sweatshirt with mad love and the pursuit of, and therefore, NFL jerseys have a good market in China and development. China is a populous country, is the consumer, the economic momentum is so good, the sales prospects sportswear is immeasurable. With hot sales sweatshirt, but also to promote the importance of sports fans, on health, on the other hand is a matter of concern for the World Cup, fans wearing NFL jerseys and also can express themselves more fully love and obsession Therefore, NFL jerseys Wholesale jerseys online shopwholesale has good prospects and development in China.
ANTA-ANTA Sports Products Limited, referred to as ANTA Sports, Anta, is China’s leading sporting goods companies, mainly engaged in the design, development, manufacture and marketing of ANTA brand sporting goods, including sports footwear, apparel and accessories. Anta sweatshirt design advantages, warm stretch knit fabric, using Slim version of model, more personal fit, bid farewell to bloated, so wearing more stylish.GUIRENNIAO-This logo is a spiritual totem, smooth graphics implication unstoppable force; flexible deliver an elegant arc Wholesale jerseys china shop movement, strength and speed of the United States, a symbol of passion and rationality publicity “Heart” and “meaning”, “concept” unity; pass the fearless and enterprising mind, showing beyond the realm of self, to unstoppable force to create the future.XTEP-Xtep (China) Co., Ltd. is a comprehensive development wholesale jerseys china shop, production and marketing of Xtep brand (XTEP) sports shoes, clothing, bags, caps, balls, socks mainly large sporting goods industry enterprises.
There are a lot of fans in identifying the authenticity of the above cheap jerseys have great distress, so here to i will show you some methods to definitely affordable inexpensive cheap jerseys : Firstly, we should look at if it is working fine. China has been called the world’s factory, a lot cheap jerseys factories in China have foundries, but our cheap jerseys are all from here! Secondly, should to see whether it is the , we all know that it is difficult to get out of print once a genuine cheap cheap jerseys free shipping jersey was print. and we have all kind of stocka on the whole website, in other words, we have all you want ! Finally, look at the price, our price is not necessarily the lowest in the whole website but it must be most fair on the whole website, we certainly you will not regret later when you buy it. Of course, except that cheap jerseys, we also have the other products, such as socks, leggings and some other related products, everyone can enjoy the best services of here!

KUBET