Search code examples
androidadb

I am trying to launch Settings through adb using the adb monkey command, but it keeps printing out "Killed". How can I find out what is causing this?


I am using adb shell monkey -p app.package.name -c android.intent.category.LAUNCHER 1 to try to launch the settings app so that I can turn on MTP and connect this android device to my computer, but I keep getting killed every time I enter the command in the adb shell.

How can I find out why this is happening? I have tried restarting adb, getting su privelages, and rebooting the device, but nothing changes.

Thanks in advance!

EDIT: The actual command is adb shell monkey -p com.android.settings -c android.intent.category.LAUNCHER 1

EDIT 2: Probably already known, but this happens for any package name, not just settings. Not sure if that is relevant or not :/


Solution

  • adb shell am start -a android.settings.SETTINGS
    

    To bring up developer settings (in Gingerbread at least):

    adb shell am start -a com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS
    

    Here is a bash script to demonstrate more settings - on my Nexus One, it crashes and reboots a few times...

    
    #!/bin/bash
    
    # This FC's android
    
    #      android.settings.WIMAX_SETTINGS:
    
    # list of commands were commied from output of this:
    # adb shell dumpsys | grep "SETTINGS"
    # quick hask that seemed to work, but prob. not correct.
    
    while read L; do
      [[ -z "$L" ]] && continue
      printf "\nTry [%s]\n" "$L"
      adb shell am start -a ${L:: -1}  # remove trailing colon
      sleep 5
      printf "NOTE: Watch screen... Settings may FC and after a few seconds android will reboot\n"
      adb wait-for-device
    done <<EOF
          android.settings.DATE_SETTINGS:
          com.android.settings.APPLICATION_DEVELOPMENT_SETTINGS:
          android.settings.LOCATION_SOURCE_SETTINGS:
          android.settings.MEMORY_CARD_SETTINGS:
          android.settings.LOCALE_SETTINGS:
          android.search.action.SEARCH_SETTINGS:
          android.net.vpn.SETTINGS:
          ACCESSIBILITY_FEEDBACK_SETTINGS:
          android.settings.ACCOUNT_SYNC_SETTINGS:
          com.android.settings.DISPLAY_SETTINGS:
          android.settings.INPUT_METHOD_SETTINGS:
          android.settings.SOUND_SETTINGS:
          android.settings.WIFI_SETTINGS:
          android.settings.APPLICATION_SETTINGS:
          com.android.settings.SOUND_SETTINGS:
          android.settings.ACCOUNT_SYNC_SETTINGS_ADD_ACCOUNT:
          android.settings.MANAGE_APPLICATIONS_SETTINGS:
          android.settings.SYNC_SETTINGS:
          android.settings.SETTINGS:
          com.android.settings.DOCK_SETTINGS:
          android.settings.ADD_ACCOUNT_SETTINGS:
          android.settings.SECURITY_SETTINGS:
          android.settings.DEVICE_INFO_SETTINGS:
          android.settings.WIRELESS_SETTINGS:
          android.settings.DISPLAY_SETTINGS:
          android.settings.SYSTEM_UPDATE_SETTINGS:
          android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS:
          android.settings.DATA_ROAMING_SETTINGS:
          android.settings.APN_SETTINGS:
          android.settings.USER_DICTIONARY_SETTINGS:
          com.android.settings.VOICE_INPUT_OUTPUT_SETTINGS:
          com.android.settings.TTS_SETTINGS:
          android.settings.WIFI_IP_SETTINGS:
          android.search.action.WEB_SEARCH_SETTINGS:
          android.settings.BLUETOOTH_SETTINGS:
          android.settings.AIRPLANE_MODE_SETTINGS:
          android.settings.INTERNAL_STORAGE_SETTINGS:
          android.settings.ACCESSIBILITY_SETTINGS:
          com.android.settings.QUICK_LAUNCH_SETTINGS:
          android.settings.PRIVACY_SETTINGS:
    EOF