我向 Nexus 7 平板电脑发出以下命令:
adb.exe -s 015d2109567231a0f shell am startservice -n com.packagename/.ExServiceName --ei port 59777
并得到:
Starting service: Intent { cmp=com.packagename/.ExServiceName (has extras) }
java.lang.SecurityException: Caller uid=2000 is not privileged to communicate with user=-2
at android.os.Parcel.readException(Parcel.java:1425)
at android.os.Parcel.readException(Parcel.java:1379)
at android.app.ActivityManagerProxy.startService(ActivityManagerNative.java:2648)
at com.android.commands.am.Am.runStartService(Am.java:415)
at com.android.commands.am.Am.run(Am.java:111)
at com.android.commands.am.Am.main(Am.java:82)
at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:235)
at dalvik.system.NativeStart.main(Native Method)
在我对平板电脑应用系统更新之前,这一切都没有问题!
当前平板电脑信息:
Model number: Nexus 7
Android version: 4.2
Kernel version: 3.1.10-g22b4fcd
服务清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.packagename"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
<uses-permission android:name="android.permission.INTERNET"/>
<application android:label="@string/app_name"
android:icon="@drawable/ic_launcher"
android:theme="@style/AppTheme">
<service android:name=".ExServiceName" android:exported="true"></service>
</application>
</manifest>
我正在开发Windows 7 x64
您能否告诉我如何使服务成功接受意图而不抛出任何类型的异常?
谢谢,
康拉德