Search code examples
androidfacebookconnectionhashmapprovider

failed to integrate facebook connect to native android app Failed to find provider info


I want to integrate facebook connection into my native android app to do that, I have followed the tuto of facebook doc but always I have thefollowing error :

12-24 10:03:28.359: E/ActivityThread(3569): Failed to find provider info for com.facebook.katana.provider.PlatformProvider
12-24 10:05:37.119: D/dalvikvm(4104): GetFieldID: unable to find field Ljava/util/HashMap;.loadFactor:F

firsly, the popup of connexion is displayed but after logging I they don't arrive to run this code :

      @SuppressWarnings("deprecation")
@Override
  public void call(Session session, SessionState state, Exception exception) {
    if (session.isOpened()) {

      // make request to the /me API
      Request.executeMeRequestAsync(session, new Request.GraphUserCallback() {

        // callback after Graph API response with user object
        @Override
        public void onCompleted(GraphUser user, Response response) {
          if (user != null) {
            TextView welcome = (TextView) findViewById(R.id.welcome);
            welcome.setText("Hello " + user.getName() + "!");
          }
        }
      });
    }
  }

I don't know the cause I have generate the hashkey and create the app but always thjis error

in the first time I had the error which said that I don't have the same version of android-support-v4, to fix that, I have removed my app's one and let it work with the library-s one

my facebook account is verified

I have seen the other posts but I don't find the solution

how can I fix this issue

thank you


Solution

  • I have found the solution, the problem was from the hash key, you have to read the has key like that :

            // Add code to print out the key hash
                try {
                    PackageInfo info = getPackageManager().getPackageInfo(
                            "com.example.testhopelast",
                            PackageManager.GET_SIGNATURES);
                    for (Signature signature : info.signatures) {
                        MessageDigest md = MessageDigest.getInstance("SHA");
                        md.update(signature.toByteArray());
                        Log.d("KeyHash:", Base64.encodeToString(md.digest(),
                                Base64.DEFAULT));
                    }
                } catch (NameNotFoundException e) {
    
                } catch (NoSuchAlgorithmException e) {
    
                }
    

    and set this hach key in the facebook dashboard, surely, the one which you have set is not correct due to the version of openssl or something else