mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-02-02 12:19:16 +00:00
Merge pull request #3982 from Stypox/fix-acra
Fix ACRA bug reports not containing stack trace
This commit is contained in:
commit
f290b2bf5a
@ -89,6 +89,7 @@ ext {
|
|||||||
androidxRoomVersion = '2.2.5'
|
androidxRoomVersion = '2.2.5'
|
||||||
groupieVersion = '2.8.0'
|
groupieVersion = '2.8.0'
|
||||||
markwonVersion = '4.3.1'
|
markwonVersion = '4.3.1'
|
||||||
|
googleAutoServiceVersion = '1.0-rc7'
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@ -175,6 +176,9 @@ dependencies {
|
|||||||
|
|
||||||
implementation "com.google.android.material:material:1.1.0"
|
implementation "com.google.android.material:material:1.1.0"
|
||||||
|
|
||||||
|
compileOnly "com.google.auto.service:auto-service-annotations:${googleAutoServiceVersion}"
|
||||||
|
kapt "com.google.auto.service:auto-service:${googleAutoServiceVersion}"
|
||||||
|
|
||||||
implementation "androidx.appcompat:appcompat:1.1.0"
|
implementation "androidx.appcompat:appcompat:1.1.0"
|
||||||
implementation "androidx.preference:preference:1.1.1"
|
implementation "androidx.preference:preference:1.1.1"
|
||||||
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
implementation "androidx.recyclerview:recyclerview:1.1.0"
|
||||||
|
@ -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)
|
||||||
|
@ -20,10 +20,8 @@ import org.acra.ACRA;
|
|||||||
import org.acra.config.ACRAConfigurationException;
|
import org.acra.config.ACRAConfigurationException;
|
||||||
import org.acra.config.CoreConfiguration;
|
import org.acra.config.CoreConfiguration;
|
||||||
import org.acra.config.CoreConfigurationBuilder;
|
import org.acra.config.CoreConfigurationBuilder;
|
||||||
import org.acra.sender.ReportSenderFactory;
|
|
||||||
import org.schabi.newpipe.extractor.NewPipe;
|
import org.schabi.newpipe.extractor.NewPipe;
|
||||||
import org.schabi.newpipe.extractor.downloader.Downloader;
|
import org.schabi.newpipe.extractor.downloader.Downloader;
|
||||||
import org.schabi.newpipe.report.AcraReportSenderFactory;
|
|
||||||
import org.schabi.newpipe.report.ErrorActivity;
|
import org.schabi.newpipe.report.ErrorActivity;
|
||||||
import org.schabi.newpipe.report.UserAction;
|
import org.schabi.newpipe.report.UserAction;
|
||||||
import org.schabi.newpipe.settings.SettingsActivity;
|
import org.schabi.newpipe.settings.SettingsActivity;
|
||||||
@ -65,9 +63,6 @@ import io.reactivex.plugins.RxJavaPlugins;
|
|||||||
|
|
||||||
public class App extends Application {
|
public class App extends Application {
|
||||||
protected static final String TAG = App.class.toString();
|
protected static final String TAG = App.class.toString();
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static final Class<? extends ReportSenderFactory>[]
|
|
||||||
REPORT_SENDER_FACTORY_CLASSES = new Class[]{AcraReportSenderFactory.class};
|
|
||||||
private static App app;
|
private static App app;
|
||||||
|
|
||||||
public static App getApp() {
|
public static App getApp() {
|
||||||
@ -77,7 +72,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,10 +194,17 @@ 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() {
|
||||||
|
if (ACRA.isACRASenderServiceProcess()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this)
|
final CoreConfiguration acraConfig = new CoreConfigurationBuilder(this)
|
||||||
.setReportSenderFactoryClasses(REPORT_SENDER_FACTORY_CLASSES)
|
|
||||||
.setBuildConfigClass(BuildConfig.class)
|
.setBuildConfigClass(BuildConfig.class)
|
||||||
.build();
|
.build();
|
||||||
ACRA.init(this, acraConfig);
|
ACRA.init(this, acraConfig);
|
||||||
|
@ -4,9 +4,12 @@ import android.content.Context;
|
|||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
|
|
||||||
import org.acra.config.CoreConfiguration;
|
import org.acra.config.CoreConfiguration;
|
||||||
import org.acra.sender.ReportSender;
|
import org.acra.sender.ReportSender;
|
||||||
import org.acra.sender.ReportSenderFactory;
|
import org.acra.sender.ReportSenderFactory;
|
||||||
|
import org.schabi.newpipe.App;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Created by Christian Schabesberger on 13.09.16.
|
* Created by Christian Schabesberger on 13.09.16.
|
||||||
@ -28,6 +31,10 @@ import org.acra.sender.ReportSenderFactory;
|
|||||||
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Used by ACRA in {@link App}.initAcra() as the factory for report senders.
|
||||||
|
*/
|
||||||
|
@AutoService(ReportSenderFactory.class)
|
||||||
public class AcraReportSenderFactory implements ReportSenderFactory {
|
public class AcraReportSenderFactory implements ReportSenderFactory {
|
||||||
@NonNull
|
@NonNull
|
||||||
public ReportSender create(@NonNull final Context context,
|
public ReportSender create(@NonNull final Context context,
|
||||||
|
Loading…
Reference in New Issue
Block a user