Android的ADB壳AM广播:错误的组件名称 [英] Android adb shell am broadcast: Bad component name
问题描述
我想'的emulate重启(或其他任何与亚行外壳(上午)
),但无法弄清楚如何引用我的组件。再说,也许我甚至不明白什么是由组件的意思。下面我首先包括不工作,那么我的表现了几个例子命令。需要注意的是Startu preceiver成功调用的时候,手机的靴子。我只是想重新触发它没有一个完整的重新启动。
失败亚行的命令:
$ ./adb壳AM广播-a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android.Startu preceiver
<帮助剪断>
错误:错误的组件名称:net.fstab.checkit_android.Startu preceiver
$ ./adb壳AM广播-a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n .Startu preceiver
<帮助剪断>
错误:错误的组件名称:.Startu preceiver
$ ./adb壳AM广播-a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n Startu preceiver
<帮助剪断>
错误:错误的组件名称:Startu preceiver
清单:
< XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=net.fstab.checkit_android机器人:INSTALLLOCATION =internalOnly
安卓版code =1机器人:VERSIONNAME =1.0>
<应用机器人:图标=@可绘制/图标
机器人:标签=@字符串/ APP_NAME>
<活动机器人:BaseActivity名称=机器人:标签=@字符串/ APP_NAME>
<意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<类机器人:名称=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
<活动机器人:名称=基地preferences/>
<活动机器人:名称=EditActivity/>
<接收器的Android版本:NAME =Startu preceiver>
<意向滤光器>
<作用机器人:名称=android.intent.action.BOOT_COMPLETED/>
<类机器人:名称=android.intent.category.HOME/>
&所述; /意图滤光器>
< /接收器>
<接收器的Android版本:NAME =NotificationReceiver>
<意向滤光器>
<作用机器人:名称=net.fstab.checkit_android.NotificationReceiver/>
&所述; /意图滤光器>
< /接收器>
<服务机器人:名称=StartupService>
<意向滤光器>
<作用机器人:名称=net.fstab.checkit_android.StartupService/>
&所述; /意图滤光器>
< /服务>
< /用途>
<使用-SDK安卓的minSdkVersion =8/>
<使用-权限的Android:名称=android.permission.RECEIVE_BOOT_COMPLETED/>
< /舱单>
您需要的类名(那么你可以把它写不包),这样之前指定的包名称:
./亚行壳AM广播-a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android / .Startu preceiver
实际上事实证明,你只需要包名后添加一个斜杠。
您帮我开始,我帮你完成:)
I am trying to 'emulate' a reboot (or anything else with the adb shell am
) and am unable to figure out how to reference my component. Then again, maybe I don't even understand what is meant by a component. Below I first include a few example commands that don't work, then my manifest. Note that StartupReceiver is successfully called when the 'phone' boots. I just want to re-trigger it without a full reboot.
Failed ADB commands:
$ ./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android.StartupReceiver
<help snipped>
Error: Bad component name: net.fstab.checkit_android.StartupReceiver
$ ./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n .StartupReceiver
<help snipped>
Error: Bad component name: .StartupReceiver
$ ./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n StartupReceiver
<help snipped>
Error: Bad component name: StartupReceiver
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.fstab.checkit_android" android:installLocation="internalOnly"
android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".BaseActivity" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="BasePreferences" />
<activity android:name="EditActivity" />
<receiver android:name="StartupReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<receiver android:name="NotificationReceiver">
<intent-filter>
<action android:name="net.fstab.checkit_android.NotificationReceiver" />
</intent-filter>
</receiver>
<service android:name="StartupService">
<intent-filter>
<action android:name="net.fstab.checkit_android.StartupService" />
</intent-filter>
</service>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
</manifest>
You need to specify the package name before the class name (then you may write it without the package) like this:
./adb shell am broadcast -a android.intent.action.BOOT_COMPLETED -c android.intent.category.HOME -n net.fstab.checkit_android/.StartupReceiver
Practically it turns out that you just have to add a slash after the package name.
You helped me start, I helped you finish :)
这篇关于Android的ADB壳AM广播:错误的组件名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!