AndroidStudio couldn't find the class 'MailSenderConfiguration or MailSenderConfigurationBuilder'
mic-user opened this issue · 3 comments
mic-user commented
Hi.
Struggling to migrate from the version 4.7x to 5.11.x.
But,
thing is Android studio saying that "Cannot resolve symbol 'MailSenderConfigurationBuilder'" as red syntax.
What is the problem?
I have put
implementation("ch.acra:acra-core:5.11.3")
implementation("ch.acra:acra-mail:5.11.3")
in the module.
and the code is.
import org.acra.*;
import org.acra.annotation.*;
import org.acra.ACRA;
import org.acra.ErrorReporter;
import org.acra.config.*;
import org.acra.config.CoreConfigurationBuilder;
import org.acra.data.CrashReportData;
import org.acra.data.StringFormat;
import org.acra.sender.ReportSenderException;
and
CoreConfigurationBuilder builder = new CoreConfigurationBuilder()
.withBuildConfigClass(BuildConfig.class)
.withReportFormat(StringFormat.JSON);
builder.getPluginConfigurations(MailSenderConfigurationBuilder.class)
.withMailTo("xxxxxxxxxxxxx@gmail.com")
.withReportContent(ReportField.APP_VERSION_CODE,
ReportField.APP_VERSION_NAME,
ReportField.USER_CRASH_DATE,
ReportField.PACKAGE_NAME,
ReportField.REPORT_ID,
ReportField.ANDROID_VERSION,
ReportField.TOTAL_MEM_SIZE,
ReportField.AVAILABLE_MEM_SIZE,
ReportField.BUILD,
ReportField.STACK_TRACE,
ReportField.DISPLAY,
ReportField.BRAND,
ReportField.PRODUCT,
ReportField.PHONE_MODEL,
ReportField.APPLICATION_LOG,
ReportField.LOGCAT,
ReportField.DEVICE_FEATURES,
ReportField.SHARED_PREFERENCES,
ReportField.THREAD_DETAILS,
ReportField.CUSTOM_DATA)
.withResSubject("Crash Error report")
.withResBody("")
.withReportAsFile(false)
//.withReportFileName("crash_report.txt")
.withEnabled(true);
ACRA.DEV_LOGGING = true;
ACRA.init(this, builder);
what should be the problem?
henrichg commented
Use this, working in my application:
builder.withPluginConfigurations(
new MailSenderConfigurationBuilder()
.withMailTo(StringConstants.AUTHOR_EMAIL)
.withSubject(StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + getString(R.string.acra_email_subject_text))
.withBody(body)
.withReportAsFile(true)
.withReportFileName("crash_report.txt")
.withEnabled(true)
.build()
);
F43nd1r commented
Yeah looks like you're trying to use an old config style, see henrichgs answer or the website for the current config style in java.