It appears from my crash reports that some people pirate my app and add advertisements to monetise it.
The stack trace from the crash report seems to show a bunch of calls to a library to show interstitials?
Is it possible for me to add code to detect the presence of the com.test.ylh or com.qq.e library?
android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy#da2c866 is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:1126)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:439)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:95)
at android.app.Dialog.show(Dialog.java:473)
at com.qq.e.comm.plugin.intersitial2.e.a(A:315)
at com.qq.e.comm.plugin.intersitial2.e.show(A:113)
at com.qq.e.comm.plugin.intersitial2.e.show(A:107)
at com.qq.e.comm.plugin.intersitial2.d.show(A:35)
at com.qq.e.ads.interstitial2.UnifiedInterstitialAD.show(Unknown Source:4)
at com.test.ylh.InterAd$2.run(InterAd.java:53)
at android.app.Activity.runOnUiThread(Activity.java:6972)
at com.test.ylh.InterAd.showAd(InterAd.java:50)
at com.test.ylh.InterAd.onADReceive(InterAd.java:108)
at com.qq.e.comm.plugin.intersitial2.a$1.run(A:169)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7860)
at java.lang.reflect.Method.invoke(Method.java:-2)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)
You can check if a class exists with a method as described over here: How to check if class exists somewhere in package?
However, they could also remove that check when recompiling the app. So it won't be airtight. You can make it more difficult for the "pirates" by adding proper code obfuscation: https://developer.android.com/studio/build/shrink-code#obfuscate
Related
I create a screenshot application and that work good in all of the android devices.
But I have a problem with take screenshot in android 12 (Xiaomi 11t) I'm using static intent and result code and then clone intent and pass it to this function mediaProjectionManager.getMediaProjection(resultCode,clonedIntent) I have no problem with take screen shot for first time but I can't take screen shot for second time and I get this error.
if you need more info please tell me.
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.koala.classor, PID: 10824
java.lang.NullPointerException: Attempt to invoke interface method 'boolean java.util.Set.add(java.lang.Object)' on a null object reference
at android.os.Parcel.createExceptionOrNull(Parcel.java:2431)
at android.os.Parcel.createException(Parcel.java:2409)
at android.os.Parcel.readException(Parcel.java:2392)
at android.os.Parcel.readException(Parcel.java:2334)
at android.media.projection.IMediaProjection$Stub$Proxy.start(IMediaProjection.java:235)
at android.media.projection.MediaProjection.<init>(MediaProjection.java:59)
at android.media.projection.MediaProjectionManager.getMediaProjection(MediaProjectionManager.java:119)
at com.koala.classor.G.getMediaProjection(G.java:86)
at com.koala.classor.OverScreenWindowService$2$1.run(OverScreenWindowService.java:194)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:210)
at android.os.Looper.loop(Looper.java:299)
at android.app.ActivityThread.main(ActivityThread.java:8105)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)
Caused by: android.os.RemoteException: Remote stack trace:
at com.android.server.media.projection.MediaProjectionManagerService$MediaProjection.start(MediaProjectionManagerService.java:553)
at android.media.projection.IMediaProjection$Stub.onTransact(IMediaProjection.java:137)
at android.os.Binder.execTransactInternal(Binder.java:1182)
at android.os.Binder.execTransact(Binder.java:1146)
MIUI13+Android12
The RemoteException error is reported on line 553 of MediaProjectionManagerService. After checking the source code, the error message is that the package for applying for mediaprojection cannot be found.
It is guessed that MIUI maintains a separate list for this, only the package that has applied for permission will be in it, and it will be removed after obtaining and closing mediaprojection. No such mechanism has been seen in other systems.
In other words, intent data cannot be reused. The solution is also very simple, just don’t close the mediaprojection after using it.
I'm trying to use Samsung sample SimpleHealth for retrieving data from Samsung Health app, but when I give the permission to get StepCount data, I get a weird error:
java.lang.SecurityException: com.samsung.android.simplehealth does not match with registered signature. 4A:E1:B9:8D:04\
at android.os.Parcel.createException(Parcel.java:2074)\
at android.os.Parcel.readException(Parcel.java:2042)\
at android.os.Parcel.readException(Parcel.java:1990)\
at com.samsung.android.sdk.healthdata.IDataResolver$Stub$Proxy.readData2(IDataResolver.java:588)\
at com.samsung.android.sdk.healthdata.HealthDataResolver.read(HealthDataResolver.java:576)\
at com.samsung.android.simplehealth.StepCountReporter.readTodayStepCount(StepCountReporter.java:67)\
at com.samsung.android.simplehealth.StepCountReporter.start(StepCountReporter.java:48)\
at com.samsung.android.simplehealth.MainActivity$1.onConnected(MainActivity.java:72)\
at com.samsung.android.sdk.healthdata.HealthDataStore$ErrorMessageHandler.handleMessage(HealthDataStore.java:593)\
at android.os.Handler.dispatchMessage(Handler.java:107)\
at android.os.Looper.loop(Looper.java:224)\
at android.app.ActivityThread.main(ActivityThread.java:7548)\
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)
Faced same error. You need to add dev access code.
Follow Prerequisites section carefully from this page https://developer.samsung.com/health/android/sample/simple-health.html
I use Flurry through MoPub. I use the MoPub provided adapters for Flurry, so essentially I have zero code of my own for Flurry.
I keep getting these crashes from them on Crashlytics, basically, they are all CalledFromWrongThreadException.
I've never reproduced the issue myself. Flurry claims it must be my code but like I said, I have zero Flurry specific code and I don't get that crash with any other ad network. The stack trace shows it is all within Flurry's code. It isn't clear from the stacktrace whether this is a interstitial crash or a native ad crash.
Is anyone else seeing crashes like this?
Fatal Exception: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
at android.view.ViewRootImpl.checkThread(ViewRootImpl.java:7901)
at android.view.ViewRootImpl.requestLayout(ViewRootImpl.java:1322)
at android.view.View.requestLayout(View.java:21049)
at android.view.View.requestLayout(View.java:21049)
at android.view.View.requestLayout(View.java:21049)
at android.view.View.requestLayout(View.java:21049)
at android.view.View.requestLayout(View.java:21049)
at android.widget.RelativeLayout.requestLayout(RelativeLayout.java:360)
at android.view.View.requestLayout(View.java:21049)
at android.widget.TextView.checkForRelayout(TextView.java:8621)
at android.widget.TextView.setText(TextView.java:5131)
at android.widget.TextView.setText(TextView.java:4956)
at android.widget.TextView.setText(TextView.java:4931)
at com.flurry.sdk.hq$2.run(SourceFile:123)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6776)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1518)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
There is a crash that is showing up repeatedly in Firebase crash reporting for my React Native Android app. However, I am at a loss as to what would be causing it, as the stack trace doesn't cite any of my code. Does anyone know what might be the cause? I am on React Native 0.47.1
The stack trace is as follows:
Exception java.lang.RuntimeException: java.lang.InterruptedException
com.facebook.react.common.futures.SimpleSettableFuture.getOrThrow (SimpleSettableFuture.java:102)
com.facebook.react.bridge.queue.MessageQueueThreadImpl.startNewBackgroundThread (MessageQueueThreadImpl.java:199)
com.facebook.react.bridge.queue.MessageQueueThreadImpl.create (MessageQueueThreadImpl.java:146)
com.facebook.react.bridge.queue.ReactQueueConfigurationImpl.create (ReactQueueConfigurationImpl.java:87)
com.facebook.react.bridge.CatalystInstanceImpl.<init> (CatalystInstanceImpl.java:101)
com.facebook.react.bridge.CatalystInstanceImpl.<init> (CatalystInstanceImpl.java:42)
com.facebook.react.bridge.CatalystInstanceImpl$Builder.build (CatalystInstanceImpl.java:574)
com.facebook.react.ReactInstanceManager.createReactContext (ReactInstanceManager.java:999)
com.facebook.react.ReactInstanceManager.access$600 (ReactInstanceManager.java:109)
com.facebook.react.ReactInstanceManager$4.run (ReactInstanceManager.java:802)
java.lang.Thread.run (Thread.java:761)
Caused by java.lang.InterruptedException:
java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly (AbstractQueuedSynchronizer.java:1301)
java.util.concurrent.CountDownLatch.await (CountDownLatch.java:203)
com.facebook.react.common.futures.SimpleSettableFuture.get (SimpleSettableFuture.java:66)
com.facebook.react.common.futures.SimpleSettableFuture.getOrThrow (SimpleSettableFuture.java:100)
com.facebook.react.bridge.queue.MessageQueueThreadImpl.startNewBackgroundThread (MessageQueueThreadImpl.java:199)
com.facebook.react.bridge.queue.MessageQueueThreadImpl.create (MessageQueueThreadImpl.java:146)
com.facebook.react.bridge.queue.ReactQueueConfigurationImpl.create (ReactQueueConfigurationImpl.java:87)
com.facebook.react.bridge.CatalystInstanceImpl.<init> (CatalystInstanceImpl.java:101)
com.facebook.react.bridge.CatalystInstanceImpl.<init> (CatalystInstanceImpl.java:42)
com.facebook.react.bridge.CatalystInstanceImpl$Builder.build (CatalystInstanceImpl.java:574)
com.facebook.react.ReactInstanceManager.createReactContext (ReactInstanceManager.java:999)
com.facebook.react.ReactInstanceManager.access$600 (ReactInstanceManager.java:109)
com.facebook.react.ReactInstanceManager$4.run (ReactInstanceManager.java:802)
java.lang.Thread.run (Thread.java:761)
This problem also occur for many others as well and the cause is various. You can find the discussion about it here. Since I really don't know what your app does so here is some possible reasons:
You're using react-native-navigation (you can try change it back to react-navigation)
You're using react-native-image-crop-picker or react-native-image-picker (Which produce the same error that make your app crash on some device and it throw InterruptedException
If the problem is number 2 you can try to fix it by alter MainApplication.java:
#Override
public boolean clearHostOnActivityDestroy() {
return false;
}
The fix in number 2 was also reference from here under acintyo answer.
As for changing the react-native version you can try it but I do not recommend it since after reading through the issues mentioned above, I saw that many version also experienced this issues (most of them are 0.49.+ or 0.45.x)
My Android App reported some crash report:
java.lang.NoSuchMethodError: android.app.ANRAppManager.dumpMessageHistory
at android.app.ActivityThread$ApplicationThread.dumpMessageHistory(ActivityThread.java:1177)
at android.app.ApplicationThreadNative.onTransact(ApplicationThreadNative.java:609)
at android.os.Binder.execTransact(Binder.java:351)
at dalvik.system.NativeStart.run(Native Method)
A lot of android device reported the same crash:
Android|Android=>3
android|Coolpad=>1
Android|Lenovo=>1
Android|VIVO=>2
apsl|Lenovo=>1
apsl|Samsung=>2
ARES|AE912=>3
Coolpad|Coolpad=>2
COWW|C920=>5
GoDonie|GoDonie F7=>1
HESM|HSEM TD777=>2
HMI|H2=>1
huawei|huawei=>2
intki|intki_E86=>3
ioco|i9100 X6=>1
Lenovo|Lenovo A820T=>1
MEEG|MEEG_101M=>2
NEWLAND|N003=>2
SAST|SAST YC500=>1
But I didn't find "dumpMessageHistory" in my code, please help, thanks!!
The class android.app.ANRAppManager can not be found in Android Application Framework (/frameworks/base/core/java/android/app). Probably it is a vendor supplied class for MTK chips. Whenever there is an ANR raised, ANRAppManager.dumpMessageHistory would be invoked.
The best advice would be to keep track of all cases of ANR that takes place in your app and try to fix it.