RuntimeException:接收广播意图时出错 - package_changed
我收到此运行时异常,但记录器不是很有帮助,并且它没有指向代码中特定的任何位置。我认为它的关键部分如下:
接收广播 Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.google.android.apps.maps
Out of:
01-31 15:05:38.647: INFO/ActivityThread(10213): Receiving broadcast android.intent.action.PACKAGE_CHANGED seq=-1 to android.app.ActivityThread$PackageInfo$ReceiverDispatcher@2fa54588
01-31 15:05:38.737: WARN/ResourceType(1128): Resources don't contain package for resource number 0x7f060001
01-31 15:05:38.787: WARN/ResourceType(10213): Failure getting entry for 0x7f090004 (t=8 e=4) in package 0: 0xffffffb5
01-31 15:05:38.797: ERROR/AndroidRuntime(10213): Uncaught handler: thread main exiting due to uncaught exception
01-31 15:05:38.797: ERROR/AndroidRuntime(10213): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.google.android.apps.maps flg=0x20000000 (has extras) } in com.android.launcher2.LauncherModel@2fa12b48
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:780)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.os.Handler.handleCallback(Handler.java:587)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.os.Handler.dispatchMessage(Handler.java:92)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.os.Looper.loop(Looper.java:123)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.app.ActivityThread.main(ActivityThread.java:4395)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at java.lang.reflect.Method.invokeNative(Native Method)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at java.lang.reflect.Method.invoke(Method.java:521)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at dalvik.system.NativeStart.main(Native Method)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f090004
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.content.res.Resources.getValue(Resources.java:891)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.content.res.Resources.getDimension(Resources.java:455)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.launcher2.Utilities$BubbleText.<init>(Utilities.java:438)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.launcher2.AllAppsList.updatePackage(AllAppsList.java:172)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.launcher2.LauncherModel.onReceive(LauncherModel.java:341)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:769)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
... 9 more
现在,我没有在中使用 Google 地图至少在我的应用程序中。它是一个 3D 应用程序,只有一个外部意图,即语音输入/识别器,我将其与以下三个功能一起使用
private void loadRecognizer(){
// Check to see if a recognition activity is present
PackageManager pk = getPackageManager();
List<ResolveInfo> activities = pk.queryIntentActivities(
new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() != 0) {
gWorld.setSpokenText("Recognizer OK!");
} else {
gWorld.setSpokenText("Recognizer not present!");
}
}
private void fireRecognizer(){
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
//intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK){
// Fill the list view with the strings the recognizer thought it could have heard
matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String listString = "";
for (String s : matches)
{
listString += s + "\t";
}
gWorld.setSpokenText(listString);
Logger.log(listString);
}
gWorld.speechActivity = false;
super.onActivityResult(requestCode, resultCode, data);
}
并且我在清单中将其声明为此
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
错误在应用程序启动后几秒钟出现,但它没有强行关闭,可以简单地“确定”,然后它就会消失......
这会给任何人敲响警钟吗?
非常感谢!
I am getting this runtime exception but the logger isn't being very helpful and it is not pointing to anywhere specific in the code. I think the key part of it is the following:
receiving broadcast Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.google.android.apps.maps
Out of:
01-31 15:05:38.647: INFO/ActivityThread(10213): Receiving broadcast android.intent.action.PACKAGE_CHANGED seq=-1 to android.app.ActivityThread$PackageInfo$ReceiverDispatcher@2fa54588
01-31 15:05:38.737: WARN/ResourceType(1128): Resources don't contain package for resource number 0x7f060001
01-31 15:05:38.787: WARN/ResourceType(10213): Failure getting entry for 0x7f090004 (t=8 e=4) in package 0: 0xffffffb5
01-31 15:05:38.797: ERROR/AndroidRuntime(10213): Uncaught handler: thread main exiting due to uncaught exception
01-31 15:05:38.797: ERROR/AndroidRuntime(10213): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.intent.action.PACKAGE_CHANGED dat=package:com.google.android.apps.maps flg=0x20000000 (has extras) } in com.android.launcher2.LauncherModel@2fa12b48
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:780)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.os.Handler.handleCallback(Handler.java:587)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.os.Handler.dispatchMessage(Handler.java:92)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.os.Looper.loop(Looper.java:123)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.app.ActivityThread.main(ActivityThread.java:4395)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at java.lang.reflect.Method.invokeNative(Native Method)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at java.lang.reflect.Method.invoke(Method.java:521)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at dalvik.system.NativeStart.main(Native Method)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f090004
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.content.res.Resources.getValue(Resources.java:891)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.content.res.Resources.getDimension(Resources.java:455)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.launcher2.Utilities$BubbleText.<init>(Utilities.java:438)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.launcher2.AllAppsList.updatePackage(AllAppsList.java:172)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at com.android.launcher2.LauncherModel.onReceive(LauncherModel.java:341)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:769)
01-31 15:05:38.797: ERROR/AndroidRuntime(10213):
... 9 more
Now, I am not using Google Maps in the least in my app. It is a 3D application which has only one external intent which is the voice input/recognizer, which I use with the following three functions
private void loadRecognizer(){
// Check to see if a recognition activity is present
PackageManager pk = getPackageManager();
List<ResolveInfo> activities = pk.queryIntentActivities(
new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() != 0) {
gWorld.setSpokenText("Recognizer OK!");
} else {
gWorld.setSpokenText("Recognizer not present!");
}
}
private void fireRecognizer(){
Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
//intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speech recognition demo");
startActivityForResult(intent, VOICE_RECOGNITION_REQUEST_CODE);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data){
if (requestCode == VOICE_RECOGNITION_REQUEST_CODE && resultCode == RESULT_OK){
// Fill the list view with the strings the recognizer thought it could have heard
matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
String listString = "";
for (String s : matches)
{
listString += s + "\t";
}
gWorld.setSpokenText(listString);
Logger.log(listString);
}
gWorld.speechActivity = false;
super.onActivityResult(requestCode, resultCode, data);
}
And I declare it in the manifest as
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
This error appears a few seconds after the app has started but it does not force a close and can be simply Okay-ed and it disappears....
Does this ring any bells to anyone?
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论