Android - Two different programs at the same time in an emulator

Posted by Léa Massiot on Stack Overflow See other posts from Stack Overflow or by Léa Massiot
Published on 2012-06-23T21:07:29Z Indexed on 2012/06/23 21:16 UTC
Read the original article Hit count: 257

Filed under:
|
|

I'm new to Android development. My OS is WinXP.

I'm trying to install two different applications on an Android Device Emulator in command line.

  • I have two Android projects "ap1" and "ap2".

  • In the "ap1" project directory, I ran "ant debug". I got an "ap1.apk" executable.

  • In the "ap2" project directory, I ran "ant debug". I got an "ap2.apk" executable.

  • I created an Android Virtual Device:

    cmd_line> android create avd -n avd1 -t 1 --abi x86

  • I launched the emulator:

    cmd_line> emulator -avd avd1 -verbose

  • The "adb devices" command returns:

    List of devices attached

    emulator-5554 device

  • I installed the first program on the emulator:

    cmd_line> adb -s emulator-5554 install "ap1.apk"

  • I ran the program:

    cmd_line> adb shell am start -a android.intent.action.MAIN -n my.pkg.android/.Activity1

    => It worked.

  • I installed the second program on the emulator:

    cmd_line> adb -s emulator-5554 install "ap2.apk"

  • I ran the program:

    cmd_line> adb shell am start -a android.intent.action.MAIN -n my.pkg2.android/.AnotherActivity1

    => It worked.

All this works except that the second executable "replaced" of the first one.

If I try to run the first executable, I get an error:

cmd_line> adb shell am start -a android.intent.action.MAIN -n my.pkg.android/.Activity1

Starting: Intent { act=android.intent.action.MAIN cmp=my.pkg.android/.Activity1 }

Error type 3

Error: Activity class {my.pkg.android/my.pkg.android.Activity1} does not exist.

It looks like I can't have the two apps at the same time in the emulator.

What do you think?

What do I have to do to have the two apps available (at the same time) in the emulator?

Thank you for helping.

Best regards.

© Stack Overflow or respective owner

Related posts about android

Related posts about command-line