Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=cn.scu.finch (has extras) }
Intent i = new Intent("cn.scu.finch");
Bundle bundle = new Bundle();
bundle.putString("taskName", "task1");
i.putExtras(bundle);
startService(i);
只需加入一句话
Intent i = new Intent("cn.scu.finch");
//不加这句话的话 android 5.0以上会报:Service Intent must be explitict
i.setPackage(getPackageName());
Bundle bundle = new Bundle();
bundle.putString("taskName", "task1");
i.putExtras(bundle);
startService(i);