unity打包安卓apk 奇葩错误总结

  1. 1.CommandInvokationFailure: Unable to convert classes into dex format. C:/Program Files (x86)/Java/jdk1.8.0_73\bin\java.exe -Xmx10 -Dcom.android.sdkmanager.toolsdir="D:/android-sdk-windows244\tools" -Dfile.encoding=UTF8 -jar "D:\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" - 

    一般此类错误发生的原因有三种:(1)bin文件夹和libs文件夹中添加了不该添加的jar包; (2)jdk版本问题  是否需要安装最新的jdk来解决
  2. ArgumentException: The Assembly System.Configuration is referenced by System.Data ('Assets/Plugins/Android/System.Data.dll'). But the dll is not allowed to be included or could not be found.

    点击Player Settings按钮,找到Api Compatibility Level选项,选择”.Net 2.0”,而非”.Net 2.0 Subset”
  3. apk包打开后提示 找不到unity的activity 
    解决办法:可能是当前版本的picosdk unity版本不支持  更新 pico版本   此类问题一般出现在 介入picosdk版本太低所致。
  4. Caused by: java.lang.NoSuchMethodError: No direct method <init>(Landroid/content/ContextWrapper;)V in class Lcom/unity3d/player/UnityPlayer; or its super classes (declaration of 'com.unity3d.player.UnityPlayer' appears in /data/app/com.growlib.tread-1/base.apk)
    打包后 执行apk遇到崩溃的情况  卸载重新安装   或者 jar有问题
  5. ArgumentException: The Assembly System.Configuration is referenced by System.Data ('Assets/Plugins/Android/System.Data.dll'). But the dll is not allowed to be included or could not be found.
    In Build Settings > Player Settings > API Compatibility Level, change the .NET setting.Then try to build again and see if the error goes away or changes.

  6. unity打包安卓apk  代码中使用HHTP请求时,有时候会抛出异常
    System.TypeInitializationException: An exception was thrown by the type initializer for System.Net.WebRequest ---> System.Configuration.ConfigurationErrorsException: Error Initializing the configuration system. ---> System.MissingMethodException: Method not found: 'Default constructor not found...ctor() of System.Configuration.ExeConfigurationHost'.
    此问题的解决办法是,此选项选成disabled  或者 link.XML手动排除不能被剥离的部分(剥离写法百度)


    StrippingLevel是用来减少打包出来的player的体积

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值