Unity Android Debug

    For people who never play with Unity android debug before, here are few steps to do it.

    1: Make sure you download the Android Build Support for you Unity version and check Preferences in Unity Edit menu to make sure you have Android SDK and NDK installed. Usually Android SDK and NDK will be installed when you install Android Build Support. If not you can go to download Android Studio and manually copy the path. JDK is also same. 



    2: Go to Build Setting, switch to Android build platform. And check development build if you want.

    3: Now, open the developer option in your phone. You might not see it in your phone setting, because it is hidden by default setting. Some phone you can just tap 7 times on the bar that say the your current phone's system version. You can easily search on Google for how to open developer option for your phone. Once you see the developer option, click USB debugging and allow USB debugging when you connect your phone to the computer. 
    4: Build the apk and install it into your phone. Then you should be able to debug your project.

    5: There is a very good tool for get log from your device, it is call Android Device Monitor. It can be kind tricky to use it. First you go copy the address of Android SDK from the Preferences and open it you will see 4 folder. Go to the tool folder and click monitor.bat. Some people can just open it with this file, but it does not work for me.

You will see the error something like this. "lib\monitor-location not found" Don't worry, we have another solution.

Open lib folder and you will see 2 monitor-x86 folders, open the 64 one. Then open monitor.exe. You might encounter this error, still do not worry, I have a solution.

    Go copy the JDK address from Preferences. Copy the JRE folder and paste it in monitor-x86_64, then it should solve the problem. 
    When you open it successful, you will see the window like this image. 
    If you set up the script in Unity for output log, like Debug.Log, Debug.LogWarning. You can easily crate a new log filter by click the green + button and type Unity in by log Tag. Then it will show the log from your phone. And you can also change what type of log you want to see from the drop down menu on the right.

    Extra Resources: 
    A video tutorial video for Unity Android Debug: https://www.youtube.com/watch?v=eI2GOuEMGfQ
    A tutorial website for Unity Android Debug: https://blogs.siliconorchid.com/post/newbie-coder/unity-intro-for-business-developer/pt4-debugger-logging/




评论

此博客中的热门博文

Designing With Multiple Interactives: Five Common Pitfalls

New Image Patterns

My Research