I am using Vertical ViewPager while using setAdapter i'm checking whether the verticalViewPager and arrayPagerAdapter is Null or not but still i'm getting below Logcat exception on Few Devices but not in all devices.
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Handler android.support.v4.app.FragmentHostCallback.getHandler()' on a null object reference
at android.support.v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1623)
at android.support.v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637)
at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:166)
at com.inheadline.news.view.viewpager.VerticalViewPager.setAdapter(VerticalViewPager.java:278)
at com.inheadline.news.activity.MainActivity.setupViewPager(MainActivity.java:487)
at com.inheadline.news.activity.MainActivity.dataAdded(MainActivity.java:557)
at com.inheadline.news.db.operation.DataSnapshotToDb$AddToDb.onPostExecute(DataSnapshotToDb.java:163)
at com.inheadline.news.db.operation.DataSnapshotToDb$AddToDb.onPostExecute(DataSnapshotToDb.java:138)
at android.os.AsyncTask.finish(AsyncTask.java:679)
at android.os.AsyncTask.access$500(AsyncTask.java:180)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:696)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:5546)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)
Here is my code while setting view pager:
if (verticalViewPager != null && arrayPagerAdapter != null) {
verticalViewPager.setAdapter(arrayPagerAdapter);
verticalViewPager.setSwipable(true);
verticalViewPager.setOnPageChangeListener(pageChangeListener);
}
In above code MainActivity.java:487 is verticalViewPager.setAdapter(arrayPagerAdapter);
This is already a reported bug(report1, report2, report3, report4).
I was myself facing the problem and I moved from 'com.android.support:support-v4:23.1.1' to compile 'com.android.support:support-v4:23.1.0' and that solved the problem for me. So try to rollback the support library version and see if that works for you. Remember to rollback all the android support lib version to 23.1.0.
Related
firebase crash logs one.
Fatal Exception: java.lang.IllegalStateException: CameraDevice was already closed
at android.hardware.camera2.impl.CameraDeviceImpl.checkIfCameraClosedOrInError(CameraDeviceImpl.java:2236)
at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureSessionInternal(CameraDeviceImpl.java:658)
at android.hardware.camera2.impl.CameraDeviceImpl.createCaptureSession(CameraDeviceImpl.java:644)
at io.flutter.plugins.camera.Camera$DefaultCameraDeviceWrapper.createCaptureSession(Camera.java:175)
at io.flutter.plugins.camera.Camera.createCaptureSessionWithSessionConfig(Camera.java:479)
at io.flutter.plugins.camera.Camera.createCaptureSession(Camera.java:465)
at io.flutter.plugins.camera.Camera.createCaptureSession(Camera.java:387)
at io.flutter.plugins.camera.Camera.startPreview(Camera.java:1074)
at io.flutter.plugins.camera.Camera$1.onOpened(Camera.java:322)
at android.hardware.camera2.impl.CameraDeviceImpl$1.run(CameraDeviceImpl.java:151)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:246)
at android.os.HandlerThread.run(HandlerThread.java:67)
firebase crash logs two.
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.camera2.CameraCaptureSession.close()' on a null object reference
at io.flutter.plugins.camera.Camera.closeCaptureSession(Camera.java:1192)
at io.flutter.plugins.camera.Camera.access$500(Camera.java:100)
at io.flutter.plugins.camera.Camera$1.onClosed(Camera.java:342)
at android.hardware.camera2.impl.CameraDeviceImpl$5.run(CameraDeviceImpl.java:255)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:240)
at android.os.Looper.loop(Looper.java:351)
at android.os.HandlerThread.run(HandlerThread.java:67)
two crashes caught in my firebase account.
by investigations, It happened at the camera plugin used in flutter modules,
It's happening on android devices only, versions are 9 to 12 versions.
Used plugin details:
camera: ^0.10.0
https://pub.dev/packages/camera
any one can help with this, ?
I have a strange bug reported on Crashlytics:
Fatal Exception: java.lang.NullPointerException: Attempt to read from null array
at java.util.ArrayList.get(ArrayList.java:310)
at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.g.a(g.java:56)
at com.google.maps.api.android.lib6.gmm6.vector.gl.drawable.ao.a(ao.java:91)
at com.google.maps.api.android.lib6.gmm6.store.fetch.i.a(i.java:99)
at com.google.maps.api.android.lib6.gmm6.store.fetch.f.a(f.java:3)
at com.google.maps.api.android.lib6.gmm6.store.j.a(j.java:19)
at com.google.maps.api.android.lib6.gmm6.store.k.a(k.java:96)
at com.google.maps.api.android.lib6.gmm6.store.k.d(k.java:178)
at com.google.maps.api.android.lib6.gmm6.store.k.a(k.java:31)
at com.google.maps.api.android.lib6.gmm6.store.f.handleMessage(f.java:100)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at com.google.maps.api.android.lib6.gmm6.store.k.run(k.java:126)
at com.google.maps.api.android.lib6.gmm6.store.ab.run(ab.java:12)
It happens only on some devices with Android 5 (Lenovo, Gigabyte, Acer...)
Do you have an idea how to solve this?
In my project i'm using the monetization service(Vungle/AppLovin).
When I'm trying to load an ad, i get this exception
E/AndroidRuntime: FATAL EXCEPTION: GoogleApiHandler
Process: kz.ikar, PID: 3673
java.lang.NoSuchMethodError: No virtual method setChannelId(Ljava/lang/String;)Landroid/support/v4/app/NotificationCompat$Builder; in class Landroid/support/v4/app/NotificationCompat$Builder; or its super classes (declaration of 'android.support.v4.app.NotificationCompat$Builder' appears in /data/app/kz.ikar-2oCl4DY4J8w7wP-jirbYvA==/split_lib_dependencies_apk.apk)
at com.google.android.gms.common.GoogleApiAvailability.zza(Unknown Source:225)
at com.google.android.gms.common.GoogleApiAvailability.zza(Unknown Source:15)
at com.google.android.gms.common.api.internal.zzbm.zzc(Unknown Source:4)
at com.google.android.gms.common.api.internal.zzbo.onConnectionFailed(Unknown Source:104)
at com.google.android.gms.common.api.internal.zzbo.connect(Unknown Source:83)
at com.google.android.gms.common.api.internal.zzbo.zza(Unknown Source:47)
at com.google.android.gms.common.api.internal.zzbm.handleMessage(Unknown Source:283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
In my project I have two fragments in one activity. The user gets an ad in the second one. If I load an ad from the activity, it works well. What can be the cause of this issue?
By the way both ad networks(Vungle and AppLovin) return this exception
I had the same problem and I fixed it downgrading to firebase Google Play services 11.6.0
One reason you could be getting this error is if your buildToolsVersion in your app-level Gradle is less than 26. Either that or your v4 support is less than 26.0.0 seeing as NotificationCompat.Builder was added in API 26.
I encounter this crash after upgrading the support library to 25.3.1 :
Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.lang.ref.WeakReference.get()' on a null object reference
at android.support.v4.media.session.MediaSessionCompat$Callback$StubApi21.onCommand(Unknown Source:941)
at android.support.v4.media.session.MediaSessionCompatApi21$CallbackProxy.onCommand(Unknown Source:164)
at android.media.session.MediaSession$CallbackMessageHandler.handleMessage(MediaSession.java:1363)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:145)
at android.os.HandlerThread.run(HandlerThread.java:61)
This crash only happens to API > 21. It seems that mSessionImpl in MediaSessionCompat.Callback class is null, but I can't find a way where this situation can happen.
Has anyone already experienced this issue ?
The error seems fixed in the 25.4.0
I am trying to use ehcache in my android app. It fails on the first line. So this isn't anything to do with a bad cache configuration. I am planning to configure cache programatically so I do not have any config files. All I did was add ehcache as a dependency and try calling the method below. Using ehcache 2.10.2
CacheManager singletonManager = CacheManager.create();
Stacktrace:
W/System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
W/System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation
W/System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
E/AndroidRuntime: FATAL EXCEPTION: Thread-158
Process: test.app, PID: 7275
java.lang.ExceptionInInitializerError
at net.sf.ehcache.config.Configuration.<init>(Configuration.java:208)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:152)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:103)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:140)
at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:892)
at net.sf.ehcache.CacheManager.create(CacheManager.java:873)
at test.app.MyCache.setup(MyCache.java:20)
Caused by: java.lang.NullPointerException: parentLoader == null && !nullAllowed
at java.lang.ClassLoader.<init>(ClassLoader.java:210)
at java.lang.ClassLoader.<init>(ClassLoader.java:202)
at net.sf.ehcache.EhcacheDefaultClassLoader.<init>(EhcacheDefaultClassLoader.java:35)
at net.sf.ehcache.EhcacheDefaultClassLoader.<clinit>(EhcacheDefaultClassLoader.java:26)
at net.sf.ehcache.config.Configuration.<init>(Configuration.java:208)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:152)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:103)
at net.sf.ehcache.config.ConfigurationFactory.parseConfiguration(ConfigurationFactory.java:140)
at net.sf.ehcache.CacheManager.newInstance(CacheManager.java:892)
at net.sf.ehcache.CacheManager.create(CacheManager.java:873)
at test.app.MyCache.setup(MyCache.java:20)
Try this:
CacheManager singletonManager = CacheManager.getInstance();
Not: create()
EDIT:
You're right. Still the same problem. I tried it
Failed to load class "org.slf4j.impl.StaticLoggerBinder".
This means there was no SLF4J binding.
Placing one (and only one) of slf4j-nop.jar, slf4j-simple.jar, slf4j-log4j12.jar, slf4j-jdk14.jar or logback-classic.jar on the class path should solve the problem
Here's the link.
make sure you only add ONE jar
EDIT 2:
if you want to remove the config warning, add ehcache.xml file. Here's an exmaple:
<defaultCache
maxElementsInMemory="10000"
eternal="false"
timeToIdleSeconds="120"
timeToLiveSeconds="120"
overflowToDisk="true"
maxElementsOnDisk="10000000"
diskPersistent="false"
diskExpiryThreadIntervalSeconds="120"
memoryStoreEvictionPolicy="LRU"
/>
Try it out.