由于SocialAuth Library项目导致崩溃

时间:2014-07-15 06:40:27

标签: android crash android-logcat socialauth

我在添加社交认证图书馆项目(谷歌)时遇到了问题。

有两个jar文件使用了socialauth-2.3和socialauth-android

public void onClick(View v) {
    // TODO Auto-generated method stub
    switch (v.getId()) {
    case R.id.fbLogin:
        adapter = new SocialAuthAdapter(new ResponseListener()); //<----- after this it crashes
        wmbPreference = PreferenceManager.getDefaultSharedPreferences(this);
        boolean isFirstRun = wmbPreference.getBoolean("FIRSTRUN", true);
        adapter.authorize(LoginActivity.this, Provider.FACEBOOK);
        adapter.addProvider(Provider.FACEBOOK, R.drawable.apppurchase);
        break;

    case R.id.loginWithExistingAccount:
        new SignInDialog(context, typeface);
        break;
    case R.id.createNewAccount:
        new SignUpDialog(context, typeface, imeiString);
        break;

    default:
        break;
    }

}

下面是我的logcat

07-15 12:05:20.498: E/AndroidRuntime(1353): FATAL EXCEPTION: main
07-15 12:05:20.498: E/AndroidRuntime(1353): Process: com.example.puzzleapplication, PID: 1353
07-15 12:05:20.498: E/AndroidRuntime(1353): android.content.res.Resources$NotFoundException: Resource ID #0x0
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.content.res.Resources.getValue(Resources.java:1123)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.content.res.Resources.getDrawable(Resources.java:698)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at org.brickred.socialauth.android.SocialAuthDialog.setUpTitle(SocialAuthDialog.java:181)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at org.brickred.socialauth.android.SocialAuthDialog.onCreate(SocialAuthDialog.java:143)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.app.Dialog.dispatchOnCreate(Dialog.java:361)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.app.Dialog.show(Dialog.java:262)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at org.brickred.socialauth.android.SocialAuthAdapter$3$1.run(SocialAuthAdapter.java:418)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.os.Handler.handleCallback(Handler.java:733)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at     android.os.Handler.dispatchMessage(Handler.java:95)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.os.Looper.loop(Looper.java:136)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at android.app.ActivityThread.main(ActivityThread.java:5017)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at java.lang.reflect.Method.invokeNative(Native Method)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at java.lang.reflect.Method.invoke(Method.java:515)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
07-15 12:05:20.498: E/AndroidRuntime(1353):     at dalvik.system.NativeStart.main(Native Method)

你们可以帮助我解决问题

此致

2 个答案:

答案 0 :(得分:1)

您必须在示例项目中添加drawable的名称:

把:

adapter.addProvider(Provider.FACEBOOK, R.drawable.facebook);

而不是:

adapter.addProvider(Provider.FACEBOOK, R.drawable.apppurchase);

它们会起作用。

答案 1 :(得分:0)

就我演唱会而言,这是您资源的错误。 1.你没有正确地查看你试图设置可能导致的drawable 下一行中可能与社会认证有关的错误 2.检查 findViewbyid的第一个