adb "am start -n" not working for debug version - android

I am trying to use adb to launch activites for testing,But it does not work for the debug version :
This works
adb shell am start -n com.xx.xx/.main.ParentActivity
This doesn't
adb shell am start -n com.xx.xx.debug/.main.ParentActivity
Both debug and release packages are available under /data/data

If you have class com.xx.xx.main.ParentActivity and your application id is com.xx.xx.debug then you have to specify FQCN like this:
adb shell am start -n com.xx.xx.debug/com.xx.xx.main.ParentActivity
Dot just after slash is shortcut which can be used only if FQCN starts with application id.

use adb shell am start -D -n com.xx.xx.debug/.main.ParentActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
then you will be able to attach your debugger (via your IDE) and the app will start (see https://blog.jetbrains.com/idea/2011/05/new-in-105-attach-debugger-to-a-running-android-process/)

Related

Can I use adb to call the "package installer" to install the application? adb install is not allowed

I tried to use the following code, but reported to me "shell does not declare android.permission.REQUEST_INSTALL_PACKAGES"
adb shell am start -a android.intent.action.VIEW -t "application/vnd.android.package-archive" -d "file:///sdcard/Download/a.apk"
I am sad that for some reasons, adb install is not allowed, even if I run the following command, I still cannot install the application
adb shell settings put global verifier_verify_adb_installs 0
adb shell settings put global package_verifier_enable 0
logļ¼šFailure [INSTALL_FAILED_VERIFICATION_FAILURE: adb install not allowed!]

ADB to Launch android browser with given url

I am trying to send a commend via ADB to launch different browsers with a given URL.
I only know the package names of the browsers so I used:
adb shell monkey -p com.android.chrome -c android.intent.category.LAUNCHER 1
This way I could open the app with only the package name, but I couldn't pass any URL to it.
I could pass a URL to chrome using:
adb shell am start -a android.intent.action.VIEW -d https://www.bbc.com/
but this requires more then just package name.
Trying to combine these two didn't work:
adb shell monkey -p com.android.chrome -c android.intent.category.LAUNCHER 1 -d https://www.yahoo.com
What is the correct way to pass a URL to a browser using only the package name with monkey?
Thank you all!
adb shell am start -a android.intent.action.VIEW -d http://www.facebook.com

Open Chrome with ADB

I used to able to launch Chrome using ADB like this:
adb shell am start -n com.android.chrome/com.android.chrome.Main
But now when I try it, I get:
Starting: Intent { cmp=com.android.chrome/.Main }
Error type 3
Error: Activity class {com.android.chrome/com.android.chrome.Main} does not exist.
It seems that the Main Class name has changed. If so, what's the new one?
Adb command for this
adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
To open the default page of Chrome with ADB you can use:
adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main
Instead, to open an url directly you can use:
adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d "www.facebook.com"
adb shell
webview with default browser:
am start -a android.intent.action.VIEW -d https://www.google.com/
Firefox:
monkey -p org.mozilla.tv.firefox -c android.intent.category.LAUNCHER 1
Chromium:
monkey -p org.chromium.chrome -c android.intent.category.LAUNCHER 1

Supress output from android activity running from adb shell

Android activity is launched from adb shell by the command am start -n packagename/.activityname
When the activity is started it is displaying the status stating the android activity ... in the adb shell
How to supress that output into adb shell
Use linux- redirect the output to /dev/null.
am start -n packagename/.activityname > /dev/null

Android: launch app info dialog via adb shell am

I'm trying to write a script which will launch the "app info" system dialog via adb for an app I'm testing.
I have done some investigation and came up with this command, which will launch "app info" but fails with a force close (NullPointerException in logcat):
adb shell am start -a android.intent.action.VIEW -n com.android.settings/.applications.InstalledAppDetails -es com.android.settings.ApplicationPkgName com.my.app -es pkg com.my.app
Seems that the package name isn't being properly passed.
What is the correct way to pass the package name parameter to the am command in this case?
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS -d package:<package-name>
Also, check this: https://stackoverflow.com/a/4567928/4409113
adb shell am start -n com.package.name/com.package.name.ActivityName
http://developer.android.com/tools/help/shell.html#am
You can also issue an activity manager command directly from adb
without entering a remote shell.
For example:
adb shell am start -a android.intent.action.VIEW
Seems like, start -a is a good way.

Categories

Resources