[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Bret Foreman
I looked farther up the logcat from the exception and saw messages
like this:

02-17 16:39:57.841: WARN/dalvikvm(15019): VFY: unable to find class
referenced in signature (Lcom/preferenceshelper/PreferenceHelper;)
02-17 16:39:57.849: ERROR/dalvikvm(15019): Could not find class
'com.preferenceshelper.PreferenceHelper', referenced from method
com.quickdroid.ThreeLevelListActivity.onCreate
02-17 16:39:57.849: WARN/dalvikvm(15019): VFY: unable to resolve new-
instance 108 (Lcom/preferenceshelper/PreferenceHelper;) in Lcom/
quickdroid/ThreeLevelListActivity;


The PreferenceHelper class is inside a PreferencesHelper lib and there
is an import call in ThreeLevelListActivity.java like this:

import com.preferenceshelper.*;

There are similar run-time errors for the other libraries too, but no
build-time errors.

I'll try and rebuild everything from scratch but I'm suspicious the
Android lib stuff just flat out doesn't work in Eclipse.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread TreKing
On Thu, Feb 17, 2011 at 4:05 PM, Bret Foreman wrote:

> I had hoped to avoid that much work. It's about 30 classes moved into 3
> libs. Looks like I have my work cut out for me for the rest of the week...
>

Ouch.


> This Android lib stuff has been flaky and hard to use from the start.
>
 That's why I put it off for as long as I possibly could.
>

I hear you - just set mine up fairly recently. I couldn't even add a library
project as a dependency with the GUI - I had to manually edit my project
file. Then the gen folder wasn't generated. Then things were built out of
order. Then changes in the library weren't picked up in the main project. It
still complains it can't find the APK for libraries, as if there should be
one. Good times.

The developer site sure makes it sound simple though, doesn't it? That's why
I only added 1 class file into each of two libraries I set up - I just don't
trust Eclipse and the Android Tools in general that much, so anything you do
has to be slow and steady. I'm going to add thing to the library slowly over
time, otherwise I'm going to spend more time fighting with the tools than
actually developing. So far so good, but can't wait until I add resources
...

As for you verify error, one thing to try is to comment out everything in
your main Activity except the class declaration itself. If that still
crashes on a VerifyError something's not linking properly with the Android
library itself.

If that's the case, try switching the Library Project to a regular project
(it's just a flag anyway), set up a dummy activity, and try to run that on
it's own. If that runs, then your issue is more likely with the main
project.

Good luck.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread fadden
On Feb 17, 1:46 pm, Bret Foreman  wrote:
> I did a clean rebuild and got the same very uninformative error in the
> logcat. I'll try stepping through the code and see if I can isolate
> the call that's causing it.

Look a few lines above the exception in logcat for some messages with
"VFY" in them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Kostya Vasilyev
You could just create new Eclipse projects (including Androud libraries),
stuffing in the code and resource files you have now. Should take much less
time than doing full refactoring from a monolithic code base all over again.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

18.02.2011 1:06 пользователь "Bret Foreman" 
написал:
>
> Tre,
>
> I had hoped to avoid that much work. It's about 30 classes moved into
> 3 libs. Looks like I have my work cut out for me for the rest of the
> week...
>
> This Android lib stuff has been flaky and hard to use from the start.
> That's why I put it off for as long as I possibly could. But I have no
> choice now, I need to share some code among apps.
>
> On Feb 17, 1:55 pm, TreKing  wrote:
> > On Thu, Feb 17, 2011 at 3:49 PM, Bret Foreman wrote:
> >
> > > My only code changes were to move some classes into libraries and
change
> > > some methods from protected to public. I guess the library setup is
causes
> > > this somehow.
> >
> > I hope your project is under revision control. If so, revert back to
before
> > you set up your projects and just start over with what you have learned.
> > Move *ONE* class, otherwise untouched into the library, build, run and
> > verify everything works. Repeat until you hit the error again or it
> > magically disappears.
> >
> >
-
> > TreKing  - Chicago
> > transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Bret Foreman
Yeah, JARing things up might be my best option. I tried the Android
lib stuff when it first came out and I couldn't get the examples
working. Now I've spent serious time on it and it fails with a
completely useless error message. This is a sign of features that are
not yet ready for prime time. I'll back up and take the JAR approach,
then maybe work on the lib stuff in the next generation of the APK.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Mark Murphy
On Thu, Feb 17, 2011 at 5:05 PM, Bret Foreman  wrote:
> This Android lib stuff has been flaky and hard to use from the start.
> That's why I put it off for as long as I possibly could. But I have no
> choice now, I need to share some code among apps.

Unless that code has accompanying resources, you can just create a
regular project to JAR those classes up.

I haven't run into a VerifyError from Android library project work,
and I've created a fair number of such projects. Then again, I don't
use Eclipse, and perhaps there's something in wiring Android
projects/library projects together in Eclipse that is tripping you up.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 3.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Bret Foreman
Tre,

I had hoped to avoid that much work. It's about 30 classes moved into
3 libs. Looks like I have my work cut out for me for the rest of the
week...

This Android lib stuff has been flaky and hard to use from the start.
That's why I put it off for as long as I possibly could. But I have no
choice now, I need to share some code among apps.

On Feb 17, 1:55 pm, TreKing  wrote:
> On Thu, Feb 17, 2011 at 3:49 PM, Bret Foreman wrote:
>
> > My only code changes were to move some classes into libraries and change
> > some methods from protected to public. I guess the library setup is causes
> > this somehow.
>
> I hope your project is under revision control. If so, revert back to before
> you set up your projects and just start over with what you have learned.
> Move *ONE* class, otherwise untouched into the library, build, run and
> verify everything works. Repeat until you hit the error again or it
> magically disappears.
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread TreKing
On Thu, Feb 17, 2011 at 3:49 PM, Bret Foreman wrote:

> My only code changes were to move some classes into libraries and change
> some methods from protected to public. I guess the library setup is causes
> this somehow.
>

I hope your project is under revision control. If so, revert back to before
you set up your projects and just start over with what you have learned.
Move *ONE* class, otherwise untouched into the library, build, run and
verify everything works. Repeat until you hit the error again or it
magically disappears.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Bret Foreman
Well, the error occurs before OnCreate so it's somewhere in the
framework. My only code changes were to move some classes into
libraries and change some methods from protected to public. I guess
the library setup is causes this somehow.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Bret Foreman
I did a clean rebuild and got the same very uninformative error in the
logcat. I'll try stepping through the code and see if I can isolate
the call that's causing it.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: What causes a java.lang.VerifyError?

2011-02-17 Thread Bret Foreman
Maybe this is a clue. When I install the apk I get a set of error
messages from adb that say: "Could not find libname.apk" for each of
my libraries. Why would the installer be looking for apk files for
library projects?

On Feb 17, 12:58 pm, Mark Murphy  wrote:
> VerifyError has a few different causes, mostly stemming from a bad set
> of bytecode -- something existed at compile time that does not exist
> at run time.
>
>
>
> On Thu, Feb 17, 2011 at 3:52 PM, Bret Foreman  wrote:
> > After reorganizing my project and moving some code into library
> > projects, I now see the logcat below. Any idea why this might happen?
>
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):
> > java.lang.VerifyError: com.quickdroid.ThreeLevelListActivity
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > java.lang.Class.newInstanceImpl(Native Method)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > java.lang.Class.newInstance(Class.java:1429)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.app.Instrumentation.newActivity(Instrumentation.java:1021)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
> > 2577)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
> > 2679)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.app.ActivityThread.access$2300(ActivityThread.java:125)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.os.Looper.loop(Looper.java:123)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > android.app.ActivityThread.main(ActivityThread.java:4627)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > java.lang.reflect.Method.invokeNative(Native Method)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > java.lang.reflect.Method.invoke(Method.java:521)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > com.android.internal.os.ZygoteInit
> > $MethodAndArgsCaller.run(ZygoteInit.java:858)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
> > 02-17 12:47:30.668: ERROR/AndroidRuntime(12179):     at
> > dalvik.system.NativeStart.main(Native Method)
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 3.1 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en