相关疑难解决方法(0)

无法启动服务意图

我有一个服务类.我已将此类导出到jar,并且已将jar嵌入到我的客户端应用程序中.

需要时,我会调用服务类.当我尝试这样做时,我收到以下错误:

Unable to start service Intent {comp={com.sample.service/com.sample.service.serviceClass}} : not found
Run Code Online (Sandbox Code Playgroud)

除了服务类之外,我还有其他类,我可以访问它(创建该类的对象),它们位于同一个jar中.

我觉得我错过了我的配置或清单中的一些东西.

请帮我识别一下.我的代码如下:

public void onCreate(Bundle savedInstanceState) {    
      super.onCreate(savedInstanceState);  
      Intent intent = new Intent () ;  
      intent.setClassName("com.sample.service" ,"com.sample.service.serviceClass") ;  
      this.startService(intent) ; // when I call this line I get the message...  
      // binding other process continue  here   
}
Run Code Online (Sandbox Code Playgroud)

客户端manifest.xml

<service android:name="com.sample.service.serviceClass"  
            android:exported="true" android:label="@string/app_name" 
            android:process=":remote">
   <intent-filter><action android:name="com.sample.service.serviceClass"></action>
   </intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)

提前谢谢,
Vinay

service android intentfilter android-intent

80
推荐指数
4
解决办法
11万
查看次数

标签 统计

android ×1

android-intent ×1

intentfilter ×1

service ×1