2012-07-25 74 views
2

按照列出的所有步骤here后,我发现我的(Class)_仍未生成。未使用Ant编译的Android注释

自定义规则:

<?xml version="1.0" encoding="UTF-8"?> 
<project name="custom_rules"> 
<target name="-compile" depends="-build-setup, -pre-build, -code-gen, -pre-compile"> 
<do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> 
    <!-- merge the project's own classpath and the tested project's classpath --> 
    <path id="project.javac.classpath"> 
     <path refid="project.all.jars.path" /> 
     <path refid="tested.project.classpath" /> 
    </path> 
    <javac encoding="${java.encoding}" 
      source="${java.source}" target="${java.target}" 
      debug="true" extdirs="" includeantruntime="false" 
      destdir="${out.classes.absolute.dir}" 
      bootclasspathref="project.target.class.path" 
      verbose="${verbose}" 
      classpathref="project.javac.classpath" 
      fork="${need.javac.fork}"> 
     <classpath> 
      <fileset dir="compile-libs" includes="*.jar"/> 
     </classpath> 
     <src path="${source.absolute.dir}" /> 
     <src path="${gen.absolute.dir}" /> 
     <compilerarg line="${java.compilerargs}" /> 
    </javac> 
<!-- bunch of if conditions here --> 
</target> 
</project> 

登录:

C:{路径} {}类的.java(8:34)无法找到符号类Activity_

注:启动AndroidAnnotations注释处理

:类型'[dummy1343240015623]'的未关闭文件;这些类型不会发生注释处理

看来,开始处理无法找到Activity_。错误还是按照预期?

所有的文件都在正确的位置(\ libs中的api.jar,\ compile-libs中的.jar),并且不能为我的生活找出任何东西。

被修改:稍微捅了一下。在AndroidAnnotations生成的源文件夹中添加了一个新的property,并在-compile期间将其添加到javacsrc路径中,但仍然没有运气。这是我第一次运行ant脚本,它告诉我找不到任何生成的类,第二次,它告诉我,我有他们所有的重复(仍然给我unclsed files for types...错误信息)。

回答

0

因此,这里可能的解决方案。我需要为javac编译本身添加一些编辑,以及上面的删除和mkdir,以便它会不断重新生成所需的所有文件,而不是由于覆盖权限而自行删除文件。

<target name="-compile" 
     depends="-build-setup, -pre-build, -code-gen, -pre-compile"> 
    <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..."> 
     <!-- merge the project's own classpath and the tested project's classpath --> 
     <path id="project.javac.classpath"> 
      <path refid="project.all.jars.path"/> 
      <path refid="tested.project.classpath"/> 
     </path> 

     <delete dir="${out.aagen}"/> 

     <mkdir dir="${out.aagen}"/> 
     <javac encoding="${java.encoding}" 
       source="${java.source}" 
       target="${java.target}" 
       debug="true" 
       extdirs="" 
       includeantruntime="false" 
       destdir="${out.classes.absolute.dir}" 
       bootclasspathref="project.target.class.path" 
       verbose="${verbose}" 
       classpathref="project.javac.classpath" 
       fork="${need.javac.fork}"> 
      <src path="${source.absolute.dir}"/> 
      <src path="${gen.absolute.dir}"/> 
      <src path="${out.aagen}"/> 
      <compilerarg line="${java.compilerargs}"/> 
      <compilerarg line="-processorpath ${processorpath}"/> 
      <compilerarg line="-processor ${processor}"/> 
      <compilerarg line="-s ${out.aagen}"/> 
     </javac> 
    <!-- a bunch of other crap that is unimportant --> 
</target>