Unity 2017.4.34f1无法使用IL2CPP构建APK [英] Unity 2017.4.34f1 Cant build APK using IL2CPP

查看:1974
本文介绍了Unity 2017.4.34f1无法使用IL2CPP构建APK的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用 Unity 2017.4.34f1 构建项目,因为Google现在需要32& 64位,所以我选择 IL2CPP .

I try to build my project using Unity 2017.4.34f1, because Google now need both 32 & 64 bit, so i choose IL2CPP.

对于Android NDK,我使用 r13b

For Android NDK, I use r13b

但是,构建失败,并且出现以下错误(摘要):

However, build failed and I get below error (summary) :

例外:/Applications/Unity/Hub/Editor/2017.4.34f1/Unity.app/Contents/il2cpp/build/il2cpp.exe无法正常运行!

Exception: /Applications/Unity/Hub/Editor/2017.4.34f1/Unity.app/Contents/il2cpp/build/il2cpp.exe did not run properly!

推荐答案

发生此错误是因为项目中的代码在C#中具有extern方法.使用IL2CPP脚本后端构建时,用[Dllimport("__Internal")]属性标记为extern的方法必须存在于与Unity Player链接的本机库中.

This failure occurs because the code in the project has extern methods in C#. Methods marked as extern with a the [Dllimport("__Internal")] attribute must be present in a native library that is linked with the Unity player when building with the IL2CPP scripting backend.

例如,在此项目中,导致此问题的一个函数被命名为:activateApp

For example, this in this project one function which causes this issue is named: activateApp

您有两个选择:

  1. 使用播放器的目标平台和体系结构的[Dllimport("__ Internal")]属性将所有方法标记为extern,以构建本机库.请参阅此文档以获取有关本机插件的详细信息: https://docs.unity3d.com/Manual/NativePlugins .html

删除定义此extern方法的C#代码.您可以通过平台相关的编译来做到这一点: https://docs.unity3d.com/Manual/PlatformDependentCompilation .html

Remove the C# code which defines this extern method. You can do that with platform dependent compilation: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

在这种情况下,似乎错误来自Facebook SDK.看看是否有可用的更新的Facebook SDK-我相信这可能已得到纠正.

In this case specifically, it looks like the error comes from the Facebook SDK. See if there is a newer Facebook SDK available - I believe this may have been corrected.

这篇关于Unity 2017.4.34f1无法使用IL2CPP构建APK的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆