Last active
September 21, 2022 08:56
-
-
Save fadookie/96cafaa4342ec32a43c7 to your computer and use it in GitHub Desktop.
Script to install, run, and open logcat for a Unity Android App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Script to install, run, and open logcat for a Unity Android App. | |
# I needed this as one of my libraries has a critical post-build script so I can't use "Build and Run" anymore - this is the "and Run" part. | |
# Be sure to update these variables to match your app's publishing/build settings: | |
APK_PATH='builds/android/basecode.apk' | |
BUNDLE_ID='com.eliotlash.basecode' | |
alias unilogcat='adb logcat|egrep "Unity"' | |
adb install -r "${APK_PATH}" && adb logcat -c && adb shell am start -n "${BUNDLE_ID}/com.unity3d.player.UnityPlayerNativeActivity" && echo 'DONE, LOG:' && unilogcat |
Thanks for sharing!
This is much easier to launch and works with any version of Unity.
adb shell monkey -p com.company.appname -c android.intent.category.LAUNCHER 1
Works like magic. Thanks 😄
The other approach that would only work for me on a device behaving oddly (Pico2 VR device) & had a custom AndroidManifies.xml that overrides default activity etc. This is the @fadookie example shows but simplified. IDK why the monkey command stopped working on this device but an FYI for others.
.\adb.exe shell am start -n com.company.appname/com.unity3d.player.UnityPlayerNativeActivityPico
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is much easier to launch and works with any version of Unity.