The following classes could not be instantiated: - com.facebook.widget.LoginButton

后端 未结 3 1081
感动是毒
感动是毒 2020-12-10 05:44

I have been working on getting the facebook practice apps working and I cannot for the life of me figure out why I cannot reference the LoginButton found in the Facebook SDK

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-10 05:53

    OPTION #1:

    Sometimes, when a new resource is added, Eclipse doesn't compile correctly the new code (maybe a caching issue), causing this error.

    Normally, simply restarting Eclipse is enough to fix the problem.

    OPTION #2:

    Sometimes, rendering custom views causes this exception. The only workaround I know is checking View.isInEditMode every time you try to use the getResources().

    An example could be:

    if (isInEditMode()) {
        //do something else, as getResources() is not valid.
    } else {
        //you can use getResources()
        String mystring = getResources().getString(R.string.mystring);
    }
    

提交回复
热议问题