我的应用内结算代码工作正常,直到我升级到Android L Dev Preview.现在,当我的应用程序启动时出现此错误.有没有人知道L导致了什么变化或者我应该如何更改我的代码来解决这个问题?
android {
compileSdkVersion 'android-L'
buildToolsVersion '20'
defaultConfig {
minSdkVersion 13
targetSdkVersion 'L'
...
...
compile 'com.google.android.gms:play-services:5.+'
compile 'com.android.support:support-v13:21.+'
compile 'com.android.support:appcompat-v7:21.+'
...
...
Run Code Online (Sandbox Code Playgroud)
应用启动时的错误:
06-29 16:22:33.281 5719-5719/com.tbse.wnswfree D/AndroidRuntime? Shutting down VM
06-29 16:22:33.284 5719-5719/com.tbse.wnswfree E/AndroidRuntime? FATAL EXCEPTION: main
Process: com.tbse.wnswfree, PID: 5719
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.tbse.wnswfree/com.tbse.wnswfree.InfoPanel}: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2255)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2317)
at android.app.ActivityThread.access$800(ActivityThread.java:143)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1258)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5070)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372) …Run Code Online (Sandbox Code Playgroud) android illegalargumentexception android-intent in-app-billing android-5.0-lollipop
我想将onTouchListeners分配给TextView中的每个单词.(不是链接到互联网上的东西,而只是为了继续应用程序内的游戏逻辑).此时我的游戏的一般动作是看到TextView,触摸一个单词,如果它是你赢得的目标单词,否则根据你触摸和重复的单词加载另一个TextView.我现在实现这一目标的方法是使用ClickableSpans和每个单词的onClicks.
但我宁愿拥有onTouchListeners,所以我可以在touch_down上更改单词背景的颜色,并在touch_up上执行游戏逻辑,使其看起来更具响应性.我怎么能做到这一点?
final TextView defTV = (TextView) findViewById(R.id.defTV);
text = new SpannableString(rv); // rv is the future clickable TextView text
ClickableSpan clickableSpan = null;
String regex = "\\w+";
Pattern p = Pattern.compile(regex);
Matcher matcher = p.matcher(text);
while (matcher.find()) {
final int begin = matcher.start();
final int end = matcher.end();
clickableSpan = new ClickableSpan() {
public void onClick(View arg0) {
String lword = (String) text.subSequence(begin, end).toString();
if (lword.equalsIgnoreCase(targetword)) {
// WIN
} else {
// Build new TextView based on lword, …Run Code Online (Sandbox Code Playgroud)