unity对接AndroidSDK

2019/09/25 android

在纯净的eclipse中安装adt插件

ping dl.google.com 获取 ip地址 打开 C:\Windows\System32\drivers\etc\hosts 文件,加上一行:ip地址 dl.google.com
例如 203.208.40.36 dl.google.com

在eclipse的help菜单中选择install new software,点击add,地址为adt -: http://dl.google.com/android/eclipse/,展开节点,全选developer tools。去掉contact all update sites during install to find required software,点击下一步,点击完成即可下载。

Eclipse 配置

Eclipse在创建项目时应该参照jdk目录下的jre路径,有了这个jre之后,有时候会干扰。所以我们指明一下就可以了: 1.进入window——preference——java——installed jres 2.点击add——standard vm——jre home指明到的你的jdk路径

Unity 配置

unity中classes.jar文件路径:点击unity图标右键选择属性->打开文件位置->Data->PlaybackEngines->androidplayer->Variations->mono/il2cpp->release->classes->classes.jar

AndroidManifest.xml 添加启动入口

<activity     
    android:name="com.unity3d.player.UnityPlayerActivity"
    android:screenOrientation="landscape"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
    <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
</activity>

Search

    Table of Contents