Search Unity

Simple setting up and running Device Log - Android

Discussion in 'Community Learning & Teaching' started by raiden, May 28, 2015.

  1. raiden

    raiden

    Joined:
    Feb 8, 2009
    Posts:
    333
    Hi all, first I wanna give props to MZ|Alex and NCarter in the IRC chat room for helping me with this.

    Here is a step by step easy way to setup a shortcut and run adb so you can view your device log on your android phone while running your game.

    [Beginners] - If you don't know what the device log is, basically it's similar to Debug.Log in script, except you get unity logged information output to this Terminal window when you build and run your game to your android phone. This is especially handy for debugging purposes, when something is not happening, you might find the reason why in your device log.

    Ok, here's what you need to get this going:
    1. You'll have to know your directory path for a file called "adb". (On Mac) Open Finder and do a search for Eclipse. When you see the main icon for Eclipse, right click on it and select Show Enclosing Folder. This will open up the directory where this app is located.
    2. The folder highlighted will be eclipse, you'll need to select the directory below it, called sdk, and inside that folder, select platform-tools. From here highlight the "adb" file, right click, copy then paste inside the "tools" directory. (You'll know its correct if you select the "tools" directory, and see the file adb above android.
    3. Open up TextEdit and paste the following info in it:
      Make sure you keep the lines separate, just as they are above, and save the file (preferably no spaces in the filename (exe. adbLogCatUnity.txt) to your Desktop.
    4. Now right click on adbLogCatUnity.txt and choose Info, and change the extension .txt to .command, when you close Info, and Finder asks if you want to use .command or .txt, use .command.
    5. Now, lastly you need permission to open a command file (even though in info it says you have read/write, you still won't be able to access it). Open up Terminal from Spotlight Search, and in the window type:
      chmod +x /Desktop/adbLogCatUnity.command
    This will fix the permissions, and all you have to do now is dbl click the file adbLogCatUnity on your desktop, and "Bam" :) adb logcat for unity is running!

    Now go build your games, and view your device logs freely. :)

    -Raiden
     
    theANMATOR2b likes this.
  2. kaplica

    kaplica

    Joined:
    Feb 20, 2014
    Posts:
    87
    Mine is stuck on beginning of /dev/log/system ... any ideas?