Android 许可错误 561 - 此应用程序未获得许可。请从 Android 市场购买
Android Licensing Error 561 -This application is not licensed. Please purchase it from Android Market
我不知道我是否正确实施了 LVL。
请指导我解决这个问题。
我遵循了一些答案,例如清除缓存、卸载和重新安装。
仍然没有运气..
我在上传到 alpha 测试之前尝试了以下步骤。
- 我正在使用 Eclipse。我使用导出签名的应用程序包选项创建了一个密钥库
- 已从密钥库上传 APK。
以下是我的代码,我从How to license my Android application?
public class Activity_LicenseCheck extends Activity {
private class MyLicenseCheckerCallback implements LicenseCheckerCallback{
@Override
public void allow(int reason) {
toast("Inside-Allow:" + reason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
startMainActivity();
}
@Override
public void dontAllow(int reason) {
toast("dontAllow: " + reason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
}
@Override
public void applicationError(int errorCode) {
if (isFinishing()) {
return;
}
toast("Errorffff: " + errorCode);
startMainActivity();
}
}
private static final String BASE64_PUBLIC_KEY = "mykey";
private static final byte[] SALT = new byte[] {11,34,56,36,3,45,-87,2,67,-98,32,-14,44,-58,39,-26,72,-19,86,23};
private LicenseChecker mChecker;
// A handler on the UI thread.
private LicenseCheckerCallback mLicenseCheckerCallback;
private void doCheck() {
mChecker.checkAccess(mLicenseCheckerCallback);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(),
Secure.ANDROID_ID);
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
}
@Override
protected Dialog onCreateDialog(int id) {
// We have only one dialog.
return new AlertDialog.Builder(this)
.setTitle("Application Not Licensed")
.setCancelable(false)
.setMessage(
"This application is not licensed. Please purchase it from Android Market")
.setPositiveButton("Buy App",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
Intent marketIntent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://market.android.com/details?id="
+ getPackageName()));
startActivity(marketIntent);
finish();
}
})
.setNegativeButton("Exit",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
finish();
}
}).create();
}
@Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
private void startMainActivity() {
startActivity(new Intent(this, Activity_login.class));
finish();
}
public void toast(String string) {
Toast.makeText(this, string, Toast.LENGTH_SHORT).show();
}
}
终于解决了问题是 BASE64 的输入错误 PUBLIC KEY.I 对许可概念一无所知 google 应该想出简单的解决方案。
它对我有用..
我的第一次发布是 1.0 版,我收到错误 561。(未获得许可)
isuue 是错误的 BASE64 PUBLIC KEY 条目然后我用正确的条目替换它并在 Androidmanifest.xml 中将应用程序版本更改为 2.0 并重新生成密钥库最后将 apk 上传到开发人员控制台并禁用版本 1 和发布版本2 在控制台中。当从控制台下载新的 apk 时仍然面临问题,应用程序抛出 "Error retrieving information from server [RPC:S-7:AEC-0]" 错误。我 googled 找到了解决方案,重新启动了设备并且成功了
我不知道我是否正确实施了 LVL。
请指导我解决这个问题。
我遵循了一些答案,例如清除缓存、卸载和重新安装。
仍然没有运气..
我在上传到 alpha 测试之前尝试了以下步骤。
- 我正在使用 Eclipse。我使用导出签名的应用程序包选项创建了一个密钥库
- 已从密钥库上传 APK。
以下是我的代码,我从How to license my Android application?
public class Activity_LicenseCheck extends Activity {
private class MyLicenseCheckerCallback implements LicenseCheckerCallback{
@Override
public void allow(int reason) {
toast("Inside-Allow:" + reason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
startMainActivity();
}
@Override
public void dontAllow(int reason) {
toast("dontAllow: " + reason);
if (isFinishing()) {
// Don't update UI if Activity is finishing.
return;
}
}
@Override
public void applicationError(int errorCode) {
if (isFinishing()) {
return;
}
toast("Errorffff: " + errorCode);
startMainActivity();
}
}
private static final String BASE64_PUBLIC_KEY = "mykey";
private static final byte[] SALT = new byte[] {11,34,56,36,3,45,-87,2,67,-98,32,-14,44,-58,39,-26,72,-19,86,23};
private LicenseChecker mChecker;
// A handler on the UI thread.
private LicenseCheckerCallback mLicenseCheckerCallback;
private void doCheck() {
mChecker.checkAccess(mLicenseCheckerCallback);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Try to use more data here. ANDROID_ID is a single point of attack.
String deviceId = Secure.getString(getContentResolver(),
Secure.ANDROID_ID);
// Library calls this when it's done.
mLicenseCheckerCallback = new MyLicenseCheckerCallback();
// Construct the LicenseChecker with a policy.
mChecker = new LicenseChecker(this, new ServerManagedPolicy(this,
new AESObfuscator(SALT, getPackageName(), deviceId)),
BASE64_PUBLIC_KEY);
doCheck();
}
@Override
protected Dialog onCreateDialog(int id) {
// We have only one dialog.
return new AlertDialog.Builder(this)
.setTitle("Application Not Licensed")
.setCancelable(false)
.setMessage(
"This application is not licensed. Please purchase it from Android Market")
.setPositiveButton("Buy App",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
Intent marketIntent = new Intent(
Intent.ACTION_VIEW,
Uri.parse("http://market.android.com/details?id="
+ getPackageName()));
startActivity(marketIntent);
finish();
}
})
.setNegativeButton("Exit",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
finish();
}
}).create();
}
@Override
protected void onDestroy() {
super.onDestroy();
mChecker.onDestroy();
}
private void startMainActivity() {
startActivity(new Intent(this, Activity_login.class));
finish();
}
public void toast(String string) {
Toast.makeText(this, string, Toast.LENGTH_SHORT).show();
}
}
终于解决了问题是 BASE64 的输入错误 PUBLIC KEY.I 对许可概念一无所知 google 应该想出简单的解决方案。
它对我有用.. 我的第一次发布是 1.0 版,我收到错误 561。(未获得许可) isuue 是错误的 BASE64 PUBLIC KEY 条目然后我用正确的条目替换它并在 Androidmanifest.xml 中将应用程序版本更改为 2.0 并重新生成密钥库最后将 apk 上传到开发人员控制台并禁用版本 1 和发布版本2 在控制台中。当从控制台下载新的 apk 时仍然面临问题,应用程序抛出 "Error retrieving information from server [RPC:S-7:AEC-0]" 错误。我 googled 找到了解决方案,重新启动了设备并且成功了