AI开发实战1-App Inventor的编译

1 App Inventor的编译

编译AppInventor需要使用ant,在项目的GitHub上https://github.com/mit-cml/appinventor-sources有如下说明:

Youwill need a full Java JDK (6 or 7, preferably from Oracle; JRE is not enough)and Python to compile and run the servers.

需要在电脑上安装JDK6或7,才能正常编译。

   但ant的不同版本需要的JDK不同,像1.10.1版本就需要JDK8,否则编译的时候,会报如下错误:

   Exception in thread "main"java.lang.UnsupportedClassVersionError: org/apache/tools/ant/launch/Launcher :Unsupported major.minor version 52.0  

    编译的时候,直接输入ant命令,会编译所有源码,花费时间较长,在本人电脑上是6分钟多。实际往往不需要编译全部代码,只编译改动的模块就可以了。

    在源码的appinventor文件夹下有个build.xml文件,在其中有许多target标签:

<target name="all">

   <ant inheritAll="false" useNativeBasedir="true"dir="appengine"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="blocklyeditor"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="common"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="buildserver"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="components"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="buildserver" target="PlayApp"/>

 </target>

 

  …

 <target name="MakeAuthKey">

   …

 

 <target name="comps">

  …

 <target name="extensions">

<target name="clean">

   <ant inheritAll="false" useNativeBasedir="true"dir="appengine" target="clean"/>

    <ant inheritAll="false"useNativeBasedir="true" dir="blocklyeditor"target="clean"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="aimerger" target="clean"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="buildserver" target="clean"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="common" target="clean"/>

   <ant inheritAll="false" useNativeBasedir="true"dir="components" target="clean"/>

   <delete dir="build"/>

   <delete dir="reports"/>

 </target>

 

每个target标签中间说明了使用ant + target name时,编译的模块,如输入如下命令:

ant all——编译所有模块,等同于只输入ant

antextensions——编译插件

antMakeAuthKey——编译AuthKey

 

还有个特殊的编译命令:

antclean——删除之前编译生成的build和reports文件夹。

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值