标签:打开 发送 automatic font ice -o mpi 接收 net
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
x
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
def acraVersion = ‘5.1.3‘
def acraVersion = ‘5.1.3‘
implementation "ch.acra:acra-http:$acraVersion"//Http
implementation "ch.acra:acra-mail:$acraVersion"//Email
implementation "ch.acra:acra-core:$acraVersion"//Custom
x
implementation "ch.acra:acra-http:$acraVersion"//Http
implementation "ch.acra:acra-mail:$acraVersion"//Email
implementation "ch.acra:acra-core:$acraVersion"//Custom
implementation "ch.acra:acra-dialog:$acraVersion"//Dialog
implementation "ch.acra:acra-notification:$acraVersion"//Notification
implementation "ch.acra:acra-toast:$acraVersion"//Toast
//Silent:Add nothing.
x
implementation "ch.acra:acra-dialog:$acraVersion"//Dialog
implementation "ch.acra:acra-notification:$acraVersion"//Notification
implementation "ch.acra:acra-toast:$acraVersion"//Toast
//Silent:Add nothing.
implementation "ch.acra:acra-limiter:$acraVersion"
implementation "ch.acra:acra-limiter:$acraVersion"
implementation "ch.acra:acra-advanced-scheduler:$acraVersion"
implementation "ch.acra:acra-advanced-scheduler:$acraVersion"
@AcraCore(buildConfigClass = BuildConfig.class)
public class MyApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ACRA.init(this);
}
}
x
buildConfigClass = BuildConfig.class) (
public class MyApplication extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
ACRA.init(this);
}
}
I addition to除了 the @AcraCore annotation, each plugin you added in the dependencies step provides another annotation, which you have to add to activate and configure that plugin:
PS:如果时重度用户,个人不建议通过注解配置各个插件,因为易读性太差;当然,如果只是简单的使用,不需要进行复杂的配置,则通过注解配置即可。CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
builder.setBuildConfigClass(BuildConfig.class).setReportFormat(StringFormat.JSON);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class).setResText(R.string.acra_toast_text);
ACRA.init(this, builder);
x
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
builder.setBuildConfigClass(BuildConfig.class).setReportFormat(StringFormat.JSON);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class).setResText(R.string.acra_toast_text);
ACRA.init(this, builder);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class).setEnabled(true);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class).setEnabled(true);
Available plugin builders:
def acraVersion = ‘5.1.3‘
implementation "ch.acra:acra-http:$acraVersion"//Http
implementation "ch.acra:acra-mail:$acraVersion"//Email
implementation "ch.acra:acra-core:$acraVersion"//Custom
implementation "ch.acra:acra-dialog:$acraVersion"//Dialog
implementation "ch.acra:acra-notification:$acraVersion"//Notification
implementation "ch.acra:acra-toast:$acraVersion"//Toast
def acraVersion = ‘5.1.3‘
implementation "ch.acra:acra-http:$acraVersion"//Http
implementation "ch.acra:acra-mail:$acraVersion"//Email
implementation "ch.acra:acra-core:$acraVersion"//Custom
implementation "ch.acra:acra-dialog:$acraVersion"//Dialog
implementation "ch.acra:acra-notification:$acraVersion"//Notification
implementation "ch.acra:acra-toast:$acraVersion"//Toast
@AcraCore(buildConfigClass = BuildConfig.class)
public class App extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
.setBuildConfigClass(BuildConfig.class)
.setReportFormat(StringFormat.JSON);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class)//吐司
.setLength(Toast.LENGTH_SHORT)
.setResText(R.string.acra_crash_tips)//或者setText
.setEnabled(true);
builder.getPluginConfigurationBuilder(DialogConfigurationBuilder.class)//弹窗
.setResIcon(R.drawable.icon)
.setResTheme(R.style.AppTheme)
.setTitle("标题")//setResTitle
.setText("内容\n\n呵呵呵呵呵呵呵呵")//setResText
.setCommentPrompt("CommentPrompt")//注释输入提示符的标签。setResCommentPrompt
.setEmailPrompt("EmailPrompt")// setResEmailPrompt
.setNegativeButtonText("NegativeButtonText")// setResNegativeButtonText
.setPositiveButtonText("PositiveButtonText")// setResPositiveButtonText
//.setReportDialogClass(BaseCrashReportDialog.class)//自定义CrashReportDialog
.setEnabled(true);
builder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder.class)//发邮件。测试失败
.setMailTo("0909082401@163.com")
.setSubject("主题(崩溃日志)")//或者setResSubject
.setReportAsFile(true)
.setReportFileName("附件名称")
.setEnabled(false);//是通过跳到系统邮箱中,在用户预览并确认后由用户发出去的,而不是在后台默默发送的
builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class)//HTTP请求。不知道怎么测试
.setHttpMethod(HttpSender.Method.POST)
.setConnectionTimeout(30 * 1000)
.setSocketTimeout(30 * 1000)
.setHttpHeaders(new HashMap<>())
.setBasicAuthLogin("")//认证
.setBasicAuthPassword("")
.setCertificatePath("")//证书地址。或者setResCertificate
.setCertificateType("")//证书类型
.setDropReportsOnTimeout(false)//超时是否删除报告
.setKeyStoreFactoryClass(KeyStoreFactory.class)//该类创建了可以包含可信证书的密钥库
.setEnabled(false);
builder.getPluginConfigurationBuilder(NotificationConfigurationBuilder.class)//通知栏。测试失败
.setResIcon(R.drawable.icon)
.setTitle("标题")//setResTitle
.setText("内容\n\n呵呵呵呵呵呵呵呵")
.setResSendButtonIcon(R.drawable.icon)
.setResSendButtonText(R.string.acra_crash_tips)
.setEnabled(false);
ACRA.init(this, builder);
}
}
x
buildConfigClass = BuildConfig.class) (
public class App extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
.setBuildConfigClass(BuildConfig.class)
.setReportFormat(StringFormat.JSON);
builder.getPluginConfigurationBuilder(ToastConfigurationBuilder.class)//吐司
.setLength(Toast.LENGTH_SHORT)
.setResText(R.string.acra_crash_tips)//或者setText
.setEnabled(true);
builder.getPluginConfigurationBuilder(DialogConfigurationBuilder.class)//弹窗
.setResIcon(R.drawable.icon)
.setResTheme(R.style.AppTheme)
.setTitle("标题")//setResTitle
.setText("内容\n\n呵呵呵呵呵呵呵呵")//setResText
.setCommentPrompt("CommentPrompt")//注释输入提示符的标签。setResCommentPrompt
.setEmailPrompt("EmailPrompt")// setResEmailPrompt
.setNegativeButtonText("NegativeButtonText")// setResNegativeButtonText
.setPositiveButtonText("PositiveButtonText")// setResPositiveButtonText
//.setReportDialogClass(BaseCrashReportDialog.class)//自定义CrashReportDialog
.setEnabled(true);
builder.getPluginConfigurationBuilder(MailSenderConfigurationBuilder.class)//发邮件。测试失败
.setMailTo("0909082401@163.com")
.setSubject("主题(崩溃日志)")//或者setResSubject
.setReportAsFile(true)
.setReportFileName("附件名称")
.setEnabled(false);//是通过跳到系统邮箱中,在用户预览并确认后由用户发出去的,而不是在后台默默发送的
builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class)//HTTP请求。不知道怎么测试
.setHttpMethod(HttpSender.Method.POST)
.setConnectionTimeout(30 * 1000)
.setSocketTimeout(30 * 1000)
.setHttpHeaders(new HashMap<>())
.setBasicAuthLogin("")//认证
.setBasicAuthPassword("")
.setCertificatePath("")//证书地址。或者setResCertificate
.setCertificateType("")//证书类型
.setDropReportsOnTimeout(false)//超时是否删除报告
.setKeyStoreFactoryClass(KeyStoreFactory.class)//该类创建了可以包含可信证书的密钥库
.setEnabled(false);
builder.getPluginConfigurationBuilder(NotificationConfigurationBuilder.class)//通知栏。测试失败
.setResIcon(R.drawable.icon)
.setTitle("标题")//setResTitle
.setText("内容\n\n呵呵呵呵呵呵呵呵")
.setResSendButtonIcon(R.drawable.icon)
.setResSendButtonText(R.string.acra_crash_tips)
.setEnabled(false);
ACRA.init(this, builder);
}
}
标签:打开 发送 automatic font ice -o mpi 接收 net
原文地址:https://www.cnblogs.com/baiqiantao/p/9157524.html