我正在使用Parse作为我的安卓应用后端,想要使用Crash Reporting,但是无法正常工作。
我正在使用最新的Parse SDK:`v1.10.3`。
我有一个类,在其中初始化了Parse:
public class Parse extends android.app.Application {
@Override
public void onCreate() {
super.onCreate();
ParseCrashReporting.enable(this);
com.parse.Parse.initialize(this, "KEY", "KEY");
ParseInstallation.getCurrentInstallation().saveInBackground();
ParsePush.subscribeInBackground("main");
}
}
我将把这个类添加到Android清单文件中,以便执行此类一次,不会导致初始化解析崩溃。
<application
android:name=".Parse"
崩溃报告似乎不起作用,我的应用程序中没有出现任何崩溃面板。我进行了Parse测试,但没有发现任何崩溃。
当我添加以下内容时,我的应用程序日志中出现了一些消息:
throw new RuntimeException("Test Exception!");
在我的MainActivity上。
这里是日志:
E/CrashReporting: ParseCrashReporting caught a RuntimeException exception for com.example.yasser.version6. Building report.
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: Handling exception for crash
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.yasser.version6/com.example.yasser.version6.MainActivity}: java.lang.RuntimeException: Test Exception!
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2411)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.access$800(ActivityThread.java:144)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.os.Handler.dispatchMessage(Handler.java:102)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.os.Looper.loop(Looper.java:155)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.main(ActivityThread.java:5696)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at java.lang.reflect.Method.invoke(Native Method)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at java.lang.reflect.Method.invoke(Method.java:372)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: Caused by: java.lang.RuntimeException: Test Exception!
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at com.example.yasser.version6.MainActivity.onCreate(MainActivity.java:171)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.Activity.performCreate(Activity.java:5958)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2474)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.access$800(ActivityThread.java:144)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.os.Handler.dispatchMessage(Handler.java:102)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.os.Looper.loop(Looper.java:155)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at android.app.ActivityThread.main(ActivityThread.java:5696)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at java.lang.reflect.Method.invoke(Native Method)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at java.lang.reflect.Method.invoke(Method.java:372)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1028)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 E/CrashReporting: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:823)
10-17 22:06:19.408 1863-1863/com.example.yasser.version6 D/CrashReporting: Generating report file for crash
10-17 22:06:19.488 1863-1863/com.example.yasser.version6 I/System: exec(logcat -t 200 -v time @ com.parse.LogCatCollector.collectLogCat:87)
10-17 22:06:19.518 1863-1863/com.example.yasser.version6 D/CrashReporting: Retrieving logcat output...
10-17 22:06:19.528 1863-1863/com.example.yasser.version6 I/System: exec(logcat -b events -t 200 -v time @ com.parse.LogCatCollector.collectLogCat:87)
10-17 22:06:19.548 1863-1863/com.example.yasser.version6 D/CrashReporting: Retrieving logcat output...
10-17 22:06:19.558 1863-1863/com.example.yasser.version6 I/System: exec(logcat -b radio -t 200 -v time @ com.parse.LogCatCollector.collectLogCat:87)
10-17 22:06:19.579 1863-1863/com.example.yasser.version6 D/CrashReporting: Retrieving logcat output...
10-17 22:06:19.649 1863-1863/com.example.yasser.version6 W/Settings: Setting data_roaming_allowed has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.649 1863-1863/com.example.yasser.version6 W/Settings: Setting data_roaming_blocked has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.649 1863-1863/com.example.yasser.version6 W/Settings: Setting data_roaming_guard_allowed has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.649 1863-1863/com.example.yasser.version6 W/Settings: Setting data_roaming_guard_blocked has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.689 1863-1863/com.example.yasser.version6 W/Settings: Setting sms_roaming_guard_allowed has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.689 1863-1863/com.example.yasser.version6 W/Settings: Setting voice_roaming_allowed has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.689 1863-1863/com.example.yasser.version6 W/Settings: Setting voice_roaming_blocked has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.689 1863-1863/com.example.yasser.version6 W/Settings: Setting voice_roaming_guard_allowed has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.689 1863-1863/com.example.yasser.version6 W/Settings: Setting voice_roaming_guard_blocked has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.689 1863-1863/com.example.yasser.version6 W/Settings: Setting vzw_global_roaming_options has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
10-17 22:06:19.749 1863-1863/com.example.yasser.version6 W/Settings: Setting boot_lock has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
10-17 22:06:19.749 1863-1863/com.example.yasser.version6 W/Settings: Setting data_encryption has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
10-17 22:06:19.769 1863-1863/com.example.yasser.version6 W/Settings: Setting sd_encryption has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
10-17 22:06:19.769 1863-1863/com.example.yasser.version6 W/Settings: Setting tethering_blocked has moved from android.provider.Settings.Secure to android.provider.Settings.Global.
10-17 22:06:19.789 1863-1863/com.example.yasser.version6 V/CrashReporting: About to start ReportSenderWorker from #handleException
10-17 22:06:19.799 1863-1943/com.example.yasser.version6 D/CrashReporting: #checkAndSendReports - start
10-17 22:06:19.799 1863-1943/com.example.yasser.version6 D/CrashReporting: Looking for error files in /data/data/com.example.yasser.version6/files/com.parse/cr/reports
10-17 22:06:19.799 1863-1943/com.example.yasser.version6 D/CrashReporting: Loading file 1445112379423-RuntimeException-1.stacktrace
10-17 22:06:19.809 1863-1943/com.example.yasser.version6 I/CrashReporting: Sending file 1445112379423-RuntimeException-1.stacktrace
10-17 22:06:19.809 1863-1943/com.example.yasser.version6 D/CrashReporting: Sending crash report to Parse...
10-17 22:06:19.809 1863-1943/com.example.yasser.version6 D/CrashReporting: #checkAndSendReports - finish
清单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.yasser.version6" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<permission
android:name="com.example.yasser.version6.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="com.example.yasser.version6.permission.C2D_MESSAGE" />
<uses-feature
android:name="android.hardware.camera"
android:required="true" />
<application
android:name=".Parse"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyMaterialTheme" >
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<meta-data
android:name="com.parse.push.notification_icon"
android:resource="@mipmap/ic_notiflogo" />
<activity
android:name="com.facebook.FacebookActivity"
android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="com.facebook.app.FacebookContentProvider1009675892446854"
android:exported="true" />
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".ActivitySignup"
android:label="@string/title_activity_acitivity_signup"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".NewprofileActivity"
android:label="@string/title_activity_newprofile"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
>
</activity>
<activity
android:name=".PublierActivity"
android:label="@string/title_activity_publier"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
>
</activity>
<activity
android:name=".EditName"
android:label="@string/title_activity_edit_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name=".Mespublications"
android:label="@string/title_activity_mespublications"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EditPublication"
android:label="@string/title_activity_edit_publication"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".EditText"
android:label="@string/title_activity_edit_text"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name=".AboutActivity"
android:label="@string/title_activity_about"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".MyContacts_Activity"
android:label="@string/title_activity_my_contacts_"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Verification_activity"
android:label="@string/title_activity_verification_activity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateVisible" >
</activity>
<activity
android:name=".Filtercontacts"
android:label="@string/title_activity_filtercontacts" >
</activity>
<activity
android:name=".LikesActivity"
android:label="@string/title_activity_likes" >
</activity>
<activity
android:name=".CropActivity"
android:label="@string/title_activity_crop" >
</activity>
<activity
android:name=".Profile"
android:label="@string/title_activity_profile"
android:theme="@style/MyMaterialTheme" >
</activity>
<activity android:name=".MyProfile" >
</activity>
<activity
android:name=".Options"
android:label="@string/title_activity_options"
android:theme="@style/MyMaterialTheme" >
</activity>
<activity
android:name=".CommentActivity"
android:label="@string/title_activity_comment"
android:theme="@style/MyMaterialTheme" >
</activity>
<service android:name="com.parse.PushService" />
<receiver
android:name=".Notifications.CustomPushReceiver"
android:exported="false" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="com.parse.push.intent.RECEIVE" />
<action android:name="com.parse.push.intent.DELETE" />
<action android:name="com.parse.push.intent.OPEN" />
</intent-filter>
</receiver>
<receiver
android:name="com.parse.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<!-- IMPORTANT: Change "com.parse.starter" to match your app's package name. -->
<category android:name="com.example.yasser.version6" />
</intent-filter>
</receiver>
<activity
android:name=".Notif_Ativity"
android:label="@string/title_activity_notif__ativity"
android:theme="@style/MyMaterialTheme" >
</activity>
</application>
</manifest>