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

Does ACRA crash reporting also require service permission?

集成崩溃报告的 ACRA documentation 包括 3 个简单的步骤:

1 - Install the ACRA library

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

<!-- in the manifest, not the application tag -->
<uses-permission android:name="android.permission.INTERNET" />

<application ... android:name=".MyApplication">
    ...
</application>

3 - 创建一个新的 java class 同名 'MyApplication':

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

应该是这样。我认为这些说明有点过时了,而且 AndroidManifest.xml 从那时起就发生了变化。

我还 needed 在我的 <application> ... </application> 中添加以下内容以使其正常运行:

<service android:name="org.acra.sender.SenderService" />

问题: 是我做错了什么,还是 Android 需求发生了变化而我做对了?

无论如何我也想share/document我的步骤以防其他人有同样的问题。

可以在 ACRA 的 GitHub Wiki 上找到更新的基本设置说明:https://github.com/ACRA/acra/wiki/BasicSetup

Declaring the SenderService

ACRA (4.8+) uses the SenderService to send reports so it needs to be configured in your AndroidManifest.

If you are using manifest merging then the SenderService will be automatically included for you. Otherwise you will also need to configure a service that will send the reports. It should look like:

    <service
        android:name="org.acra.sender.SenderService"
        android:exported="false"
        android:process=":acra" />

NB the android:process ensures that the service runs in the :acra process. The intent is that that process is different from the default process for your application to ensure that the reports can be sent even though your app will be in shutdown mode if it has crashed.

文档站点可能尚未更新 GitHub 站点上的最新更新。