Android Parse.com facebook集成NoClassDefFoundError

时间:2015-12-01 14:48:16

标签: java android facebook parse-platform

我的申请要求用户使用Facebook帐户登录。我可以用Facebook开发人员的正常facebook登录来做,但我还需要用户输入用户名和密码,我的应用程序不在facebook活动中。所以,我使用Parse.com facebook应用程序代替。但是,当我按照Parse.com-Getting Started上的说明操作时,我甚至无法使用ParseFacebookUtils.initialize(getApplicationContext()),而且显示的错误是

12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0xa4cf0b20)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime: FATAL EXCEPTION: main
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime: Process: com.lvlack.hellmepls, PID: 22943
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime: java.lang.NoClassDefFoundError: com.parse.ParseFacebookUtils$1
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at com.parse.ParseFacebookUtils.initialize(ParseFacebookUtils.java:109)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at com.parse.ParseFacebookUtils.initialize(ParseFacebookUtils.java:92)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at com.lvlack.hellmepls.MainActivity.onCreate(MainActivity.java:14)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.Activity.performCreate(Activity.java:5231)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2233)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.ActivityThread.access$800(ActivityThread.java:135)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:102)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:136)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:5001)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at java.lang.reflect.Method.invokeNative(Native Method)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:515)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
12-01 21:32:31.125 22943-22943/com.lvlack.hellmepls E/AndroidRuntime:     at dalvik.system.NativeStart.main(Native Method)

MainActivity.java

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        ParseFacebookUtils.initialize(getApplicationContext());
        setContentView(R.layout.activity_main);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        ParseFacebookUtils.onActivityResult(requestCode, resultCode, data);
    }
}

App - build.gradle

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.facebook.android:facebook-android-sdk:4.7.0'
    compile 'com.parse:parsefacebookutils-v4-android:1.10.3@aar'
    repositories {
        mavenCentral()
        'com.parse:parse-android:1.10.1'
    }
}

的AndroidManifest.xml

<application
        <!-- other activities setup -->
        <activity android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            android:theme="@style/AppTheme"/>

        <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id"/>
    </application>

    <uses-permission android:name="android.permission.INTERNET"/>

我有什么遗漏,以及如何解决这个问题?谢谢。

1 个答案:

答案 0 :(得分:0)

https://github.com/ParsePlatform/ParseFacebookUtils-Android/issues/12

我自己在这里报道了这个问题。请提供此信息。