相关疑难解决方法(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:无法启动服务意图:找不到?

我知道,我不是第一个遇到这个问题的人,但我尝试了很多解决方案,我发现并且没有人工作......也许你会发现错误

错误(也是如此,没有.class和/.Client取决于其他设置)

12-02 16:40:15.359:W/ActivityManager(74):无法启动服务Intent {act = com.android.fh.EnOceanApp.Client.class}:未找到

在清单中,这包含在应用程序中,不在活动中(在活动中也尝试使用".Client")

onCreate()中的代码

    startService(new Intent(this, Client.class)); 
Run Code Online (Sandbox Code Playgroud)

要么

 startService(new Intent(this.getApplicationContext(), Client.class));
Run Code Online (Sandbox Code Playgroud)

要么

Intent intent=new Intent("com.android.fh.EnOceanApp.Client.class");
    this.startService(intent);
Run Code Online (Sandbox Code Playgroud)

要么

  Intent intent=new Intent("com.android.fh.EnOceanApp.Client");
    this.startService(intent);
Run Code Online (Sandbox Code Playgroud)

现在,我再也没有一个想法.... com.android.fh.EnOceanApp是包,Client.java是这个包中的服务类

我忘记了清单:

  <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:label="@string/app_name"
            android:name=".EnOceanAppActivity" >
            <intent-filter >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>      
        </activity>

      <activity android:name=".ListView" 
          android:label="List View">
      </activity> 
      <activity android:name=".GraphView" 
          android:label="Graph View">
      </activity>
      <service 
            android:name=".Client"></service> //with and without ., of course without this comment
    </application>
Run Code Online (Sandbox Code Playgroud)

java service android classnotfound

16
推荐指数
2
解决办法
4万
查看次数

ACRA崩溃报告是否也需要服务许可?

用于集成崩溃报告的ACRA文档包含3个简单步骤:

1 - 安装 ACRA

2 - 将以下内容添加到AndroidManifest.xml中

<!-- in the manifest, not the application tag -->
<uses-permission android:name="android.permission.INTERNET" />
Run Code Online (Sandbox Code Playgroud)

<application ... android:name=".MyApplication">
    ...
</application>
Run Code Online (Sandbox Code Playgroud)

3 - 创建一个与上面的'MyApplication'同名的新java类:

import org.acra.*;
import org.acra.annotation.*;

@ReportsCrashes(formUri = "http://www.yourselectedbackend.com/reportpath")
public class MyApplication extends Application {
  @Override
  public void onCreate() {
    // The following line triggers the initialization of ACRA
    super.onCreate();
    ACRA.init(this);
  }
}
Run Code Online (Sandbox Code Playgroud)

那应该是它.我认为指令有点过时,AndroidManifest.xml从那时起已经发展.

我还需要在我<application> ... </application>的内部添加以下功能:

<service android:name="org.acra.sender.SenderService" />
Run Code Online (Sandbox Code Playgroud)

问题:我做错了什么或Android的需求是否已经发展并且我正确地做到了?

无论哪种方式,我也想分享/记录我的步骤,以防其他人遇到同样的问题.

android acra

2
推荐指数
1
解决办法
487
查看次数