Exclusion of invalid android keywords?

I use the InApp Purchase api in my application, where I did a demo project in which I took one button, when we press the button, I get this screen here here

after that, when I click the Buy button, a dialog box shows that the "payment is completed", the image is here enter image description here

after showing this dialog box, my application receives a forced close., I get an error in this line

public static PublicKey generatePublicKey(String encodedPublicKey) {
    try {
        byte[] decodedKey = Base64.decode(encodedPublicKey);
        KeyFactory keyFactory = KeyFactory.getInstance(KEY_FACTORY_ALGORITHM);
        return keyFactory.generatePublic(new X509EncodedKeySpec(decodedKey));
    } catch (NoSuchAlgorithmException e) {
        throw new RuntimeException(e);
    } catch (InvalidKeySpecException e) {
        Log.e(TAG, "Invalid key specification.");
        throw new IllegalArgumentException(e);
    } catch (Base64DecoderException e) {
        Log.e(TAG, "Base64DecoderException.", e);
        return null;
    }
}

here is my logcat enter image description here

+4
source share

Source: https://habr.com/ru/post/1525209/


All Articles