Unity joins the Android project Build step, unityandroid

Source: Internet
Author: User

Unity joins the Android project Build step, unityandroid

Reprinted please indicate this article from the blog of the big glutinous rice (http://blog.csdn.net/a396901990). Thank you for your support!


Introduction:


Some projects need to add the Unity function to Android, such as embedding the Unity3D view (displaying 3D models) in ANDROID applications)

Some projects need to add Android functions to Unity, such as 3D voice Balloon (source code sharing)-create a rotated 3D ball


Because the functions and code in Android can only be used as one Unity plug-in, you need to generate an apk file after the final Build of Unity to run.

Therefore, both of the above situations involve the steps to add the Android project to Unity:



Steps:


1. Make sure that the Android project code is correct and build it in Eclipse so that all classes generate the. class file.


2. Pack all. class files into jar packages.

For example, my current project directory is: C: \ Users \ 95 \ Documents \ GitHub \ 3D_Sphere \ 3 DVoiceWeather. The compiled. class files are all in \ bin \ classes under the project directory.

Open cd in cmd to this directory:Cd C: \ Users \ 95 \ Documents ents \ GitHub \ 3D_Sphere \ 3DVoiceWeather \ bin \ classes

Run the following command:Jar-cvf class. jar *

A class. jar file is generated in the current directory, for example:



3. Add the Android project to Unity

Create a Plugins folder in Unity and create an Android folder under Plugins (the folder cannot be written incorrectly or modified ).

Copy the res folder, libs folder (if any), and AndroidManifest. xml files in the Android project to Plugins-Android:

InPlugins-AndroidCreate a bin folder and copy the previously generated class. jar file (the name is random ).



4. Set the Build parameters.

1. Click the menu

2. file

3. Build Settings

4. Select Android and click add current to add the current scenario.


5. Click Player Settings:

Set the Build parameters, including the company name, product name, and icon. This is all written casually,

***Mainly in the red boxBundle Identifier *The value must be consistent with the package name of the Android project.***



5. Bulid

After setting the parameters, you can click the Build button to perform the final Build operation.

If this is the first time, you will be asked to set up the Android SDK during the Build process. Don't worry, just find the SDK directory to select.

Wait for completion...


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.