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");

 

posted @ 2018-07-29 12:45  SpaceVision  阅读(38)  评论(0编辑  收藏  举报