Closed F43nd1r closed 3 years ago
Another workaround is to turn on the "Autostart" permission on the App info page. This worked for me.
Can somebody test this on a device which saw the problem previously?
@Override
public boolean requiresForeground() {
return !TextUtils.isEmpty(getSystemProperty("ro.miui.ui.version.name"));
}
public static String getSystemProperty(String propName) {
String line;
BufferedReader input = null;
try {
java.lang.Process p = Runtime.getRuntime().exec("getprop " + propName);
input = new BufferedReader(new InputStreamReader(p.getInputStream()), 1024);
line = input.readLine();
input.close();
} catch (IOException ex) {
return null;
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return line;
}
Related source: https://gist.github.com/Muyangmin/e8ec1002c930d8df3df46b306d03315d
Hey @F43nd1r , I would like to test it. But what do I need to do to let ACRA use my extended version? Pretty sure you can give me a hint before I am wasting time :-)
You need to register a custom ReportSenderFactory
https://github.com/ACRA/acra/wiki/Custom-Extensions
I feel a little bit stupid, I cannot get the ReportSenderFactory loaded.
Inside my Application.java:
@Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); ACRA.init(this); }
and the annotations:
@AcraCore(buildConfigClass = BuildConfig.class, logcatArguments = {"-t", "2000"}) @AcraHttpSender(uri = "https://.....", basicAuthLogin = "....", basicAuthPassword = "...", httpMethod = HttpSender.Method.PUT) @AcraToast(resText = R.string.crash_toast_text) @AcraLimiter(resIgnoredCrashToast = R.string.crash_toast_text)
I have added the dependencies:
compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc6" annotationProcessor "com.google.auto.service:auto-service:1.0-rc6"
and am using Acra 5.7:
def acraVersion = '5.7.0' implementation "ch.acra:acra-http:$acraVersion" implementation "ch.acra:acra-toast:$acraVersion" implementation "ch.acra:acra-limiter:$acraVersion"
This is the Factory-class:
`@AutoService(value = FixedAcraReportSenderFactory.class) public class FixedAcraReportSenderFactory implements ReportSenderFactory {
@NonNull
@Override
public ReportSender create(@NonNull Context context, @NonNull CoreConfiguration config) {
CommonUtils.log(Log.ERROR, "test2");
return new FixedAcraHttpSender(config, HttpSender.Method.POST, StringFormat.JSON);
}
@Override
public boolean enabled(@NonNull CoreConfiguration config) {
CommonUtils.log(Log.ERROR, "test1");
return true;
}
} `
and the FixedAcraHttpSender.java is just the Code like yours.
The Factory-class isn't loaded, neither via breakpoints nor the logs. Even if I register the factory via deprecated
@AcraCore(reportSenderFactoryClasses = {FixedAcraReportSenderFactory.class}, buildConfigClass = BuildConfig.class, logcatArguments = {"-t", "2000"})
Any idea?
Make sure none of your classes are inner classes
All affected classes are public:
@AutoService(value = FixedAcraReportSenderFactory.class) public class FixedAcraReportSenderFactory implements ReportSenderFactory {
@NonNull
@Override
public ReportSender create(@NonNull Context context, @NonNull CoreConfiguration config) {
return new FixedAcraHttpSender(config, HttpSender.Method.POST, StringFormat.JSON);
}
@Override
public boolean enabled(@NonNull CoreConfiguration config) {
CommonUtils.log(Log.ERROR, "üüüüüüüüüüüüüüüüüüüüü");
return true;
}
}
and the FixedAcraHttpSender as well (which shouldn't matter here).
I will try again later this day, It's a strange issue. Maybe this won't work during run/debug mode inside Android Studio?
A class being an inner class or not has nothing to do with it being public or not.
Sorry, of course you are right. They are not inner classes, they are both standalone. Can you confirm the plugin is loaded in your setup on Android 10? Pretty sure I am doing something wrong, but acra is otherwise working fine for me except on my Xiaomi on Android 10.
I am facing the same issue on Xiaomi MIUI 11.0.2 with Android Version 7 and MIUI 11.0.9 with Android Version 9 ; any help would be appreciated :D
Autostart and "Display pop-up windows while running in background" options didn't solve the issue :(
The app name is virtualisres.phonevr (Source Code) and ARCA application implementation is here, here and here.
I crashed the app twice so that mailTo of ACRA will popup, but in vain. The following is logcat dump of the 2 continous crashes(debug build), but i could not identify whats the problem ACRA faced. I have a Xiaomi device and willing to help in resolving the issue, if you are intrested @F43nd1r :D Even ACRA should have a discord server. Thanks.
---snip---
@ShootingKing-AM that looks to me like you're trying to catch native crashes. Acra does not support native code
Oh no! Even logcat/Android is detecting crash, why isn't ACRA able to detect crash ? Any workaround for native crash detection ? What's the difference between jni and java crash ?
On the other hand, I emulated java crash it started the mailto successfully. Thanks
Can somebody test this on a device which saw the problem previously? Include the following aar (zipped for github upload) in your build. Use ACRA 5.8.0. Do not use advanced-scheduler. acra-xiaomi-debug.zip
If it works you should see a notification while acra sends reports.
Hey, I will try to test it in the next few days. Pretty busy at the moment :)
Am Mi., 23. Dez. 2020 um 19:21 Uhr schrieb F43nd1r <notifications@github.com
:
Can somebody test this on a device which saw the problem previously? Include the following aar (zipped for github upload) in your build. Use ACRA 5.8.0. Do not use advanced-scheduler. acra-xiaomi-debug.zip https://github.com/ACRA/acra/files/5736574/acra-xiaomi-debug.zip
If it works you should see a notification while acra sends reports.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ACRA/acra/issues/804#issuecomment-750418457, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADGMMFEMIKLCFHX5UAR54TSWIYK5ANCNFSM4PV4XWIA .
I included the AAR and triggered an Exception. The app crashed, the toast appeared and the following has been logged. But I didn't receive any new report inside my ACRA-installation, should I?
--------- beginning of crash
2020-12-24 00:00:05.493 30271-30271/aaa.bbb.ccc E/AndroidRuntime: FATAL EXCEPTION: main Process: aaa.bbb.ccc, PID: 30271 java.lang.IllegalArgumentException: TEEEESSTTT at aaa.bbb.fragments.SinkFragment.onSinkClickEvent(SinkFragment.java:295) at aaa.bbb.fragments.SinkFragment.access$600(SinkFragment.java:87) at aaa.bbb.fragments.SinkFragment$SinkAdapter.lambda$getView$0$SinkFragment$SinkAdapter(SinkFragment.java:972) at aaa.bbb.fragments.-$$Lambda$SinkFragment$SinkAdapter$rIN-wjqpOidr05dN1UtUNw8rar4.onClick(Unknown Source:4) at android.view.View.performClick(View.java:7185) at android.view.View.performClickInternal(View.java:7162) at android.view.View.access$3500(View.java:819) at android.view.View$PerformClick.run(View.java:27691) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7560) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 2020-12-24 00:00:05.510 30271-30271/aaa.bbb.ccc E/ACRA: ACRA caught a IllegalArgumentException for aaa.bbb.ccc java.lang.IllegalArgumentException: TEEEESSTTT at aaa.bbb.fragments.SinkFragment.onSinkClickEvent(SinkFragment.java:295) at aaa.bbb.fragments.SinkFragment.access$600(SinkFragment.java:87) at aaa.bbb.fragments.SinkFragment$SinkAdapter.lambda$getView$0$SinkFragment$SinkAdapter(SinkFragment.java:972) at aaa.bbb.fragments.-$$Lambda$SinkFragment$SinkAdapter$rIN-wjqpOidr05dN1UtUNw8rar4.onClick(Unknown Source:4) at android.view.View.performClick(View.java:7185) at android.view.View.performClickInternal(View.java:7162) at android.view.View.access$3500(View.java:819) at android.view.View$PerformClick.run(View.java:27691) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:224) at android.app.ActivityThread.main(ActivityThread.java:7560) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) 2020-12-24 00:00:05.714 30271-30533/aaa.bbb.ccc I/Toast: Show toast from OpPackageName:aaa.bbb.ccc, PackageName:aaa.bbb.ccc 2020-12-24 00:00:09.363 30271-30271/aaa.bbb.ccc I/Process: Sending signal. PID: 30271 SIG: 9
Did you enable ACRA as usual? It looks like acra is not active. If that is the case, sorry I didn't state that you needed to.
Which toast are you talking about? Did you see the mentioned notification?
Hey @F43nd1r , I will try to collect & post these info asap.
Hey @F43nd1r ,
yes I did see the toast after I triggered the exception and the app closed. But sadly nothing appeared inside ACRA. I reproduced this today and found some additional information:
2020-12-24 23:38:15.005 1827-2871/? I/AutoStartManagerService: MIUILOG- Reject service :Intent { cmp=abc.xyz/org.acra.sender.JobSenderService } userId : 0 uid : 10384
This looks like the initial issue. What am I missing? I have imported the AAR via Android Studio's Project Settings -> "Import AAR"
Here are my settings:
def acraVersion = '5.8.0-alpha1'
implementation "ch.acra:acra-http:$acraVersion"
implementation "ch.acra:acra-toast:$acraVersion"
implementation "ch.acra:acra-limiter:$acraVersion"
@AcraCore(buildConfigClass = BuildConfig.class, logcatArguments = {"-t", "2000"})
@AcraHttpSender(uri = "https://xxx-bluemix.cloudant.com/acra-xyz/_design/acra-storage/_update/report", basicAuthLogin = "xxx", basicAuthPassword = "xxx", httpMethod = HttpSender.Method.PUT)
@AcraToast(resText = R.string.crash_toast_text)
@AcraLimiter(resIgnoredCrashToast = R.string.crash_toast_text)
public class XYZApplication extends Application {...}
I have imported the AAR via Android Studio's Project Settings -> "Import AAR"
That won't work. You need to include the aar via gradle:
implementation file("libs/acra-xiaomi-debug.aar")
to you build.gradle dependencies block.You might need to add
repositories {
flatDir {
dirs 'libs/aars'
}
}
as well.
Many thanks for the hint.
Okay now that app crashes with my triggered IlegalArgumentException and now I do NOT get the previous log as before:
2020-12-24 23:38:15.005 1827-2871/? I/AutoStartManagerService: MIUILOG- Reject service :Intent { cmp=abc.xyz/org.acra.sender.JobSenderService } userId : 0 uid : 10384
But it seems there are now issues with SELinux as this last line always appears after the crash now:
2020-12-26 00:05:37.863 17573-17573/app.abc.pro E/ACRA: ACRA caught a IllegalArgumentException for app.abc.pro
java.lang.IllegalArgumentException: TEEEESSTTT
at app.abc.fragments.SinkFragment.onSinkClickEvent(SinkFragment.java:295)
at app.abc.fragments.SinkFragment.access$600(SinkFragment.java:87)
at app.abc.fragments.SinkFragment$SinkAdapter.lambda$getView$0$SinkFragment$SinkAdapter(SinkFragment.java:972)
at app.abc.fragments.-$$Lambda$SinkFragment$SinkAdapter$rIN-wjqpOidr05dN1UtUNw8rar4.onClick(Unknown Source:4)
at android.view.View.performClick(View.java:7185)
at android.view.View.performClickInternal(View.java:7162)
at android.view.View.access$3500(View.java:819)
at android.view.View$PerformClick.run(View.java:27691)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:224)
at android.app.ActivityThread.main(ActivityThread.java:7560)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
2020-12-26 00:05:37.931 523-523/? E/SELinux: avc: denied { find } for service=meminfo pid=17679 uid=10384 scontext=u:r:untrusted_app:s0:c128,c257,c512,c768 tcontext=u:object_r:meminfo_service:s0 tclass=service_manager permissive=0
I cannot see any additional interesting line after this one. Hope this helps somehow :)
Please don't tell me xiaomi modified selinux permissions as well. Can you reproduce this issue? @Everybody else please test if you see the same behaviour.
Hey there, can you tell me what exactly you need? Then I can try to send you the required information.
Am Sa., 26. Dez. 2020 um 00:30 Uhr schrieb F43nd1r <notifications@github.com
:
Please don't tell me xiaomi modified selinux permissions as well. Can you reproduce this issue? @everybody https://github.com/everybody else please test if you see the same behaviour.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ACRA/acra/issues/804#issuecomment-751299592, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADGMMB3PWTQLTADZXAIWL3SWUOCVANCNFSM4PV4XWIA .
If it works you should see a notification while acra sends reports.
This is what should happen. If it doesn't, I need a description of what happens instead plus all logs I can get.
I have a Poco X3 NFC (xiaomi brand) with Android 10, i tried to implement ACRA 5.7.0 with no success, it does'nt send any report at all, but in simulator work smoothly, at first thought that Fileprovider had to be implemented as well but that did'nt work too, I'm tryed a lot of thing untill I found this: https://dontkillmyapp.com/ and just did what they recomend and WORKS FINE. This is my report
{"PACKAGE_NAME":"com.redgps.onservice","APP_VERSION_NAME":"1.0","APP_VERSION_CODE":1,"ANDROID_VERSION":"10","PHONE_MODEL":"M2007J20CG","CUSTOM_DATA":{},"STACK_TRACE":"java.lang.RuntimeException: Unable to start activity ComponentInfo{com.redgps.onservice\/com.redgps.onservice.ui.communications.MessagesActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3313)\n\tat android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3462)\n\tat android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)\n\tat android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)\n\tat android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)\n\tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:2049)\n\tat android.os.Handler.dispatchMessage(Handler.java:107)\n\tat android.os.Looper.loop(Looper.java:224)\n\tat android.app.ActivityThread.main(ActivityThread.java:7565)\n\tat java.lang.reflect.Method.invoke(Native Method)\n\tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:539)\n\tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)\nCaused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference\n\tat com.redgps.onservice.ui.communications.MessagesActivity.onCreate(MessagesActivity.java:107)\n\tat android.app.Activity.performCreate(Activity.java:7916)\n\tat android.app.Activity.performCreate(Activity.java:7903)\n\tat android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)\n\tat android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3288)\n\t... 11 more\n","IS_SILENT":false,"USER_CRASH_DATE":"2021-01-18T21:04:56.194-06:00","REPORT_ID":"281d2773-e354-43dc-8d1f-6c8adccb0ad6"}
It seems MIUI does'nt care Developer's Work at all cause they just screw us the way they want. Hope this can be of any help for anyone else.
My Xiaomi Mi 6X is running on Android 9 (MIUI 12), it is rejecting SenderService as well. I managed to do some workaround with custom http sender to Arcarium backend without giving any extra permission. I don't know if the report sending is succeed because I'm running on Android 9 or the custom http sender fixed it. But yeah, as I said, it doesn't work at first on my device when I'm using default http sender, but now it works when I'm using custom http sender.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
As reported in several issues (#786, #800, #801) Xiaomi has changed something in their Android implementation, which breaks ACRA report sending. This issue seems to be limited to Android 10, and isn't reproducible on all Xiaomi devices.
Known Workarounds
As noted in https://github.com/ACRA/acra/issues/786#issuecomment-646497492, some issues with the mail sender can be mitigated by telling users to permit "Display pop-up windows while running in the background".
Possible configurations causing the issue
Using toast configuration (https://github.com/ACRA/acra/issues/801#issuecomment-668006988)disproven by AnkiDroid community (https://github.com/ankidroid/Anki-Android/issues/6802#issuecomment-668640954)Notes
Please refrain from opening other issues related to Xiaomi devices running Android 10. If you have new information, post here.
This issue needs community action: We need to find out in which exact scenario Xiaomi blocks our sender, so we can work around it. Suggestions towards workarounds, solutions or even debugging tips and approaches are welcome and should be posted in this thread.