签名的apk崩溃,Facebook登录 [英] Signed apk crashes with facebook login

查看:306
本文介绍了签名的apk崩溃,Facebook登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的签名APK崩溃第一次在Facebook登录与此错误:

My Signed apk crashes first time on facebook login with this error:

AndroidRuntime:致命的异常:主要结果
com.facebook.aq:com.facebook.c.f得到了一个意想不到的方法签名:公共抽象com.facebook.c.c com.facebook.c.c.a(java.lang.Class中)

AndroidRuntime: FATAL Exception: main
com.facebook.aq: com.facebook.c.f got an unexpected method signature: public abstract com.facebook.c.c com.facebook.c.c.a(java.lang.Class)

然而,它正常工作与第2次尝试登录。我使用的Facebook,Android的SDK-3.6.0。
我在这里也检查 - <一个href=\"http://stackoverflow.com/questions/14781633/android-facebook-application-crashes-when-using-a-hash-key-other-than-the-debug\">Android使用非调试散列键其他哈希键时,却没有发现任何解决方案的Facebook应用程序崩溃。结果
不要任何人面临同样的问题,请帮我整理出了上述问题。

However, it works fine with 2nd attempt login. I am using Facebook-android-sdk-3.6.0. I've checked here too - Android Facebook application crashes when using a hash key other than the debug hash key, but didn't find any solution.
Do anyone faced the same issue, please help me in sorting out the above problem.

推荐答案

感觉还不错写你自己的问题的答案,在情况下,如果有人在这里面临着同样的问题是解决方案:
正是有了hashkey问题而已,在某种程度上它改变了我的密钥库,我做的是烤(因为我没能看到签名我的应用程序后,调试日志)使用下面函数生成散列键签名的应用程序之后(见printKeyHash() ),并把你的Facebook开发者控制台上这些生成的密钥。

Feels good to write answer of your own question, In case, if someone else is facing same problem here is the solution : It was problem with hashkey only, somehow it changes after signing app with my keystore, what I have done is toasted (because I was not able to see debug logs after signing my app) the hash key generated using below function(see printKeyHash()) and put these generated key on your facebook developer's console.

public static String printKeyHash(Activity context) {
    PackageInfo packageInfo;
    String key = null;
    try {

        //getting application package name, as defined in manifest
        String packageName = context.getApplicationContext().getPackageName();

        //Retriving package info
        packageInfo = context.getPackageManager().getPackageInfo(packageName,
                PackageManager.GET_SIGNATURES);

        Log.e("Package Name=", context.getApplicationContext().getPackageName());

        for (Signature signature : packageInfo.signatures) {
            MessageDigest md = MessageDigest.getInstance("SHA");
            md.update(signature.toByteArray());
            key = new String(Base64.encode(md.digest(), 0));

            // String key = new String(Base64.encodeBytes(md.digest()));
            //Log.e("Key Hash=", key);
             Toast.makeText(TAG, "Keyhash: " + key, 1).show();

        }
    } catch (NameNotFoundException e1) {
        Log.e("Name not found", e1.toString());
    }

    catch (NoSuchAlgorithmException e) {
        Log.e("No such an algorithm", e.toString());
    } catch (Exception e) {
        Log.e("Exception", e.toString());
    }

    return key;
}

否则,其他的方法可以是使用命令提示符来生成新的散列关键字:
打开CMD提示符,然后键入:

Else, other method may be to use command prompt to generate new hash key: Open cmd prompt and type:

C:\\Program Files\\Java\\jdk1.6.0_30\\bin>keytool -exportcert -alias androiddebugkey -keystore "D:\\Amrit\keystore\mykeystore.keystore" | "C:\\OpenSSL\\bin\\openssl" sha1 -binary |"C:\\OpenSSL\bin\\openssl" base64

其中D:\\阿姆里特\\密钥库\\ my​​keystore.keystore是我的密钥库的位置。我没有检查/试过这一个,因为我从第一步骤解决我的问题,但我认为它应该工作!

where "D:\Amrit\keystore\mykeystore.keystore" is the location of my keystore. I haven't checked/tried this one out as I solved my problem from the first procedure, but I think it should work!!

这篇关于签名的apk崩溃,Facebook登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆