I am getting this error when hitting the "Login With Facebook" (Simple login button).
I have Google, and read other topics here - but I can not see any thing matching my issue.
I am adding Login.java class below.
public class Login extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
setContentView(R.layout.activity_login);
CallbackManager callbackManager = CallbackManager.Factory.create();
LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
loginButton.setReadPermissions("public_profile", "email", "user_friends");
// Other app specific specialization
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
Log.i("Login", "Logged in: ");
Intent i = new Intent(Login.this, MainActivity.class);
startActivity(i);
}
@Override
public void onCancel() {
// App code
}
@Override
public void onError(FacebookException exception) {
// App code
Log.i("Error" , "Error");
}
});
}
}
StackTrace:
05-28 20:07:27.550 872-1363/? E/Parcel﹕ Class not found when unmarshalling: com.facebook.login.LoginClient$Request
java.lang.ClassNotFoundException: com.facebook.login.LoginClient$Request
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at java.lang.Class.forName(Class.java:272)
at android.os.Parcel.readParcelableCreator(Parcel.java:2275)
at android.os.Parcel.readParcelable(Parcel.java:2239)
at android.os.Parcel.readValue(Parcel.java:2146)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.getString(BaseBundle.java:918)
at android.content.Intent.getStringExtra(Intent.java:5378)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1768)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1313)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4522)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4368)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:140)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2964)
at android.os.Binder.execTransact(Binder.java:446)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.login.LoginClient$Request" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at java.lang.Class.classForName(Native Method)
at java.lang.Class.forName(Class.java:308)
at java.lang.Class.forName(Class.java:272)
at android.os.Parcel.readParcelableCreator(Parcel.java:2275)
at android.os.Parcel.readParcelable(Parcel.java:2239)
at android.os.Parcel.readValue(Parcel.java:2146)
at android.os.Parcel.readArrayMapInternal(Parcel.java:2479)
at android.os.BaseBundle.unparcel(BaseBundle.java:221)
at android.os.BaseBundle.getString(BaseBundle.java:918)
at android.content.Intent.getStringExtra(Intent.java:5378)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.j
Java:1768) at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:1313)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:4522)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:4368)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:140)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2964)
at android.os.Binder.execTransact(Binder.java:446)
Suppressed: java.lang.ClassNotFoundException: com.facebook.login.LoginClient$Request
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 18 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
I too had this issue. Mine however was a login call made within the
FBActivity.OnResume
method for callbacks to login after accepting fb perms.I simply moved the request into the profile tracker in the
onCreate
methodAlso ensure your
OnCreate
super is as follows...
I have struggled with this problem and I fixed with multidex enabled
add this in your build file
also this code in your activity
after adding this in your build gradle dependencies
In my case i forgot to add application package name and class name on the developer page of facebook. After i added this information then it worked.
You should add this to your acctivity
}
but if your using parse SDK add this
I had the same problem, and solved by putting the
facebook_app_id
tostrings.xml
instead of a constant:Check your android:noHistory flag on the activity.
See link https://developers.facebook.com/bugs/1621984714705591/ look for post by Andreas Bergenwall