Unity打包安卓添加依赖工程

时间:2024-04-08 21:56:38

Unity打包安卓添加依赖工程

项目打包安卓有时候会添加渠道的依赖工程,下面是解决该问题的一种方法。

1.项目导出安卓工程

Unity打包安卓添加依赖工程

导出结果:

Unity打包安卓添加依赖工程

2.将导出的安卓工程以及依赖工程导入Eclipse(注意这两个工程目录不要出现中文)

Unity打包安卓添加依赖工程

Unity打包安卓添加依赖工程

Unity打包安卓添加依赖工程

Unity打包安卓添加依赖工程

3.添加依赖

右键项目工程,BuildPath选择Configure BuildPath 如图

Unity打包安卓添加依赖工程

添加依赖之后有可能会报以下类似错误:

[2017-05-17 18:17:11 - MultiChannelActivity] Found 2 versions of android-support-v4.jar in the dependency list,
[2017-05-17 18:17:11 - MultiChannelActivity] but not all the versions are identical (check is based on SHA-1 only at this time).
[2017-05-17 18:17:11 - MultiChannelActivity] All versions of the libraries must be the same at this time.
[2017-05-17 18:17:11 - MultiChannelActivity] Versions found are:
[2017-05-17 18:17:11 - MultiChannelActivity] Path: E:\export\DQ_SdkLib\DQ_SdkLib\libs\android-support-v4.jar
[2017-05-17 18:17:11 - MultiChannelActivity] Length: 621451
[2017-05-17 18:17:11 - MultiChannelActivity] SHA-1: 5896b0a4e377ac4242eb2bc785220c1c4fc052f4
[2017-05-17 18:17:11 - MultiChannelActivity] Path: E:\export\xingyunjue\xingyunjue\libs\android-support-v4.jar
[2017-05-17 18:17:11 - MultiChannelActivity] Length: 1364299
[2017-05-17 18:17:11 - MultiChannelActivity] SHA-1: b6c138ba72ce38beda559df33d369856854fd6f5
[2017-05-17 18:17:11 - MultiChannelActivity] Jar mismatch! Fix your dependencies

问题为 android-support-v4.jar包重复,随便删一个

Unity打包安卓添加依赖工程

4.Debug,连接手机并打开USB调试,右击安卓工程,Debug As Android Application

有可能回报 AndroidMenifest 设置”debugable = false”的错误导致无法Debug,把AndroidMenifest里 debugable = false删掉再Debug即可

5.打包,右击安卓工程,AndroidTools Export Signed Application Package(带签名) or Export Unsigned Application Package(不带签名)