How to launch my Android application using adb shell?

Adrian Wreyford picture Adrian Wreyford · Dec 22, 2011 · Viewed 9.1k times · Source

I'm trying to start an Android application using adb shell. I'm not succeeding

The AndoridManifest.XML is pasted below:

<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="4" android:versionName="0.0.5.0" android:installLocation="auto" package="com.supascale.supascale" xmlns:android="http://schemas.android.com/apk/res/android">
<application android:label="@string/app_name" android:icon="@drawable/i_c_o_n_e________1">
    <activity android:theme="@android:style/Theme.Translucent" android:label="@string/app_name" android:name=".wdgen.GWDPSupaScale_Android$WDLanceur">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity> 
    ...

I tried the following call:

adb shell am start -a android.intent.action.MAIN -n com.supascale.supascale/com.supascale.supascale.wdgen.GWDPSupaScale_Android

This does'nt work ... I've tried all sorts of itterations after the ... /

I get Error type 3, the intent class does not exist!

Any help will be greatly appreciated. Regards Adrian

Some of my error messages: enter image description here

Answer

richq picture richq · Dec 23, 2011

You should escape the $ - \$ - since otherwise it gets changed to nothing. $WDLanceor is interpreted as a shell variable by the android shell, and since the variable is not set it becomes an empty string.

Quoting the arguments (adb ... -n "... GWDPSupaScale_Android$WDL‌​a‌​nceur") will only quote it on the Windows side, when it goes into the shell on the android side it'll be without quotes. The backslash will survive the Windows command prompt and be converted to an actual $ on the android shell.