Fix empty stacktrace in bug report

ACRA has to be initialized after MultiDex
https://github.com/ACRA/acra/issues/619
https://github.com/ACRA/acra/wiki/Troubleshooting-Guide#legacy-multidex
This commit is contained in:
Stypox 2020-07-28 10:45:48 +02:00
parent d6d8c7830c
commit 1b9f5989ef
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,5 @@
package org.schabi.newpipe
import android.content.Context
import androidx.multidex.MultiDex
import androidx.preference.PreferenceManager
import com.facebook.stetho.Stetho
@ -11,11 +10,6 @@ import okhttp3.OkHttpClient
import org.schabi.newpipe.extractor.downloader.Downloader
class DebugApp : App() {
override fun attachBaseContext(base: Context) {
super.attachBaseContext(base)
MultiDex.install(this)
}
override fun onCreate() {
super.onCreate()
initStetho()
@ -34,6 +28,12 @@ class DebugApp : App() {
return downloader
}
override fun initACRA() {
// install MultiDex before initializing ACRA
MultiDex.install(this)
super.initACRA()
}
private fun initStetho() {
// Create an InitializerBuilder
val initializerBuilder = Stetho.newInitializerBuilder(this)

View File

@ -77,7 +77,6 @@ public class App extends Application {
@Override
protected void attachBaseContext(final Context base) {
super.attachBaseContext(base);
initACRA();
}
@ -200,7 +199,11 @@ public class App extends Application {
.build();
}
private void initACRA() {
/**
* Called in {@link #attachBaseContext(Context)} after calling the {@code super} method.
* Should be overridden if MultiDex is enabled, since it has to be initialized before ACRA.
*/
protected void initACRA() {
try {
final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this)
.setReportSenderFactoryClasses(REPORT_SENDER_FACTORY_CLASSES)