大家好,我是新的 android 人,我试图制作一个通过链接登录的应用程序,但它抛出异常java.lang.NoClassDefFoundError: org.brickred.socialauth.android.SocialAuthAdapter
并使应用程序崩溃。下面是我的代码
package com.example.demosocialapp;
import org.brickred.socialauth.android.DialogListener;
import org.brickred.socialauth.android.SocialAuthAdapter;
import org.brickred.socialauth.android.SocialAuthAdapter.Provider;
import org.brickred.socialauth.android.SocialAuthError;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends Activity {
SocialAuthAdapter adapter;
Button update;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button share = (Button) findViewById(R.id.button1);
adapter = new SocialAuthAdapter(new ResponseListener());
adapter.enable(share);
share.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
adapter.authorize(MainActivity.this, Provider.LINKEDIN);
}
});
}
private final class ResponseListener implements DialogListener {
@Override
public void onComplete(Bundle values) {
final String providerName = values.getString(SocialAuthAdapter.PROVIDER);
Toast.makeText(MainActivity.this, providerName + " connected", Toast.LENGTH_LONG).show();
}
@Override
public void onError(SocialAuthError error) {
Log.d("ShareButton", "Authentication Error: " + error.getMessage());
}
@Override
public void onCancel() {
Log.d("ShareButton", "Authentication Cancelled");
}
@Override
public void onBack() {
Log.d("Share-Button", "Dialog Closed by pressing Back Key");
}
}
}
但是当我单击按钮时,它会出现崩溃错误:java.lang.NoClassDefFoundError: org.brickred.socialauth.SocialAuthManager
请帮我....................