0

I'm learning some basic OpenGL programming but I can't run the application because it crashes every time I run it with the following error:

01-21 16:22:04.245: E/AndroidRuntime(30137): java.lang.RuntimeException: Unable to start activity component: java.lang.NumberFormatException: Invalid int: "4.0.4"

The Samsung Galaxy SII that I'm runnning it on has android 4.0.4 installed on it and I'm wondering if that's the problem because most of the OpenGL tests I'm trying to run seem to be crashing with a similar error.

Any ideas what's happening?

3
  • Something tries to parse "4.0.4" as an int. Maybe you need to remove the dots, maybe strip everything from the first dot on, maybe something else. Commented Jan 21, 2013 at 22:32
  • You should take a look at stack trace to narrow down the part of code throwing exception. I guess it is somehow related to Android version check, you try to parse Android version "4.0.4" to integer but it's not string representing a valid integer. Commented Jan 22, 2013 at 9:30
  • If that is the case, the parsing must be happening somewhere automatically because I never explicitly do anything with the android Version in this particular Activity Commented Jan 22, 2013 at 19:50

1 Answer 1

2

Wrap your code in

try {
    /// Your code
} catch(NumberFormatException nfe) {
   Log.e("MyApp", nfe.getMessage(), nfe);
}

This will allow you to isolate where the exception is coming from.

4.0.4 is indeed a non-parsable number. You can substring it and compare the numbers that way.

Sign up to request clarification or add additional context in comments.

1 Comment

So I'm having a problem locating where exactly the issue is occurring exactly in my code. The way my program is set up is there is an Activity that has a list of different tests utilizing OpenGL. When the user taps on one of the test names, the program starts up that test as a new Activity. The problem is when debugging, as soon as I try to step into the program after the call to startActivity(newIntent) I get an error saying "Source not Found: The source attachment does not contain the source for the file Activity.class

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.