我目前正在Android上开发一个应用程序,但是在花了一天时间对其进行更改后,我遇到了一个奇怪的问题。在我的物理设备上,当我通过单击图标启动应用程序时没有任何事情发生....我已清除应用程序数据,删除它并重新安装它。如果从安装程序启动(通过在安装后单击“打开”),安装程序将抛出一个expception并关闭(process.android.packageinstaller,强制关闭)?
通过adb启动应用程序可以正常工作吗? (使其难以排除故障)
之前有没有人见过这种行为?
更新以包含更多信息:
这是logcat的输出:
直接在手机上运行程序:
I/ActivityManager( 1324): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS } from pid 1460
W/ActivityManager( 1324): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS } from ProcessRecord{40848e70 1460:com.android.launcher/10055} (pid=1460, uid=10055) requires com.google.android.c2dm.permission.SEND
从eclipse运行时:
D/AndroidRuntime( 5138): Calling main entry com.android.commands.am.Am
I/ActivityManager( 1324): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.apics.distantsms/.DistantSMS } from pid 5138
D/AndroidRuntime( 5138): Shutting down VM
I/ActivityManager( 1324): Start proc com.apics.distantsms for activity com.apics.distantsms/.DistantSMS: pid=5146 uid=10110 gids={3003}
D/dalvikvm( 5138): Debugger has detached; object registry had 1 entries
I/AndroidRuntime( 5138): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager( 1324): Displayed com.apics.distantsms/.DistantSMS: +376ms
(我把GC线拿出来)
我的AndroidManifest.xml文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.apics.distantsms"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.RECEIVE_SMS"></uses-permission>
<uses-permission android:name="android.permission.READ_SMS"></uses-permission>
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.VIBRATE"></uses-permission>
<!-- Only this application can receive the messages and registration result -->
<permission android:name="com.apics.distantsms.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="com.apics.distantsms.permission.C2D_MESSAGE" />
<!-- This app has permission to register and receive message -->
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="com.google.android.c2dm.permission.SEND"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".DistantSMS"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:enabled="true" android:name="SMSService">
<intent-filter>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
</service>
<activity android:name="SettingsActivity">
<intent-filter>
<category android:name="android.intent.category.PREFERENCE"></category>
<action android:name="android.intent.action.GET_CONTENT"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.OPENABLE"></category>
</intent-filter>
</activity>
<!-- Only C2DM servers can send messages for the app. If permission is not set - any other app can generate it -->
<receiver android:name=".C2DMReceiver" android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.apics.distantsms"/>
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.apics.distantsms"/>
</intent-filter>
</receiver>
</application>
</manifest>
再次感谢大家的帮助......
亚历
从模拟器上的菜单启动应用程序时再次使用输出进行更新(请注意,在模拟器中从eclipse调用时它将正常运行):
I/ActivityManager( 61): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS } from pid 132
W/ActivityManager( 61): Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS } from ProcessRecord{40723798 132:com.android.launcher/10021} (pid=132, uid=10021) requires com.google.android.c2dm.permission.SEND
E/Launcher( 132): Launcher does not have the permission to launch Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS }. Make sure to create a MAIN intent-filter for the corresponding activity or use the exported attribute for this activity. tag=ApplicationInfo(title=Distant SMS) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS }
E/Launcher( 132): java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.apics.distantsms/.DistantSMS } from ProcessRecord{40723798 132:com.android.launcher/10021} (pid=132, uid=10021) requires com.google.android.c2dm.permission.SEND
E/Launcher( 132): at android.os.Parcel.readException(Parcel.java:1322)
E/Launcher( 132): at android.os.Parcel.readException(Parcel.java:1276)
E/Launcher( 132): at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:1351)
E/Launcher( 132): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1374)
E/Launcher( 132): at android.app.Activity.startActivityForResult(Activity.java:2827)
E/Launcher( 132): at com.android.launcher2.Launcher.startActivityForResult(Launcher.java:1078)
E/Launcher( 132): at android.app.Activity.startActivity(Activity.java:2933)
E/Launcher( 132): at com.android.launcher2.Launcher.startActivitySafely(Launcher.java:1498)
E/Launcher( 132): at com.android.launcher2.AllApps2D.onItemClick(AllApps2D.java:178)
E/Launcher( 132): at android.widget.AdapterView.performItemClick(AdapterView.java:284)
E/Launcher( 132): at android.widget.AbsListView$PerformClick.run(AbsListView.java:1812)
E/Launcher( 132): at android.os.Handler.handleCallback(Handler.java:587)
E/Launcher( 132): at android.os.Handler.dispatchMessage(Handler.java:92)
E/Launcher( 132): at android.os.Looper.loop(Looper.java:130)
E/Launcher( 132): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/Launcher( 132): at java.lang.reflect.Method.invokeNative(Native Method)
E/Launcher( 132): at java.lang.reflect.Method.invoke(Method.java:507)
E/Launcher( 132): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/Launcher( 132): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/Launcher( 132): at dalvik.system.NativeStart.main(Native Method)
再次感谢....
亚历
答案 0 :(得分:0)
这可能不是问题的实际原因,但这是我过去在处理应用程序崩溃时所做的事情,这些应用程序崩溃似乎只发生在我的物理设备上,而不是模拟器上。
我已经使用了CatLog,它是免费的并且可以完成任务。 - https://market.android.com/details?id=com.nolanlawson.logcat&feature=search_result
这应该可以更容易地调试问题。