Looking to create debug symbols in an exported android project (2020.3)

According to the Manual here,

If you enable Export Project in the Android Build Settings, Unity doesn’t build the project or generate symbols when you run the build process. Instead, it exports the project for Android Studio and creates an empty directory at unityLibrary/symbols in the output directory. When you build your exported project from Android Studio, Gradle generates the libil2cpp symbol file and places it within the unityLibrary/symbols// directory.

I have not found it to be true that a symbols directory is created in the unityLibrary directory, nor do I see debug symbols generated when the android project is built.

I’ve tried building the exported android project, but I do not see the generation of debug symbols happening.

My team has been generating the symbols in Unity 2019, so I would like to continue doing so in Unity 2020.

Could anyone offer information or help?

Thank you!

Is your scripting backend set to il2cpp? I can confirm unityLibrary\symbols\armeabi-v7a\libil2cpp.so is being created when gradle build is invoked.

libunity.so symbol in <unity_project>Temp\StagingArea\symbols\armeabi-v7a if Strip Engine Code On.

1 Like

Thank you. That was the issue… how silly of me.

In the correctly set IL2CPP build, I do see the symbols folder and the .so files. It is just the zip folder that is no longer created as of 2020.

it’s because when you export gradle project, il2cpp library is compiled from gradle, thus there’s no point in creating zip package, since it would be missing libil2cpp.so symbols. I understand it’s might be inconvenient for you, since it forces you to manually gather symbols like libunity.so, in 2021.2 unityLibrary/symbols will contain libunity.so/libmain.so when you’ll do Export Project, thus you won’t need to gather them manually.

Good to know!

Thank you again for the information.

hi @Tomas1856 i was able to see libil2cpp.dbg.so, libil2cpp.sym.so, libunity.sym.so.
Exported as Android studio project. However i couldnot see libmain symbol file??
Im using unity 2019.4.8.
And can we upload all these symbols to unity CD programatically via Jenkins CI? and what exactly libil2cpp.dbg.so means?(i believe it is a debug symbol file then what is libil2cpp.sym.so -public symbol? CMIIW ).
Generating these files using EditorUserBuildSettings.androidCreateSymbols api could cause any performance impact on the builds on Android devices???
please pointe me in right direction.
Thanks in advance

2019 is no longer supported, the symbol exporting in 2019 had not been done fully correctly, that’s why some files were missing and extensions are incorrect. You would need to manually rename libil2cpp.sym.so → libil2cpp.so, you can get libmain.so from Unity installation directory in Android folder

1 Like

Thanks for the quick information. Could you please throw some light on below points

  1. Can we upload all these symbols to unity CD programatically via Jenkins CI - Not supported I believe - pls CMIIW
  2. Generating these files using EditorUserBuildSettings.androidCreateSymbols api could cause any performance impact on the builds on Android devices???
  1. Is CD stand for cloud diagnostics? Is it Unity’s Cloud Diagnostics? I think that’s done automatically whenever you produce a build from Unity, meaning the symbols are uploaded automatically to Unity Cloud Diagnostics.
  2. The runtime/performance isn’t affected in any way, no matter what EditorUserBuildSettings.androidCreateSymbols value is set.

Thanks again for the quick response.

  1. Yes il2cpp symbols were uploaded to unity cloud diagnostic(CD) and i could see the stack trace resolved but not for libunity or libmain
  2. Thanks for confirming on the second point

Regarding 1. you could try asking here - https://forum.unity.com/forums/unity-cloud-diagnostics.83/, but I doubt they’ll fix it, since Unity 2019 is no longer supported.

I have one confusion @Tomas1856 . Using Unity 2021.3.14f1. On the Unity Android export, I can see two .so files inside unityLibrary/symbols/. And according to the manual, libil2cpp.so is created by the gradle invocation. Does that mean, I explicitly do not have to copy the libil2cpp.dbg.so ? Also, after building the gradle project I dont see libil2cpp.so anywhere. Can anyone please clear this confusion?

If you’re using Unity 2021.x, then no - you don’t need to copy libil2cpp.dbg.so

Just to be sure, your selected scripting backend is Il2Cpp and not Mono? And you build gradle project from Android Studio ?

Yes I am using Il2Cpp as Scripting Backend. And yes, I am getting the Android export from Unity and building the gradle project using Android Studio. I don’t see the libil2cpp.so anywhere under unityLibrary/symbols/… Not sure if I am missing something here.

I can only see libmain.so and libunity.so

The code piece which copies the il2cpp symbols is in unityLibrary/build.gradle, locate
BuildIl2Cpp task, there are lines like these:

    delete workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.sym.so"
    ant.move(file: workingDir + "/src/main/jniLibs/" + abi + "/libil2cpp.dbg.so", tofile: workingDir + "/symbols/" + abi + "/libil2cpp.so")

Yes so now since in Unity 2021.x libil2cpp.dbg.so does not need to be explicitly copied, the libil2cpp.so should be be at this path correct? → .../unityLibrary/symbols/armeabi-v7a/libil2cpp.so

However, the gradle build does not seem to create it at that location or anywhere else for that matter. What could be the reason behind this?

workingDir + "/src/main/Il2CppOutputProject/IL2CPP/build/deploy/il2cpp",
            "--compile-cpp",
            "--libil2cpp-static",
            "--platform=Android",
            "--architecture=" + architecture,
            "--configuration=" + configuration,
            "--outputpath=" + workingDir + targetDirectory + abi + "/libil2cpp.so",
            "--cachedirectory=" + workingDir + "/build/il2cpp_"+ abi + "_" + configuration + "/il2cpp_cache",
            "--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/external/bdwgc/include",
            "--additional-include-directories=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/libil2cpp/include",
            "--tool-chain-path=" + android.ndkPath,
            "--map-file-parser=" + workingDir + "/src/main/Il2CppOutputProject/IL2CPP/MapFileParser/MapFileParser.exe",
            "--generatedcppdir=" + workingDir + "/src/main/Il2CppOutputProject/Source/il2cppOutput",
            "--baselib-directory=" + workingDir + "/src/main/jniStaticLibs/" + abi,
            "--dotnetprofile=unityaot"

This is the command I am using. Could there be anything missing/wrong here @Tomas1856 ?

Let’s forget about symbol file for a moment, does shared library libil2cpp.so is created in src/main/jniLibs directory? And does your app run fine on the device?

And do you see BuildIl2CppTask being called during gradle build ?

I am upgrading to Unity 2021.3.14f1 from Unity2020. Yes BuildIl2CppTask is correctly called in build.gradle. But ':unityLibrary:BuildIl2CppTask'. failing because the .so file is not found

No I do not see libil2cpp.so inside src/main/jniLibs.

9019171--1243816--Screenshot 2023-05-17 at 7.18.26 PM.png

Can you share the logs, maybe there was a compilation error, because the script first produces libil2cpp.so shared library and only then tries to copy symbols