Unity Android && Ant Automate Build 之一
这几天抽空研究下Android SDK 自动化打包。顺便温习下Unity 与 Android 交互机制。
一、Unity 与 Android 的 消息传递机制
Example:

导出 Android Project
这里为了测试,就填了包名能导出就行了

Eclipse 导入之后 在 最开始启动的Activity 上加上一个被 u3d 代码调用的函数 即可
public void BeCalledFromUnity(String arg)
{
UnityPlayer.UnitySendMessage("SDK", "BeCalledFromAndroid", arg);
}
OK
消息通信搞定了

二、配置 Ant 环境
Step:
Download Ant. Uncompress the downloaded file into a directory.
Set environmental variables JAVA_HOME to your Java environment,
ANT_HOME to the directory you uncompressed Ant to, and add${ANT_HOME}/bin (Unix) or %ANT_HOME%/bin (Windows) to your PATH.
Check Installation:
You can check the basic installation with opening a new shell and typing ant. You should get a message like this
Buildfile: build.xml does not exist!
Build failed
So Ant works. This message is there because you need to write an individual buildfile for your project. With a ant -versionyou should get an output like
Apache Ant(TM) version 1.9.2 compiled on July 8 2013
三、With Android Project
参考:http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html (目前我用的是1.9.4 有一点出入)
If you already have a project that you'd like to add the Ant build script to, then there is an easy command line tool you can use.
Open up a command prompt and navigate to the base directory of your project.
From there, use the command:
android update project --path .
(PS:
Add Path If Fail
%ANDROID_SDK%\platform-tools
%ANDROID_SDK%\tools
)
Here is an example of successful output:

其中ant.properties 是 手工添加的,为了自动化打包签名
Open up a command prompt and navigate to the base directory of your project.
From there, use the command:
-> ant release
=> 打包成功
目前我们已经构建了发布版本的签名APK,下一篇我会讲讲自定义build.xml 流程
Unity Android && Ant Automate Build 之一的更多相关文章
- Unity中加入Android项目的Build步骤
转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 简介: 有的项目需要在Android中加入Unity功能,例如ANDROID应用中嵌入Un ...
- [Unity] Android插件
1> 编写eclipse android代码. 2> 把unity下class.jar拷入eclipse libs目录下, 工程中右键build path, add to build pa ...
- android ant 最简单的打包签名,混淆方法
使用ant打包,如果脚本都是我们自己一步一步来写的话,是一个比较麻烦的东西. 关于ant,我们详细看下: ant支持 ant debug,ant release等命令,我们需要签名混淆,那么就需要an ...
- Android Ant打包笔记
本文文档的下载地址(Word版):http://download.csdn.net/detail/yangwei19680827/7250711 Android Ant 打包 网上找了ant打包的资料 ...
- Android Ant 和 Gradle 打包流程和效率对照
一.Ant 打包:(下载ant.配置环境变量就不说了) 1.进入命令行模式,并切换到项目文件夹.运行例如以下命令为ADT创建的项目加入ant build支持: android update proje ...
- unity android相互调用
简介 有一些手机功能,Unity没有提供相应的接口,例如震动,例如不锁屏,例如GPS,例如... 有太多的特殊功能Unity都没有提供接口,这时候,我们就需要通过使用Android原生的ADT编辑器去 ...
- Unity Android交互过坑指南
Unity Android交互过坑指南 介于网上看过很多unity和Android交互的教程,都或多或少的漏掉了一些部分,导致编译过程中出现各种问题,特此整理一份教程,仅供参考 介绍 本次实现的是在游 ...
- Android Ant 和 Gradle 包装工艺和效率控制
一个.Ant 包:(下载ant.配置环境变量不说) 1.进入命令行模式,并切换到项目文件夹,运行例如以下命令为ADT创建的项目加入ant build支持: android update project ...
- 解决Android Studio Gradle Build Running慢的问题
Android Studio方便好用,但是Android Studio Gradle Build Running很慢 解决方法: C:\Users\你的用户名\.gradle 目录下新建一个文件名为 ...
随机推荐
- Selenium2+python自动化43-判断title(title_is)【转载】
前言 获取页面title的方法可以直接用driver.title获取到,然后也可以把获取到的结果用做断言. 本篇介绍另外一种方法去判断页面title是否与期望结果一种,用到上一篇Selenium2+p ...
- dict的setdefault(学习bottle源代码)
在bottle的源代码中,看到如下一段话: sys.modules.setdefault('bottle', sys.modules['__main__']) 这段话,实际上就是dict类型的setd ...
- rest_frameword框架的基本组件
序列化 序列化:转化数据和校验数据(提交数据时校验数据类型) 开发我们的Web API的第一件事是为我们的Web API提供一种将代码片段实例序列化和反序列化为诸如json之类的表示形式的方式.我们可 ...
- React Native - 0序言
1. 什么是React Native? React Native是Facebook在React.js Conf 2015大会上推出的一个用于开发Android t iOS App的一个框架.主要编程语 ...
- 安装Team Services Agent Win7
现状:项目现时使用的是Team Services,使用Team Services可以控制其中的一台Build Server,从Github提取代码,并在Build Server进入编译打包处理(son ...
- (15)python 数据库连接
python连接mysql两种方法 一.python官网提供的 MySQL-python 软件 下载地址 https://pypi.python.org/pypi/MySQL-python/1.2.5 ...
- notepad++ remove duplicate line
To remove duplicate lines just press Ctrl + F, select the “Replace” tab and in the “Find” field, pla ...
- POJ 2559 Largest Rectangle in a Histogram(单调栈)
[题目链接] http://poj.org/problem?id=2559 [题目大意] 给出一些宽度为1的长方形下段对其后横向排列得到的图形,现在给你他们的高度, 求里面包含的最大长方形的面积 [题 ...
- 【博弈论】【SG函数】【枚举】bzoj1188 [HNOI2007]分裂游戏
因为第i个瓶子里的所有豆子都是等价的,设sg(i)表示第i个瓶子的sg值,可以转移到sg(j)^sg(k)(i<j<n,j<=k<n)的状态. 只需要考虑豆子数是奇数的瓶子啦, ...
- Android 获取 json
Android 获取 json MainActivity.java package com.example.jsontest; import java.io.IOException; import ...
目前我们已经构建了发布版本的签名APK,下一篇我会讲讲自定义build.xml 流程