检查你是否在 AndroidManifest.xml 文件中添加了互联网权限。
您必须在 androidmanifest.xml 文件中添加互联网和计费权限。
Androidmanifest.xml:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.BROADCAST_STICKY" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
并在活动结束后添加以下计费服务
<service android:name=".BillingService" />
<receiver android:name=".BillingReceiver" >
<intent-filter>
<action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
<action android:name="com.android.vending.billing.RESPONSE_CODE" />
<action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
</intent-filter>
</receiver>
并且必须将公钥保存在 security.java 类中
String base64EncodedPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA09UpyecYDEoQTTp+MCZmJGuRtphynUhGzRvl/jiCPRbdfzrt649RB5j8OmADlkB2pu3TiN/wxKoqol0Gadw7W+BhkTgptog2ZkRrFqnVq+DJSbL1cXbQAc549VmSTEhMSRA0FkpiEg/eqBjyDKiFsMHlmO21WwYyXGvNj5b4qt6OUrbYZYUuO0RHbOJeaJEfoYWuGpxHHUVf0jmQG/+UWOkfNzesRmzAwlz2fPIxchE8k0kSV7dHWP4XaIt7f0tMzny3GsXTBJEJpqXydoCjRWJeOUZX9BjK6U/yPCoTikxA3V7NaSCZ0ofZMJeXsuxhy1TEmW88q6ayhOx/wEKDBwIDAQAB";