Questions tagged [illegalargumentexception]

An exception that indicates that the arguments supplied to a method or function are not valid for their intended purpose, or are different to the format expected by the method.

An exception that indicates that the arguments supplied to a method or function are not valid for their intended purpose, or are different to the format expected by the method.

This could occur as a result of many different actions, such as...

  1. You are calling a method that accepts a low-level object type for an argument (such as Object) but you're passing an object that is not one of the types expected by the method. For example, the method might be declaring the argument as an Object so that it can capture a range of different objects in the one method, but the code implementation of the method only allows objects of certain types (such as expecting a Number-based object, and you're passing a String).
  2. You're using methods that are building a dynamic structure for use in a different context, and the argument that you're passing is not valid for the other context. For example, you might be building an SQL statement, and you're passing an argument as a String for a database field that expects a Number. The database context would detect the error and report back the exception.

This type of exception may be hard to predict, as it won't be detected at compile-time, and may only show up under certain circumstances.

965 questions
11
votes
3 answers

Hibernate - IllegalArgumentException occurred calling getter of a class

I seem to be getting this error and have no idea why I'm getting this error. I don't even understand why Hibernate needs that getter for the User class because it's not supposed to be doing any actions with that class directly anyway... 2012-12-30…
Arturas M
  • 4,120
  • 18
  • 50
  • 80
10
votes
1 answer

Symbol 'IllegalArgumentException' is inaccessible from here

I have two projects in Android studio: model and app. model is written completely in java, graddle file starts with apply plugin: 'java' app is written in android-java and depends on model. The graddle file starts with apply plugin:…
peer
  • 4,171
  • 8
  • 42
  • 73
10
votes
4 answers

IllegalArgumentException: No such service ComponentInfo{JobIntentService}

SO answers regarding this issue has not helped me, I have declared all permissions and already have, accepted answers in my code. AppInfoJobService(CustomJobIntentService) throws following error on Android OS 8+ devices and it happens rarely, not…
10
votes
3 answers

Host name may not be null in HttpResponse execute for android

I get the error "Target host must not be null, or set in parameters". I DO have Internet permission in my manifest file I have put 'http://' before my Url I DO encode the URL This is my code: String url =…
cafesanu
  • 435
  • 1
  • 4
  • 12
9
votes
2 answers

IllegalArgumentException thrown by requestLocationUpdate()

We recently tested our application against android API level 14 and 15. We started development targeting minimal SKD Version 8 and excluding tablets (3.x). With 2.x everything works well but when running the app on a 4.x droid it crashes at the…
9
votes
1 answer

error - java.lang.IllegalArgumentException: URI scheme is not "file"?

I am receiving the following error when trying to access font file : 011.08.31 12:12:42.704 ERROR [PDFOutputHandler] - Unable to resolve Unicode font java.lang.IllegalArgumentException: URI scheme is not "file" at…
nick
  • 185
  • 2
  • 2
  • 10
9
votes
6 answers

Java reflection question

I am working on a project that uses reflection to get the fields of a running java application. I managed to get the fields, but I can not read or write to them. This is an example I found on the web: Class aClass = MyObject.class Field field =…
Natan Griefwell
  • 91
  • 1
  • 1
  • 4
9
votes
1 answer

Circular Reference with Nested Nav Graphs

I have a complex navigation structure, I go from one nav graph then based on some logic, decide which nav graph to go to there. However both the nav graphs share 3 other nav graphs. See image below Currently I get a circular reference error if I…
9
votes
3 answers

Android IllegalArgumentException for dismissDialog

I have used following code for download some files from our internet. public class SplashDownload extends Activity { public static final int PROGRESS_DIALOG = 0; private ProgressDialog mProgressDialog; private WordDataHelper…
dev_android
  • 8,698
  • 22
  • 91
  • 148
9
votes
3 answers

IllegalArgumentException: Invalid column

Here is the logcat: 01-15 16:06:03.622: ERROR/AndroidRuntime(22300): Uncaught handler: thread main exiting due to uncaught exception 01-15 16:06:03.657: ERROR/AndroidRuntime(22300): java.lang.RuntimeException: Unable to start activity…
9
votes
1 answer

Bad base-64 error

I'm getting a "java.lang.IllegalArgumentException: bad base-64" on the following code: byte[] msgBytes = Base64.decode(msgStr, Base64.NO_WRAP); msgString is a String, and right before this line, I check the value of msgStr and it is "fl-ILw==". Is…
user1118764
  • 9,255
  • 18
  • 61
  • 113
9
votes
5 answers

Google Drive on android error: java.lang.IllegalArgumentException: the name must not be empty: null

I got stuck with an "java.lang.IllegalArgumentException: the name must not be empty: null" Exception on Google Drive Android app. I have been googling several day without getting any clue. This is my code (an easy example) to get a file list on…
MaikoMobile
  • 389
  • 1
  • 4
  • 6
8
votes
3 answers

Fatal Exception: java.lang.IllegalArgumentException: Receiver not registered: android.hardware.camera2.CameraManager

I am developing a flashlight app that switch on/off the system tourch. I have a crash that shown on Android M (v6.0) on Crashlytics Here is the Issue details and stacktrace: Fatal Exception: java.lang.IllegalArgumentException: Receiver not…
8
votes
1 answer

Min target must be less than 14 when WindowManager.LayoutParams.TYPE_KEYGUARD used

I am trying to prevent status bar expansion and I have used some examples where people are trying to override the home button. All solutions point to using WindowManager.LayoutParams.TYPE_KEYGUARD, I read here, that if the TYPE_KEYGUARD is used,…
Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106
8
votes
1 answer

Automated IllegalArgumentException message?

I always check the arguments of public functions and throw exceptions when something's wrong. (For private helpers I use assertions). Like this: if( a < 0 || a >= b ) throw new IllegalArgumentException("'a' must be greater or equal to 0 and …
Dario Seidl
  • 4,140
  • 1
  • 39
  • 55