Unfortunately "My app" has stopped

189 views Asked by At

I am trying to add facebook sign in button in my app. After doing the changes and compiling there were no errors, but when I tried to run it in emulator it was crashing by giving this message "Unfortunately "my app" has stopped"

Could anybody any tell me how to solve this?

Thanks in advance

here is my mainactivity file

Public class learningActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_learning);
        getUserInfo();
    }

    public void getUserInfo() {

        try{
        PackageInfo info= getPackageManager().getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
        for(Signature signature:info.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            Log.d("Key Hash:- ", Base64.encodeToString(md.digest(), Base64.DEFAULT));
        }


        }
        catch (PackageManager.NameNotFoundException e) {}
        catch (NoSuchAlgorithmException e){}



    }


}

here is my mainfest file :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.prashant.nuhani_go" >

    <!-- To access Google+ APIs: -->
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


    <!--
 To retrieve OAuth 2.0 tokens or invalidate tokens to disconnect a user. This disconnect
     option is required to comply with the Google+ Sign-In developer policies
    -->
    <uses-permission android:name="android.permission.USE_CREDENTIALS" /> <!-- To retrieve the account name (email) as part of sign-in: -->
    <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <!-- To auto-complete the email text field in the login form with the user's emails -->
    <uses-permission android:name="android.permission.READ_PROFILE" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <meta-data

            android:name="com.facebook.sdk.AppId"
            android:value="@string/app_id">

        </meta-data>
        <activity
            android:name=".learningActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:name="com.facebook.FacebookActivity"/>
            android:configChanges=
                "<keyboard></keyboard>creenSize|orientation"
            android:theme="@android:style/Theme.Translucent.NoTitleBar"
            android:label="@string/app_name" />

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    </application>

</manifest>
0

There are 0 answers