Android Studio报错:Service Intent must be explicit

今天碰到一个报错:Service Intent must be explicit

解决办法这里比较全:

https://stackoverflow.com/questions/27842430/service-intent-must-be-explicit-intent

https://stackoverflow.com/questions/24480069/google-in-app-billing-illegalargumentexception-service-intent-must-be-explicit#26318757

我采用了其中比较省事的办法,

Intent accessIntent = new Intent(MainActivity.this, KeyAccessibilityService.class);
accessIntent.setAction(Settings.ACTION_ACCESSIBILITY_SETTINGS);
accessIntent.setAction("com.android.vending");

其中关键的就是这一句:accessIntent.setAction("com.android.vending");

猜你喜欢

转载自blog.csdn.net/tanmx219/article/details/81270109