- Android symbols
- Public symbols
- Debugging symbols
- Generating a symbols package
- Using symbols in the Google Play console
- Attaching MonoDevelop Debugger To An Android Device
- Android environment setup
- 1. Install Android Build Support and the Android SDK & NDK tools
- 2. Enable USB debugging on your device
- ADB debugging for Chrome OS devices
- Connecting to your Chrome OS device
- Customizing the Android SDK & NDK Tools and OpenJDK installation
- Change the OpenJDK path
- Change the Android SDK Tools path
- Change the Android NDK path
- Updating the Android SDK Target API
Android symbols
To help you debug your application, Unity can generate a package that contains symbol files for native Unity libraries. Symbol files contain a table that translates active memory addresses into information you can use, like a method name. The translation process is called symbolication. You can upload a symbols package to the Google Play Console to see a human-readable stack trace on the Android Vitals dashboard.
There are two types of symbol files:
- Public: A small file that contains a symbol table. For more information, see Public symbols.
- Debug: Contains everything that a public symbol file contains, and full debugging information that you can use for more in-depth debugging. For more information, see Debugging symbols.
You can generate symbol files for the following libraries:
- libmain : Responsible for initial Unity engine loading logic.
- libunity : Unity’s engine code.
- libil2cpp : Contains C# scripts A piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary from the project converted to C++ code.
Unity generates the libmain and libunity symbol files. Gradle An Android build system that automates several build processes. This automation means that many common build errors are less likely to occur. More info
See in Glossary generates the libil2cpp symbol file.
Public symbols
A public symbol file contains information that resolves function addresses to human-readable strings. Unity uses the —strip-debug parameter to create public symbols that remove more in-depth debug information. This makes public symbol files and packages smaller than debugging symbol files and packages.
Debugging symbols
A debugging symbol file contains full debugging information and a symbol table. Use it to:
- Resolve stack traces and to debug applications that you have source code available for.
- Attach a native debugger to the application and debug the code.
Unity uses the —only-keep-debug parameter to create debugging symbols. For more information, see –only-keep-debug in the Linux user manual.
Note: If debugging symbols aren’t available, Unity places a public symbol file in your project at build time. For the libmain and libunity libraries, debugging symbols are not available and Unity always generates public symbol files.
Generating a symbols package
There are two ways to enable symbols package generation for your application:
- In the Build Settings window:
- Open the Build Settings window (menu: File >Build Settings).
- Select the Android platform.
- Set Create symbols.zip to one of the following:
- Public
- Debugging
- Use the EditorUserBuildSettings.androidCreateSymbols API.
After you enable symbols package generation, building your project generates a .zip file that contains symbol files for the libmain and libunity library. If you set your scripting backend A framework that powers scripting in Unity. Unity supports three different scripting backends depending on target platform: Mono, .NET and IL2CPP. Universal Windows Platform, however, supports only two: .NET and IL2CPP. More info
See in Glossary to IL2CPP A Unity-developed scripting back-end which you can use as an alternative to Mono when building projects for some platforms. More info
See in Glossary , the .zip also contains a symbol file for the libil2cpp library. Unity places this symbols package within the output directory.
If you enable Export Project in the Android Build Settings, Unity doesn’t build the project. Instead, it exports the project for Android Studio, generates symbols for libmain and libunity , and places them within 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 alongside the libmain and libunity symbol file.
Using symbols in the Google Play console
After you upload your application to Google Play, you can upload a public symbols package for it. For information on how to do this, see Google’s documentation: Deobfuscate or symbolicate crash stack traces.
Note: Google Play doesn’t symbolicate crashes that your application received before you uploaded the symbols package.
Источник
Attaching MonoDevelop Debugger To An Android Device
You can attach the MonoDevelop debugger to an Android device with ADB via TCP/IP. The process is described below.
Enable “USB debugging” on your device and connect the device to your development machine via USB cable. Ensure your device is on the same subnet mask and gateway as your development machine. Also, make sure there are no other active network connections on the device, i.e. disable data access over mobile/cellular network.
On your development machine, open up your terminal/cmd and navigate to the location of the ADB. You can find the ADB tool in /platform-tools/
Restart host ADB in TCP/IP mode with the following command:
This will have enabled ADB over TCP/IP using port 5555. If port 5555 is unavailable, you should use a different port (see ADB.) The following output should be produced:
- Find out the IP address of your Android device (Settings ->About ->Status) and input the following command:
DEVICEIPADDRESS is the actual IP address of your Android device. This should produce the following output:
- Ensure that your device is recognised by inputting the following command:
This should produce the following output:
Build and run your Unity application to the device. Ensure you build your application with Development Build flag enabled and Script Debugging turned on.
Disconnect the USB cable as the device no longer needs to be connected to your development machine.
Finally, while the application is running on your device, open your script in MonoDevelop, add a breakpoint, select “Run” -> “Attach to Process” and select your device from the list. (It might take a few seconds for the device to appear in the list. It may not appear in the list if the application is not running or if the device’s display goes to sleep).
For some more details and for troubleshooting, see the Wireless Usage section in the Android developers guide for the ADB.
Note: The device sends multicast messages and the editor and MonoDevelop subscribe/listen for them. For the process to work, your network will need to be setup correctly for Multicasting.
Is something described here not working as you expect it to? It might be a Known Issue. Please check with the Issue Tracker at issuetracker.unity3d.com.
Copyright © 2017 Unity Technologies. Publication: 5.6-001N. Built: 2017-07-12.
Источник
Android environment setup
To build and run for Android, you must install the Unity Android Build Support platform module. You also need to install the Android Software Development Kit (SDK) and the Native Development Kit (NDK) to build and run any code on your Android device. By default, Unity installs a Java Development Kit based on OpenJDK.
Note: Unity supports Android 4.4 “KitKat” and above. See AndroidSdkVersions for details.
1. Install Android Build Support and the Android SDK & NDK tools
Use the Unity Hub to install Android Build Support and the required dependencies
See in Glossary : Android SDK & NDK tools, and OpenJDK.
Add Android modules
You can install Android Build Support, the Android SDK & NDK tools and OpenJDK when you install the Unity Editor, or add them at a later time.
For information on adding the Android modules:
If you are using a 2018 version of Unity, see the Unity 2018.4 documentation for information on manually installing these dependencies.
2. Enable USB debugging on your device
To enable USB debugging, you must enable Developer options on your device. To do this, find the build number in your device’s Settings menu. The location of the build number varies between devices; for stock Android, it’s usually Settings > About phone > Build number. For specific information on your device and Android version, refer to your hardware manufacturer.
After you navigate to the build number using the instructions above, tap on the build number seven times. A pop-up notification saying “You are now X steps away from being a developer” appears, with “X” being a number that counts down with every additional tap. On the seventh tap, Developer options are unlocked.
Note: On Android versions prior to 4.2 (Jelly Bean), the Developer options are enabled by default.
Go to Settings > Developer options (or, if this does not work, on some devices the path is Settings > System > Developer options), and check the USB debugging checkbox. Android now enters debug mode when it is connected to a computer via USB.
Connect your device to your computer using a USB cable. If you are developing on a Windows computer, you might need to install a device-specific USB driver. See the manufacturer website for your device for additional information.
The setup process differs for Windows and macOS and is explained in detail on the Android developer website. For more information on connecting your Android device to the SDK, refer to the Run Your App section of the Android Developer documentation.
ADB debugging for Chrome OS devices
For information on how to set up your development environment for Chrome OS devices, and enable ADB An Android Debug Bridge (ADB). You can use an ADB to deploy an Android package (APK) manually after building. More info
See in Glossary debugging, see Google’s documentation on Chrome OS Developer Environments.
Connecting to your Chrome OS device
Before you can deploy to your device you need to manually connect with ADB via the device’s IP address.
To begin you need the IP address. Open up the Settings app and choose Network in the sidebar. Next click on the active network interface.
If the interface is wireless then next choose the SSID that you are connected to. In the details you will see your IP address. Make a note of it.
If you are using a wired connection your IP address will be shown on the first details page.
Now we are ready to connect. For the sake of this example let’s say that the device’s IP is 192.168.0.100. In a shell or terminal run the following command
adb connect 192.168.0.100
If the connection was successful you will see a message such as connected to 192.168.0.65:5555 . And adb devices should verify that the device is connected. List of devices attached 192.168.0.65:5555 device
From now on you may run ADB commands to target the device just as you would over a USB connection.
Note: If your device or host machine goes to sleep or loses network connectivity you may need to reconnect.
Customizing the Android SDK & NDK Tools and OpenJDK installation
Unity recommends that you use the Unity Hub to install Android SDK & NDK tools, to ensure that you receive the correct versions and configuration. Unity installs Android SDK & NDK Tools and OpenJDK respectively in the SDK, NDK and OpenJDK folders under /Unity/Hub/Editor/[EditorVersion]/Editor/Data/PlaybackEngines/AndroidPlayer/.
If you have multiple versions of Unity with the same required dependencies (be sure to check System requirements for the latest) and you want to avoid duplicating the installation of Android SDK & NDK Tools and OpenJDK, you can specify a shared location in the Unity Preferences window. To do this, go to Preferences > External tools and enter the directory paths in the SDK and NDK fields:
Preferences window showing external tools settings for Android
Warning: Unity does not officially support versions of the OpenJDK, SDK, or NDK other than the ones it supplies.
To change the OpenJDK, SDK Tools, or NDK that Unity uses to build Android apps:
- Open the Project.
- Open the Preferences window (Windows and Linux: Edit >Preferences; macOS: Unity >Preferences).
- In the left navigation column, select External Tools.
Change the OpenJDK path
- Uncheck JDK Installed with Unity (recommended).
- In the JDK field, enter the path to the JDK installation folder, or use the Browse button to locate it.
Change the Android SDK Tools path
- Uncheck Android SDK Tools Installed with Unity (recommended).
- In the SDK field, enter the path to the SDK installation folder, or use the Browse button to locate it.
Unity works with the most recent version of the Android SDK available at the time of the Unity version release.
Change the Android NDK path
- Uncheck Android NDK Installed with Unity (recommended).
- In the NDK field, enter the path to the NDK installation folder, or use the Browse button to locate it.
Each version of Unity requires a specific version of the Android NDK to be installed:
Unity version | NDK version |
---|---|
2018.4 LTS | r16b |
2019.4 LTS | r19 |
2020.3 LTS | r19 |
See the System requirements page for a complete list of requirements.
Updating the Android SDK Target API
Unity Hub installs the latest version of the Android SDK Target API required by Google Play.
If you need to use a more recent version, you can change the Target API from the Target API Level field in the Player Settings window (menu: Edit > Project Settings > Player, then select the Android platform). You can find the Target API Level option in the Other Settings > Identification section.
Selecting a target API for the Android SDK
After you select an option other than the default, Unity prompts you to update the Android SDK API. You can choose to either:
- Update the Android SDK
- Continue to use the highest installed version of the Android SDK
Note: If you select an older version of the Target API, the Unity Android SDK Updater will not be able to perform the update and will give you this message:
Android SDK does not include your Target SDK of (version). Please use the Android SDK Manager to install your target SDK version. Restart Unity after SDK installation for the changes to take effect.
In this case, to update the Android SDK Target API, you must use the Android sdkmanager from either Android Studio or the command line tool. Regardless of the method you chose, make sure to select the correct Android SDK folder for Unity in the Edit > Preferences > External Tools window.
On Windows, if the Unity Editor is installed in the default folder ( /Program Files/ ), you must run the sdkmanager with elevated privilege (Run as Administrator) to perform the update.
Источник