这几天抽空研究下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 之一的更多相关文章

  1. Unity中加入Android项目的Build步骤

    转载请注明本文出自大苞米的博客(http://blog.csdn.net/a396901990),谢谢支持! 简介: 有的项目需要在Android中加入Unity功能,例如ANDROID应用中嵌入Un ...

  2. [Unity] Android插件

    1> 编写eclipse android代码. 2> 把unity下class.jar拷入eclipse libs目录下, 工程中右键build path, add to build pa ...

  3. android ant 最简单的打包签名,混淆方法

    使用ant打包,如果脚本都是我们自己一步一步来写的话,是一个比较麻烦的东西. 关于ant,我们详细看下: ant支持 ant debug,ant release等命令,我们需要签名混淆,那么就需要an ...

  4. Android Ant打包笔记

    本文文档的下载地址(Word版):http://download.csdn.net/detail/yangwei19680827/7250711 Android Ant 打包 网上找了ant打包的资料 ...

  5. Android Ant 和 Gradle 打包流程和效率对照

    一.Ant 打包:(下载ant.配置环境变量就不说了) 1.进入命令行模式,并切换到项目文件夹.运行例如以下命令为ADT创建的项目加入ant build支持: android update proje ...

  6. unity android相互调用

    简介 有一些手机功能,Unity没有提供相应的接口,例如震动,例如不锁屏,例如GPS,例如... 有太多的特殊功能Unity都没有提供接口,这时候,我们就需要通过使用Android原生的ADT编辑器去 ...

  7. Unity Android交互过坑指南

    Unity Android交互过坑指南 介于网上看过很多unity和Android交互的教程,都或多或少的漏掉了一些部分,导致编译过程中出现各种问题,特此整理一份教程,仅供参考 介绍 本次实现的是在游 ...

  8. Android Ant 和 Gradle 包装工艺和效率控制

    一个.Ant 包:(下载ant.配置环境变量不说) 1.进入命令行模式,并切换到项目文件夹,运行例如以下命令为ADT创建的项目加入ant build支持: android update project ...

  9. 解决Android Studio Gradle Build Running慢的问题

    Android Studio方便好用,但是Android Studio Gradle Build Running很慢 解决方法: C:\Users\你的用户名\.gradle 目录下新建一个文件名为 ...

随机推荐

  1. 病毒&烦人的幻灯片

    <病毒>传送门 <烦人的幻灯片>传送门 病毒 描述 有一天,小y突然发现自己的计算机感染了一种病毒!还好,小y发现这种病毒很弱,只是会把文档中的所有字母替换成其它字母,但并不改 ...

  2. spring applicationContext.xml 中bean配置

    如果采用set get方法配置bean,bean需要有set get 方法需要有无参构造函数,spring 在生成对象时候会调用get和set方法还有无参构造函数 如果采用constructor方法则 ...

  3. PostgreSQL9.6.3的REDIS测试

    安装redis_fdwcd /usr/local/srcgit clone https://github.com/pg-redis-fdw/redis_fdw.gitcd redis_fdw/git ...

  4. ibatis(sqlmap)中使用in语句的方法

    对于快速学习ibatis而没有过多时间去查阅资料的朋友,比如我,可能有些东西不一定能在快速上手的文档中涉猎到.今天就碰到一个问题,要在分页 查询的同时进行where语句删选操作.由于表记录比较少,因此 ...

  5. JS面试题及答案

    一.JS闭包. f = function() {return true;};    g = function() {return false;};    (function() {       if ...

  6. java异常基本知识

    Throwable     |--Error     |--Exception         |--RuntimeException                异常体系的特点:异常体系中的所有类 ...

  7. python模块之XlsxWriter

    官网Tutorial:http://xlsxwriter.readthedocs.io/tutorial Xlsx是python用来构造xlsx文件的模块,可以向excel2007+中写text,nu ...

  8. Java的位运算符与二进制转换

    转换: Java整型数据类型有:byte.char.short.int.long.要把它们转换成二进制的原码形式,必须明白他们各占几个字节.,一个字节==8位数 数据类型                ...

  9. 【Android】通过经纬度查询城市信息

    public class GetCity { public static String STATIC_URL = "http://api.map.baidu.com/geocoder/v2/ ...

  10. 详细的KVO总结,包括基本改变,使用案例,注意点.看我就够了!

    概述 KVO全称Key-Value-Observing,也叫键值监听,是一种观察者设计模式.提供了一种机制,当指定的对象的属性被修改后,对象就会收到一个通知.也就是说每次指定的被观察的对象的属性被修改 ...