4

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

Adrian Wreyford
  • 658
  • 3
  • 10
  • 20
  • 1
    Maybe you already tried it but the complete name of your activity is `GWDPSupaScale_Android$WDLanceur` so try with `adb ... -n com.supascale.supascale/com.supascale.supascale.wdgen.GWDPSupaScale_Android$WDLanceur` – Dalmas Dec 22 '11 at 18:06
  • Check out http://stackoverflow.com/questions/4567904/how-to-start-an-application-using-android-adb-tools – Chris Thompson Dec 22 '11 at 18:18
  • I have tried, but it appears to drop the $WDLanceur part in the error message ... so ? not seeing it? – Adrian Wreyford Dec 22 '11 at 18:38
  • 1
    Did you install your app before? with `adb shell pm install ...` – Dalmas Dec 22 '11 at 19:25
  • It is already installed on the android device, that is coupled to PC over USB. The application can be launched manually on the Galaxy S II – Adrian Wreyford Dec 22 '11 at 19:56
  • I've added an image with my last few tries. Even tried using -c switch, and the LAUNCHER intent, no luck yet. – Adrian Wreyford Dec 22 '11 at 20:04
  • 1
    How do you declare your class in your code? I think you need to find a way to remove this `$` from your class name. Or you may also try with quotes : `adb ... -n "com.supascale.supascale/com.supascale.supascale.wdgen.GWDPSupaScale_Android$WDLa‌​nceur"` – Dalmas Dec 22 '11 at 20:08
  • 2
    Or escape the $ - \$ - since otherwise it gets changed to nothing. $WDLanceor is interpreted as a shell variable by the android shell. Quoting it 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 should survive. – richq Dec 22 '11 at 21:06
  • Quoting did not work, but that was putting us in the right directing. Escaping the $ with \$ however did the trick. The application is up and running from cmd prompt. – Adrian Wreyford Dec 23 '11 at 07:25
  • @Adrian I've added my comment as an answer so this doesn't show up unanswered on the list of Qs. – richq Dec 23 '11 at 07:47

1 Answers1

2

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.

richq
  • 55,548
  • 20
  • 150
  • 144