One of the Unity Android && Ant automate Build

Source: Internet
Author: User

These days are time to study under Android SDK Automation packaging. By the way, brush up on unity and Android interaction mechanism.

One, Unity and Android message delivery mechanism

Example:

  

Export Android Project

In order to test, we have to fill in the package name can be exported on the line

  

After Eclipse import, add a function called by u3d code to the activity that starts at the beginning.

  

1      Public void becalledfromunity (String Arg) 2     {3         unityplayer.unitysendmessage ("SDK " " becalledfromandroid " , ARG); 4     }

  

Ok

Message communication's done.

  

  

Second, configure the ANT environment

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 your need to write a 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

Third, with Android Project

Reference: Http://www.androidengineer.com/2010/06/using-ant-to-automate-building-android.html (at the moment I'm using a bit of 1.9.4)

  

If you already has a project that you're d like to add the Ant build script to and then there are a easy command line tool for 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 are an example of successful output:

Where ant.properties is manually added, in order to automate the packaging of signatures

   

Open up a command prompt and navigate to the base directory of your project.
From there, use the command:
Ant Release

= Packaging Success  





Currently we have built a release version of the signature apk, next I'll talk about customizing the build.xml process

One of the Unity Android && Ant automate Build

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.