IL2CPP Android: Compilation Error on Unity 5.4.2p4

Hello,

Today I tried to compile my game with IL2CPP option enabled with Unity 5.4.2p4, but it gave the following error. If I test it with an empty project everything is fine.

Was does this mean? Please help.

My project works with mono2. Anyway, some unity dev got any idea on this case? or anyone else?

We have a bug in the current 5.4 patch release where a build failure on Android won’t always show the complete error message. I suspect you are getting tripped up by that here.

It looks like this is a failure during the linker run, which usually means there is an extern static declaration in the C# code in the project which is for a native library on another platform (this happens with the Facebook SDK, for example). But to be sure, you should be able to go back to Unity 5.4.2p1 or earlier, where the compiler errors for Android/IL2CPP are shown correctly.

1 Like

I have tried it again with Unity 5.4.3f1 and got this error message:

I replaced the project name by “XXXXXXX”. Any ideas what does this mean?

No, I’m not sure what the problem is from this information. The bug that obscures the actual error message is still in 5.4.3f1. Can you try 5.4.2p1 or earlier? That might give us more insight into the actual problem.

I tried it now with Unity 5.4.0f3 and got this error message:

Any ideas what does this mean? It seems like a google admob linking error?

This, this output is helpful! The real error message is:

Temp/StagingArea\Il2Cpp\il2cppOutput/Bulk_Assembly-CSharp_4.cpp:16439: error: undefined reference to ‘GADURelease’

This usually indicates that you have an extern static declaration for a native method named GADURelease in the C# script code in the project. The build system cannot find the Android native library which implements this method. With Mono this won’t matter, since these native methods are resolved at run time. IL2CPP is a bit more aggressive though, requiring these methods to exist at link time.

So, should this library exist on Android? If so, make sure that it is selected to build for Android in the Plugin Importer in Unity. If not, you will want to for #if statements in the C# code to remove these extern static declarations on Android.

Thank you for the answer. Where is the Plugin Importer in Unity? Could you explain it please.

You should see the Plugin Importer in the inspector in the Unity editor when you select the native plugin DLL in the project browser.

Thanks. This info helped me. :slight_smile: