I get this error -> java.lang.AssertionError: Can't find built-in class kotlin.collections.List
sometimes when I launch my application. This crash sometimes appear and sometimes do not.
My code is
SmartRecyclerAdapter
.items(listItems) // here exception is being thrown
.map(Header::class, CustomEventVH::class)
.map(Appointment::class, UpcomingVH::class)
.add(OnCustomViewEventListener{
startActivity(Intent(requireContext(), ActivityAddAttachment::class.java))
})
.into<SmartRecyclerAdapter>(binding!!.recyclerview)
The error appears at .items(listItems)
Related
Sorry cannot post the source code due to data privacy. Why(what can be the reason) does following type of crash occur. In my case its happening when I come back to the app from tapping on notification.
Logs are as follows:-
java.lang.IllegalStateException: SavedStateRegistry was already restored.
at androidx.savedstate.SavedStateRegistry.performRestore$savedstate_release(SavedStateRegistry.kt:221)
at androidx.savedstate.SavedStateRegistryController.performRestore(SavedStateRegistryController.kt:69) at androidx.fragment.app.FragmentViewLifecycleOwner.performRestore(FragmentViewLifecycleOwner.java:170) at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:693)
at androidx.fragment.app.Fragment.restoreViewState(Fragment.java:3151)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:3142)
at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:579)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:264)
at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:113)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1433)
at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:2977)
at androidx.fragment.app.FragmentManager.dispatchActivityCreated(FragmentManager.java:2895)
at androidx.fragment.app.Fragment.performActivityCreated(Fragment.java:3143)
at androidx.fragment.app.FragmentStateManager.activityCreated(FragmentStateManager.java:579)
at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:264)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1899)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1817)
at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1729)
at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:317)
Tried to debug app but nothing useful found. Tried commenting code from onResume activity but its not causing the this crash.
I am trying to run my app on Android (One plus 6t). This was working fine before making a call to firebase but as soon as I add the line onSend={Fire.shared.send} to Chat.js, the app crashes. The logs just show Uncaught Error: Error calling JSTimers.CallTimers. Haven't seen this error anywhere else. Does anyone know what's the issue?
Here's the snack: https://snack.expo.io/#adititipnis/community
You can get this error if you omit an await call when sending JS objects to the native side, so the promise gets passed rather than the result.
I'm using the typical async sleep pattern that wraps setTimeout, so that may also be a factor in the way this error presents itself, I'm not entirely sure.
This is untested, but something like this should reproduce it:
// some async func
const asyncGetResult = async () => {
await sleep(17);
// etc.
return Promise.resolve(result);
};
// this should cause the error:
MyNativeComponent.nativeMethod({
result: asyncFunc() // <- missing 'await'
});
// this should not cause the error:
MyNativeComponent.nativeMethod({
result: await asyncFunc()
});
This can be difficult to track down if you don't know what you're looking for. I resorted to process of elimination, reverting changes file by file until I found the offending line. Hopefully this saves someone some time.
So some background information. I am tasked with exploring writing cross platform native applications using Xamarin. Seems pretty basic so far and I'm liking what I'm reading. I have my Visual Studio 2015 Enterprise all set up and my remote mac configured on the network. I created a cross platform native app through the project creation wizard in Visual Studio. When I launch a debug session for the iOS app, it does start the target app in the simulator on the remote Mac. However, it never actually thinks it is running fully. It will hang at this output:
Launching 'PersonalProject.iOS' on 'iPhone 6 iOS 10.2'...
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/Xamarin.iOS.dll
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/System.dll
Thread started: #2
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/PersonalProject.iOS.exe
Loaded assembly: /Users/plm/Library/Developer/CoreSimulator/Devices/B5A038B6-056F-4E6C-A59C-29ABD8C04CD0/data/Containers/Bundle/Application/2A1B11FF-6C59-4A9B-9CE3-7B8446B1AD48/PersonalProject.iOS.app/System.Xml.dll
Eventually, it will fail with something along these lines:
The app has been terminated.
Launch failed. The app 'PersonalProject.iOS' could not be launched on 'iPhone 6 iOS 10.2'. Error: An error occurred while executing MTouch. Please check the logs for more details.
I've checked the log file in question and it contains nothing more than the same exact phrase.
If I try and put a simple line of Console writing on the action of pressing the button:
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Perform any additional setup after loading the view, typically from a nib.
Button.AccessibilityIdentifier = "myButton";
Button.TouchUpInside += delegate {
var title = string.Format ("{0} clicks!", count++);
Button.SetTitle (title, UIControlState.Normal);
Console.WriteLine(string.Format("{0} clicks!"));
};
}
the debug session actually errors on this line 17 (UIApplication.Main) in the Main.cs file:
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace PersonalProject.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main (string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main (args, null, "AppDelegate");
}
}
}
With Unhandled exception error:
Unhandled Exception:
System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Error while resolving expression: One or more errors occurred.
If I don't have the console log it will launch the app, but still hanges at those Loaded assembly lines. At this point, I can't hit any breakpoints in my code. I tried adding a breakpoint in the shared code for the button click but it would never hit it, even though the action was being carried out by the simulator.
I'm completely at a loss for how to proceed. I haven't touched anything out of the box of the wizard creation. I was hoping I could at least see the starter project working.
Any help is appreciated.
You are using
Console.WriteLine(string.Format("{0} clicks!"));
The {0} is a placeholder for a value to output, but you never specify that value, that's why you are getting an error.
Use something like this instead:
Console.WriteLine(string.Format("{0} clicks!", count));
or in C#6 syntax:
Console.WriteLine($"{count} clicks!");
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 know some of exceptions are thrown by Android framework. Like ActivityNotFoundException, WindowManager.BadTokenException.
But i am not aware of all other exceptions which are specific to android framework.
Can anybody list possible Android framework specific exceptions with a small description. Or suggest me blogs information which contains the required information.
http://developer.android.com/reference/java/lang/Exception.html
I think here you can find it, "Known Indirect Subclasses", totally 224 exceptions.
Only choose the one started by "Android", here are about 72 exceptions, these should be the list
android.content.ActivityNotFoundException
android.util.AndroidRuntimeException
android.accounts.AuthenticatorException
android.os.BadParcelableException
android.util.Base64DataException
android.hardware.camera2.CameraAccessException
android.database.CursorIndexOutOfBoundsException
android.os.DeadObjectException
android.media.DeniedByServerException
android.support.v4.app.Fragment.InstantiationException
android.opengl.GLException
android.view.InflateException
android.content.IntentFilter.MalformedMimeTypeException
android.content.IntentSender.SendIntentException
android.view.KeyCharacterMap.UnavailableException
android.security.keystore.KeyExpiredException
android.security.keystore.KeyNotYetValidException
android.security.keystore.KeyPermanentlyInvalidatedException
android.util.MalformedJsonException
android.media.MediaCodec.CodecException
android.media.MediaCodec.CryptoException
android.media.MediaDrm.MediaDrmStateException
android.media.MediaDrmResetException
android.accounts.NetworkErrorException
android.os.NetworkOnMainThreadException
android.util.NoSuchPropertyException
android.media.NotProvisionedException
android.support.v4.os.OperationCanceledException
android.content.pm.PackageManager.NameNotFoundException
android.os.ParcelFileDescriptor.FileDescriptorDetachedException
android.os.ParcelFormatException
android.net.ParseException
android.app.PendingIntent.CanceledException
android.support.v8.renderscript.RSDriverException
android.support.v8.renderscript.RSIllegalArgumentException
android.support.v8.renderscript.RSInvalidStateException
android.support.v8.renderscript.RSRuntimeException
android.content.ReceiverCallNotAllowedException
android.os.RemoteException
android.widget.RemoteViews.ActionException
android.media.ResourceBusyException
android.content.res.Resources.NotFoundException
android.database.SQLException
android.database.sqlite.SQLiteAbortException
android.database.sqlite.SQLiteAccessPermException
android.database.sqlite.SQLiteBindOrColumnIndexOutOfRangeException
android.database.sqlite.SQLiteBlobTooBigException
android.database.sqlite.SQLiteCantOpenDatabaseException
android.database.sqlite.SQLiteConstraintException
android.database.sqlite.SQLiteDatabaseCorruptException
android.database.sqlite.SQLiteDatabaseLockedException
android.database.sqlite.SQLiteDatatypeMismatchException
android.database.sqlite.SQLiteDiskIOException
android.database.sqlite.SQLiteDoneException
android.database.sqlite.SQLiteException
android.database.sqlite.SQLiteFullException
android.database.sqlite.SQLiteMisuseException
android.database.sqlite.SQLiteOutOfMemoryException
android.database.sqlite.SQLiteReadOnlyDatabaseException
android.database.sqlite.SQLiteTableLockedException
android.provider.Settings.SettingNotFoundException
android.database.StaleDataException
android.view.Surface.OutOfResourcesException
android.view.SurfaceHolder.BadSurfaceTypeException
android.nfc.TagLostException
android.util.TimeFormatException
android.os.TransactionTooLargeException
android.media.UnsupportedSchemeException
android.security.keystore.UserNotAuthenticatedException
android.view.WindowManager.BadTokenException
android.view.WindowManager.LayoutParams#token
android.view.WindowManager.InvalidDisplayException
The following are the exceptions that are supported by Android:
1.) InflateException : This exception is thrown When an error conditions are occurred.
2.) Surface.OutOfResourceException: This exception is thrown When a surface is not created or resized.
3.) SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS
4.) WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.