I have a form that I open in a webview in my app, after I complete it, it will appear a button that will let me download a pdf andd open it but when I do this I keep getting the next error:
OneSignal: FusedLocationApi.requestLocationUpdates failed!
java.lang.NullPointerException: Calling thread must be a prepared Looper thread.
at com.google.android.gms.common.internal.Preconditions.checkNotNull(com.google.android.gms:play-services-basement##17.6.0:2)
at com.google.android.gms.internal.location.zzz.requestLocationUpdates(com.google.android.gms:play-services-location##18.0.0:4)
at com.onesignal.GMSLocationController$FusedLocationApiWrapper.requestLocationUpdates(GMSLocationController.java:198)
at com.onesignal.GMSLocationController$LocationUpdateListener.init(GMSLocationController.java:181)
at com.onesignal.GMSLocationController$LocationUpdateListener.<init>(GMSLocationController.java:165)
at com.onesignal.GMSLocationController.onFocusChange(GMSLocationController.java:117)
at com.onesignal.LocationController.onFocusChange(LocationController.java:326)
at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1308)
at com.onesignal.ActivityLifecycleHandler$AppFocusRunnable.run(ActivityLifecycleHandler.java:279)
at java.lang.Thread.run(Thread.java:923)
The button will appear in the webview. I think I get that error because I open the pdf on the main thread.
Related
When I call the startCardPayment function this error pops up
My application gives ANR popup. To find out the reason I have generated a sample.trace file using this line:
Debug.startMethodTracing("sample");
in onCreate method of my activity, and I have added this line to stop tracing to the onDestroy method of the activity:
Debug.stopMethodTracing();
I get the sample.trace file after I destroy the activity. But when I review the file I do not understand it. As I learn there is an online tool which is Perfetto.
However when I open the file in there, it shows blank page while I am expecting some UI.
As a result I need to understand the file and find out the problems that cause the ANR issue but I do not know how to do.
This is a piece of my sample.trace file :
*version
3
data-file-overflow=true
clock=dual
elapsed-time-usec=165959496
num-method-calls=599184
clock-call-overhead-nsec=3338
vm=art
pid=13695
*threads
14436 RxIoScheduler-2
14460 Okio Watchdog
14589 AsyncTask #5
14612 Timer-0
15013 AsyncTask #6
15014 AsyncTask #7
15015 AsyncTask #8
15049 Timer-4
13695 main
13718 Jit thread pool worker thread 0
13724 Signal Catcher
13726 ADB-JDWP Connection Control Thread
13728 FinalizerDaemon
13729 FinalizerWatchdogDaemon
13727 ReferenceQueueDaemon
13730 HeapTaskDaemon
13732 Binder:13695_1
13733 Binder:13695_2
13736 Binder:13695_3
13895 Profile Saver
13909 Queue
13910 Queue
13911 Queue
13912 Queue
13913 Queue
13914 Queue
13916 Queue
13917 Queue
13915 Queue
13936 Answers Events Handler1
13937 queued-work-looper
13941 Crashlytics Exception Handler1
13950 StethoListener-main
13970 OkHttp ConnectionPool
13977 Binder:13695_4
13978 process reaper
13980 process reaper
14016 RenderThread
14023 Binder:13695_5
14026 Binder:13695_6
14021 Thread-16
14152 Thread-17
14153 Thread-18
14156 Studio:InputCon
14165 magnifier pixel copy result handler
14151 Thread-19
14435 RxIoScheduler-1 (Evictor)
14459 OkHttp ConnectionPool
14476 RealmFinalizingDaemon
14480 pool-3-thread-1
14481 pool-3-thread-2
14482 pool-3-thread-3
14483 pool-3-thread-4
14484 pool-3-thread-5
14487 pool-3-thread-6
14489 pool-3-thread-7
14490 pool-3-thread-8
14491 pool-3-thread-9
14602 glide-disk-cache-thread-0
14604 glide-source-thread-0
14614 Timer-1
14615 IntentService[]
14628 glide-source-thread-1
14630 OkHttp ConnectionPool
14633 glide-active-resources
14780 pool-3-thread-10
14788 Picasso-Stats
14789 Picasso-Dispatcher
14790 Picasso-refQueue
14805 Timer-3
14973 SpotScheduleThread
14974 PlaylistScheduleThread
14980 pool-3-thread-11
15000 pool-3-thread-12
15021 RxComputationScheduler-1
15025 RxComputationScheduler-2
15028 OkHttp ConnectionPool
15050 Timer-5
15052 pool-3-thread-13
15053 pool-3-thread-14
15767 pool-3-thread-15
15771 pool-3-thread-16
15772 pool-3-thread-17
*methods
0x18c8 java.lang.BootClassLoader getInstance ()Ljava/lang/BootClassLoader; ClassLoader.java
0x6ba0 java.lang.BootClassLoader findClass (Ljava/lang/String;)Ljava/lang/Class; ClassLoader.java
0x6b9c java.lang.BootClassLoader loadClass (Ljava/lang/String;Z)Ljava/lang/Class; ClassLoader.java
0x7878 java.lang.ClassLoader <init> (Ljava/lang/ClassLoader;)V ClassLoader.java
0x7880 java.lang.ClassLoader <init> (Ljava/lang/Void;Ljava/lang/ClassLoader;)V ClassLoader.java
Thanks in advance.
As I learned I can use Android Studio to see which process is taking more place on cpu and etc.
The only thing that I need to do is opening Profiler window then click the + button and Load from file. Then it will show the statistics of the .trace file.
Thanks!
I am trying to do swipe operation using swipe(direction, duration) method in appium. But swipe method is getting deprecated.And getting exception on console
FAILED: test
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15 milliseconds
This is my code
MobileElement abc = (MobileElement) driver.findElement(By.className("android.widget.FrameLayout"));
abc.swipe(SwipeElementDirection.UP, 6000);
I think swipe() method is not available. PFA screenshot for reference.
1)eclipse screen shot
https://i.stack.imgur.com/PRTdw.png
2)Methods unavailable screen shot
https://i.stack.imgur.com/kzygI.png
swipe() method from driver has been deprecated in the latest versions of Appium. Not only swipe(), even tap(), pinch(), zoom() have also been deprecated.
You would now have to use TouchActions to perform swipe operation. Sample code -
TouchAction touchAction = new TouchAction(driver);
touchAction.press(startX, startY).moveTo(endX, endY).release().perform();
SO users, please read fully then decide to mark the Duplicate for NullPointer exception.
While app launch, from ApplicationExt(extends Application), we initialize the thread in which load the CSV file from Resource bundle(RawSource). It always works on many of the devices. But get crashed on below device for the very first time. For the second time, it gets loaded from the bundle.
OS version : Lollipop (5.1.1)
Device : OnePlus A0001
Crash Log:
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.CharSequence android.content.res.StringBlock.get(int)' on a null object reference
at android.content.res.AssetManager.getResourceValue(AssetManager.java:213)
at android.content.res.Resources.getValue(Resources.java:1334)
at android.content.res.Resources.getValue(Resources.java:1323)
at android.content.res.Resources.openRawResource(Resources.java:1242)
at android.content.res.Resources.openRawResource(Resources.java:1219)
at com.xxxx.yyyy.network.NetworkManager.getBrandCodesFromCsvFile(NetworkManager.java:2961)
at com.xxxx.yyyy.network.NetworkManager.getBrandCodes(NetworkManager.java:3221)
at com.xxxx.yyyy.network.NetworkManager.checkAndUpdateMobileCodeFromBundle(NetworkManager.java:3110)
at com.xxxx.yyyy.OurApplication$1.run(OurApplication.java:132)
at java.lang.Thread.run(Thread.java:818)
Code Snippet:
In Application, onCreate(...),
Create a thread with code of csv load
Run the thread at the end of onCreate -> new Thread(ourThread).start();
Exact crash on this line :
InputStream bundleStream = OurApplicationClass.getContext().getResources().openRawResource(sourceId);
Note:
I've found related issue on Github. https://github.com/osmandapp/Osmand/issues/2575. But unable to confirm whether it's working for my case.
I have an application that requires Facebook login, which I implemented according to the demo example (not using UiLifecycleHelper, though I have tried adding it and it seems to make no difference). Basically when I hit the login button, dismiss the Facebook login web dialog, then hit the button again, I get this exception:
06-10 11:48:48.780: E/AndroidRuntime(6482): java.lang.UnsupportedOperationException: Session: an attempt was made to open an already opened session.
06-10 11:48:48.780: E/AndroidRuntime(6482): at com.facebook.Session.open(Session.java:947)
06-10 11:48:48.780: E/AndroidRuntime(6482): at com.facebook.Session.openForRead(Session.java:385)
06-10 11:48:48.780: E/AndroidRuntime(6482): at com.[my package].SocialAbstractActivity$FacebookClickListener.onClick(SocialAbstractActivity.java:140)
This is caused by this code:
if(!activeSession.isOpened()) {
activeSession.openForRead(getReadOpenRequest());
showProgressDialog(R.string.dialog_logging_title, R.string.dialog_logging_message);
}
Why is activeSession reporting that it's not opened, but then throwing this exception?
Moreover, why do I still get this bug even after calling activeSession.closeAndClearTokenInformation();?