0

I have a simple android app .apk file create with Expo (react native) using the expo build:android script.

I am trying to run this on a device which is locked down by the provider so their is no access to Expo client. The only interface is via ADB.

I have successfully installed the app using the following command:

adb -s <device_id> install <package-name>.apk

I am then trying to start the app via the following:

adb shell am start -n host.exp.myapp

But I get the following error:

Exception: java.lang.IllegalArgumentException: Bad component name: host.exp.myapp

When I run adb shell cmd package list packages, I can see the package:host.exp.myapp listed and I am sure it's following naming conventions with lowercase and no special characters.

How can I start my app via ADB?

Stretch0
  • 6,844
  • 8
  • 59
  • 113
  • https://stackoverflow.com/questions/4567904/how-to-start-an-application-using-android-adb-tools – ADM May 26 '22 at 11:09

1 Answers1

0

If you only know the package name and not the Activity you can use AndroidViewClient/culebra which resolves it.

For example, if you only knows the Chrome package name com.android.chrome you can run

#! /usr/bin/env python3

from com.dtmilano.android.viewclient import ViewClient


device, serialno = ViewClient.connectToDeviceOrExit()
device.startActivity(package='com.android.chrome')

and it is resolved to the main Activity and then started.

If you want to do it from adb without using python you can take a look at the source here.

Diego Torres Milano
  • 61,192
  • 8
  • 106
  • 129