1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2024-06-28 16:13:20 +00:00

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

View File

@ -77,7 +77,6 @@ public class App extends Application {
@Override @Override
protected void attachBaseContext(final Context base) { protected void attachBaseContext(final Context base) {
super.attachBaseContext(base); super.attachBaseContext(base);
initACRA(); initACRA();
} }
@ -200,7 +199,11 @@ public class App extends Application {
.build(); .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 { try {
final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this) final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this)
.setReportSenderFactoryClasses(REPORT_SENDER_FACTORY_CLASSES) .setReportSenderFactoryClasses(REPORT_SENDER_FACTORY_CLASSES)