我从此页面使用代码进行许可证检查:
How to license my Android application?
并希望让它也适用于Lollipop。错误是:
java.lang.IllegalArgumentException: Service Intent must be explicit
答案 0 :(得分:2)
不幸的是,这是Google Play许可库的known bug。问题已分配,将来会修复,同时如果你想在Lollipop中使用该库,还有一个解决方法:
在LicenseChecker.java中改变:
boolean bindResult = mContext.bindService(new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U="))),
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);
到此:
Intent serviceIntent = new Intent(new String(Base64.decode("Y29tLmFuZHJvaWQudmVuZGluZy5saWNlbnNpbmcuSUxpY2Vuc2luZ1NlcnZpY2U=")));
serviceIntent.setPackage("com.android.vending");
boolean bindResult = mContext.bindService(serviceIntent),
this, // ServiceConnection.
Context.BIND_AUTO_CREATE);