parse.com eclipse安卓错误

时间:2015-01-08 14:43:14

标签: android eclipse parse-platform

我有一个使用parse.com的应用程序来自通知推送,但是当我启动时它会出错。我已将parse.jar导入到我的项目中

清单:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.images"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="18" />

     <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />

    <permission android:protectionLevel="signature"
        android:name="com.example.images.permission.C2D_MESSAGE" />

    <uses-permission 
    android:name="com.example.images.permission.C2D_MESSAGE" />

    <application
            android:name="com.example.images.PushSenseiApplication"
          android:allowBackup="true"
        android:icon="@drawable/ico2"
        android:label="@string/app_name"
        android:theme="@style/AppBaseTheme">

        <activity
            android:name="com.example.images.MainActivity"
            android:label="@string/app_name">

        </activity>
        <activity
            android:name="com.example.images.logi"
            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="com.example.images.puntosClass"
            android:label="@string/app_name">

        </activity>

        <activity
            android:name="com.example.images.onceClass"
            android:label="@string/app_name">

        </activity>
        <activity
            android:name="com.example.images.webviewClass"
            android:label="@string/app_name">

        </activity>
        <activity
            android:name="com.example.images.lesionClass"
            android:label="@string/app_name">

        </activity>

        <service android:name="com.parse.PushService" />
        <receiver android:name="com.parse.ParseBroadcastReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.USER_PRESENT" />
            </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: If you change the package name of this sample app,
                  change "com.parse.tutorials.pushnotifications" in the lines
                  below to match the new package name.
                -->
                <category android:name="com.example.images" />
            </intent-filter>
        </receiver>

    </application>

</manifest>

类扩展应用程序:

package com.example.images;

import android.app.Application;

import com.parse.Parse;
import com.parse.ParseInstallation;

public class PushSenseiApplication extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        Parse.initialize(this, "WGauUt9cYuayGY9oGmMJ5tfS7xND2RQFk1zREDO1",
                "2jIL3urydrUBUPqM7sEGzvkrBXIO0srPwgaz7NrA");
    ParseInstallation.getCurrentInstallation()
        .saveInBackground();
    }
}

错误日志(它有点儿)

01-08 14:21:33.360: E/dalvikvm(5811): Could not find class 'com.parse.ParseRequest$8', referenced from method com.parse.ParseRequest.executeAsync
01-08 14:21:33.384: E/dalvikvm(5811): Could not find class 'bolts.Task$TaskCompletionSource', referenced from method com.parse.ParseRequest.sendOneRequestAsync
01-08 14:21:33.396: E/dalvikvm(5811): Could not find class 'bolts.Task$TaskCompletionSource', referenced from method com.parse.ParseRequest.cancel
01-08 14:21:33.428: E/dalvikvm(5811): Could not find class 'bolts.Capture', referenced from method com.parse.ParseObject.canBeSerialized
01-08 14:21:33.428: E/dalvikvm(5811): Could not find class 'com.parse.ParseObject$14', referenced from method com.parse.ParseObject.enqueueSaveEventuallyOperationAsync
01-08 14:21:33.428: E/dalvikvm(5811): Could not find class 'com.parse.ParseObject$42', referenced from method com.parse.ParseObject.fetchAllAsync
01-08 14:21:33.440: E/dalvikvm(5811): Could not find class 'com.parse.ParseObject$39', referenced from method com.parse.ParseObject.fetchAllIfNeededAsync
01-08 14:21:33.440: E/dalvikvm(5811): Could not find class 'com.parse.ParseObject$40', referenced from method com.parse.ParseObject.fetchAllIfNeededInBackground
01-08 14:21:33.444: E/dalvikvm(5811): Could not find class 'com.parse.ParseObject$43', referenced from method com.parse.ParseObject.fetchAllInBackground
01-08 14:21:33.488: E/dalvikvm(5811): Could not find class 'com.parse.ParseObject$16', referenced from method com.parse.ParseObject.deleteEventually

1 个答案:

答案 0 :(得分:0)

我认为您忘记添加接收器,将此接收器添加到您的清单

<receiver android:name="com.parse.ParsePushBroadcastReceiver"
android:exported="false">
  <intent-filter>
    <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>

如果还没有添加

,还需要添加这些权限
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />


<permission android:protectionLevel="signature"
android:name="com.example.images.permission.C2D_MESSAGE" />
<uses-permission android:name="com.example.images.permission.C2D_MESSAGE" />

有关详情,请查看:https://www.parse.com/apps/quickstart#parse_push/android/new