Unable to start activity ProxyBillingActivity, NullPointerException by getIntentSender() - google-play

We are using the latest Google Play billing client com.android.billingclient:billing:4.1.0 as described in https://developer.android.com/google/play/billing/integrate
Sometimes we get this non-reproducible exception in the crash logs, mostly Android 10 devices.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.android.billingclient.api.ProxyBillingActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3654)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3806)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2267)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8154)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.IntentSender android.app.PendingIntent.getIntentSender()' on a null object reference
at com.android.billingclient.api.ProxyBillingActivity.onCreate(com.android.billingclient:billing##4.1.0:12)
at android.app.Activity.performCreate(Activity.java:7963)
at android.app.Activity.performCreate(Activity.java:7952)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3629)
... 11 more
Any ideas how to fix/catch?

Related

How to use Breakpoints in Axon Framework without having the event stream closed

I'm using the AXON Framework a multi-service java spring application.
Everytime i debugg my application and set a breakpoint (e.g. in an Eventhandler method) I recieve the folowing error after a few seconds:
org.axonframework.axonserver.connector.AxonServerException: The Event Stream has been closed, so no further events can be retrieved
at org.axonframework.axonserver.connector.event.axon.EventBuffer.peekNullable(EventBuffer.java:178) ~[axon-server-connector-4.5.2.jar:4.5.2]
at org.axonframework.axonserver.connector.event.axon.EventBuffer.hasNextAvailable(EventBuffer.java:144) ~[axon-server-connector-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor.processBatch(TrackingEventProcessor.java:385) ~[axon-messaging-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor.processingLoop(TrackingEventProcessor.java:292) ~[axon-messaging-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor$TrackingSegmentWorker.run(TrackingEventProcessor.java:1003) ~[axon-messaging-4.5.2.jar:4.5.2]
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:1146) ~[axon-messaging-4.5.2.jar:4.5.2]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: io.grpc.StatusRuntimeException: CANCELLED: RST_STREAM closed stream. HTTP/2 error code: CANCEL
at io.grpc.Status.asRuntimeException(Status.java:535) ~[grpc-api-1.36.1.jar:1.36.1]
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:478) ~[grpc-stub-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:553) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:68) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:739) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:718) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) ~[grpc-core-1.36.1.jar:1.36.1]
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) ~[grpc-core-1.36.1.jar:1.36.1]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
... 1 common frames omitted
Is there any configuration trick, that allows me to use breakpoints without having the event stream closed?
After a lot of try and error I was able to solve this problem with the folowing entries in the AXON-Server's properties file (.../config/axonserver.properties)
axoniq.axonserver.keep-alive-time=0
axoniq.axonserver.keep-alive-timeout=604800000
axoniq.axonserver.min-keep-alive-time=604800000
Thes way the timeout only occures afer one week. This may cause problems in a production environment, but since I use a seperated axon server on my localhost machine for testing this is no problem for me.
This article helped figuring it out: https://docs.axoniq.io/reference-guide/axon-server/administration/admin-configuration/configuration

Calling js method onDestroy failed

I am trying to publish my app, but, Google play Pre-launch report return this Error: View not added to this instance. View: t(73) CurrentParent: t(69) ExpectedParent: t(66). This error was happens multiple times. I did add onDestroy on each of my components.
The app just reproduce a web page from Wordpress. (Client requirement).
I use WebView component to achieve that.
After I apply my changes, the amount error reduced to 1. Now, only happen in Galaxy S9.
Well, at this point I don’t know where can I fix that.
Here the error:
FATAL EXCEPTION: main
Process: org.fcoe.iplan, PID: 26666
java.lang.RuntimeException: Unable to destroy activity {org.fcoe.iplan/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onDestroy failed
Error: View not added to this instance. View: t(73) CurrentParent: t(69) ExpectedParent: t(66)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4603)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:4621)
at android.app.ActivityThread.-wrap5(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1757)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6938)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
Caused by: com.tns.NativeScriptException: Calling js method onDestroy failed
Error: View not added to this instance. View: t(73) CurrentParent: t(69) ExpectedParent: t(66)
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
at com.tns.Runtime.callJSMethod(Runtime.java:1160)
at com.tns.Runtime.callJSMethod(Runtime.java:1138)
at com.tns.Runtime.callJSMethod(Runtime.java:1134)
at com.tns.NativeScriptActivity.onDestroy(NativeScriptActivity.java:39)
at android.app.Activity.performDestroy(Activity.java:7462)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1255)
at androidx.test.runner.MonitoringInstrumentation.callActivityOnDestroy(MonitoringInstrumentation.java:1)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:4590)
... 9 more
My coworker suggest to add StackLayout tag around <page-router-outlet></page-router-outlet> in app.component.html.
I did his suggestion and all works fine in Google Play tests.
Here the code looks like:
<StackLayout>
<page-router-outlet></page-router-outlet>
</StackLayout>

NativeScript error - java.lang.OutOfMemoryError

I'm creating a NativeScript app and testing it on an Android emulator. Unfortunately I can't replicate this, but occasionally I get the error below.
The app follows simple "parent-child" template. Going from the Parent to a Child; back to the Parent and then to a different Child - and repeating multiple times. Each Child displays text and an image.
I'm not sure if this is unique to Android (vs iOS) or an emulator (vs physical device).
An uncaught Exception occurred on "main" thread.
java.lang.OutOfMemoryError: Failed to allocate a 18925068 byte allocation with 11023464 free bytes and 10MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:831)
at android.graphics.Bitmap.createBitmap(Bitmap.java:808)
at android.graphics.Bitmap.createBitmap(Bitmap.java:739)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:615)
at org.nativescript.widgets.image.Fetcher.scaleAndRotateBitmap(Fetcher.java:499)
at org.nativescript.widgets.image.Fetcher.decodeSampledBitmapFromFile(Fetcher.java:474)
at org.nativescript.widgets.image.Fetcher.processBitmap(Fetcher.java:263)
at org.nativescript.widgets.image.Worker.loadImage(Worker.java:119)
at org.nativescript.widgets.ImageView.loadImage(ImageView.java:197)
at org.nativescript.widgets.ImageView.onAttachedToWindow(ImageView.java:58)
at android.view.View.dispatchAttachedToWindow(View.java:14514)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:2843)
at android.view.ViewGroup.addViewInner(ViewGroup.java:4348)
at android.view.ViewGroup.addView(ViewGroup.java:4145)
at android.view.ViewGroup.addView(ViewGroup.java:4086)
at android.view.ViewGroup.addView(ViewGroup.java:4059)
at android.view.ViewOverlay$OverlayViewGroup.add(ViewOverlay.java:190)
at android.view.ViewGroupOverlay.add(ViewGroupOverlay.java:63)
at android.transition.Visibility.onDisappear(Visibility.java:423)
at android.transition.Visibility.createAnimator(Visibility.java:247)
at android.transition.Transition.createAnimators(Transition.java:732)
at android.transition.TransitionSet.createAnimators(TransitionSet.java:405)
at android.transition.Transition.playTransition(Transition.java:1777)
at android.transition.TransitionManager$MultiListener.onPreDraw(TransitionManager.java:306)
at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:944)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2055)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Use decodedWidth / decodedHeight on Image component. Also set the largeHeap property on your application tag of your AndroidManifest.xml
<application
android:largeHeap="true" ....

NativeScript Android Background Service

I am developing NativeScript android application. I am new to NativeScript. I want to run background service, which is checking service periodically and give notifications to user even though app not opened on device. I followed instructions from Nativescript site
https://www.nativescript.org/blog/using-android-background-services-in-nativescript
But when i call setupAlarm function, i received error can't instantiate class com.tns.notifications.NotificationIntentService; no empty constructor
please help me. i give full exception details below
The application crashed because of an uncaught exception. You can look at "stackTrace" or "nativeException" for more detailed information about the exception.
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to instantiate service com.tns.notifications.NotificationIntentService: java.lang.InstantiationException: can't instantiate class com.tns.notifications.NotificationIntentService; no empty constructor
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2543)
at android.app.ActivityThread.access$1800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5001)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.InstantiationException: can't instantiate class com.tns.notifications.NotificationIntentService; no empty constructor
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1208)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2540)
... 10 more
To solve the no empty constructor issue, you can use nativescript-android-utils like this:
Install:
npm install nativescript-android-utils --save
In you code:
com.pip3r4o.android.app.IntentService.extend("com.mypackage.MyClass", {
onHandleIntent: function(){}
});
Now, com.mypackage.MyClass will have an empty constructor.
i found working nativescript android background service project from here
https://github.com/NativeScript/sample-android-background-services
The latest release of Nativescript allows you to use workers for multithreading applications. I believe it's what you should be using. In the tutorial you provided they also mention using web workers in the future.
What’s next
In the upcoming releases we will be rolling out support for the Web
Workers feature in NativeScript, allowing you to execute code in a
background thread, all through Angular/JavaScript.
Hope it helps.

beaconManager give me error when app back from background

I use altbeacon library in my app. Everything work Ok after start, but if i out from app she's in background i get notification on statusbar about beacons. When i click on this notification i get this error:
Process: pl.hekko.kesser.beacontest, PID: 29929
java.lang.RuntimeException: Unable to start activity ComponentInfo{pl.hekko.kesser.beacontest/pl.hekko.kesser.beacontest.MainActivity}: java.lang.UnsupportedOperationException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2202)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
at android.app.ActivityThread.access$800(ActivityThread.java:139)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.UnsupportedOperationException
at java.util.Collections$UnmodifiableCollection.add(Collections.java:928)
at pl.hekko.kesser.beacontest.MainActivity.onCreate(MainActivity.java:83)
at android.app.Activity.performCreate(Activity.java:5275)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2166)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2252)
            at android.app.ActivityThread.access$800(ActivityThread.java:139)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1200)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
My MainActivity line 83:
beaconManager.getBeaconParsers().add(new BeaconParser().
setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
I'm not sure this setBeaconLayout but seems to work fine generally.
Sometimes app doesn't start shows error, but second click on icon starts app. It seems that the same error cause this.
The problem is that you are only allowed to configure the list of active BeaconParsers once, when the library first starts up, so you get an error when you try to do it a second time. While it's easier to do this just once in the onCreate method of a custom Application, you can do this in the onCreate method of an Activity if you wrap it in an if statement like this:
// Only execute the code below if only the default BeaconParser is active
if (beaconManager.getBeaconParsers().size() == 1) {
// Put your BeaconParser setup code here
...
}

Resources