8
我有一個使用許可證檢查API的Android應用程序。我已經爲API等級8,9和10設置了Google API的模擬器AVD。我的應用程序對8級AVD可以很好地工作,但是9級和10級AVD失敗了。下面是一個典型的logcat序列:(我覈實,我的測試帳戶設立在所有的仿真器和我已經設置了開發者控制檯返回的許可測試帳戶的響應)Android模擬器問題上的市場授權API
02-14 17:43:55.815: INFO/LicenseChecker(448): Binding to licensing service.
02-14 17:43:55.935: WARN/ActivityManager(65): Unable to start service Intent { act=com.android.vending.licensing.ILicensingService }: not found
02-14 17:43:55.935: ERROR/LicenseChecker(448): Could not bind to service.
02-14 17:44:00.625: INFO/ActivityManager(65): Displayed com.zigzagworld.tehillim/.Tehillim: +2m1s448ms (total +5m43s546ms)
02-14 17:44:01.085: INFO/ARMAssembler(65): generated scanline__00000177:03515104_00001002_00000000 [ 87 ipp] (110 ins) at [0x439de6f0:0x439de8a8] in 5603158 ns
02-14 17:44:18.025: INFO/InputReader(65): Device reconfigured: id=0x0, name=qwerty, display size is now 320x480
02-14 17:44:18.025: WARN/InputReader(65): Touch device did not report support for X or Y axis!
02-14 17:44:19.005: WARN/InputManagerService(65): Window already focused, ignoring focus gain of: [email protected]
02-14 17:44:20.805: ERROR/ActivityThread(448): Activity com.zigzagworld.tehillim.Tehillim has leaked ServiceConnection [email protected] that was originally bound here
02-14 17:44:20.805: ERROR/ActivityThread(448): android.app.ServiceConnectionLeaked: Activity com.zigzagworld.tehillim.Tehillim has leaked ServiceConnection [email protected] that was originally bound here
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:938)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:833)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.ContextImpl.bindService(ContextImpl.java:864)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.content.ContextWrapper.bindService(ContextWrapper.java:347)
02-14 17:44:20.805: ERROR/ActivityThread(448): at com.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:143)
02-14 17:44:20.805: ERROR/ActivityThread(448): at com.zigzagworld.tehillim.Tehillim.onCreate(Tehillim.java:76)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.os.Handler.dispatchMessage(Handler.java:99)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.os.Looper.loop(Looper.java:123)
02-14 17:44:20.805: ERROR/ActivityThread(448): at android.app.ActivityThread.main(ActivityThread.java:3647)
02-14 17:44:20.805: ERROR/ActivityThread(448): at java.lang.reflect.Method.invokeNative(Native Method)
02-14 17:44:20.805: ERROR/ActivityThread(448): at java.lang.reflect.Method.invoke(Method.java:507)
02-14 17:44:20.805: ERROR/ActivityThread(448): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
02-14 17:44:20.805: ERROR/ActivityThread(448): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
02-14 17:44:20.805: ERROR/ActivityThread(448): at dalvik.system.NativeStart.main(Native Method)
02-14 17:44:20.835: WARN/ActivityManager(65): Unbind failed: could not find connection for [email protected]
在我的LicenseCheckerCallback
中完成dontAllow()
處理後,發生有關泄漏連接的錯誤。
我的代碼很漂亮。我在onCreate()
執行以下操作:
String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);
AESObfuscator ob = new AESObfuscator(SALT, getPackageName(), deviceId);
LicenseChecker checker = new LicenseChecker(this,
new ServerManagedPolicy(this, ob), BASE64_PUBLIC_KEY);
checker.checkAccess(this);
API 8之後的許可代碼有什麼變化嗎?除了API 8之外,其他人是否能夠測試許可?
更新:Google提供的市場許可示例應用程序也出現同樣的問題。
嗯,顯然這是一個已知的問題,根據[此線索](http://groups.google.com/group/android-developers/browse_thread/thread/9b1ae385f79af70b/ 1d61bf8d48e9b6b4?pli = 1)在Android Developers論壇上。 :( – 2011-02-15 02:10:11
有人知道這個問題的解決方案嗎? – barmaley 2011-10-17 16:16:10