Hi Jon,
>On a more serious note, what is the stack trace for the
NpClassDefFoundError? My _guess_ is that you're somehow using a
non-Java.Lang.Object subclass in a call to JNIEnv.FindClass(Type), and
mandroid >only generates Android Callable Wrappers for Java.Lang.Object
subclasses. For example, the following should result in a
NoClassDefFoundError:
>
> IntPtr c = JNIEnv.FindClass(typeof(List<>)); // or some other
type
>
>A stack trace would help diagnose this and determine what's calling
JNIEnv.FindClass().
Below there's error's stack trace. The class throwing is a custom class
deriving from Android.App.Activity.
+ Instance {Java.Lang.NoClassDefFoundError: Exception
of type 'Java.Lang.NoClassDefFoundError' was thrown.
at Android.Runtime.JNIEnv.FindClass (System.String classname) [0x00066] in
/home/jpobst/Desktop/mondroid/Mono.Android/src/Runtime/JNIEnv.cs:159
at Android.Runtime.JNIEnv.FindClass (System.Type type) [0x00000] in
/home/jpobst/Desktop/mondroid/Mono.Android/src/Runtime/JNIEnv.cs:126
--- End of managed exception stack trace ---
java.lang.NoClassDefFoundError: steema.teechart.TChart
at monodroiddemo.ActivityGroup1.n_onCreate(Native Method)
at monodroiddemo.ActivityGroup1.onCreate(ActivityGroup1.java:32)
at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.access$2500(ActivityThread.java:129)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:2117)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:8
60)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: steema.teechart.TChart in
loader
dalvik.system.PathClassLoader[/data/app/MonoDroidDemo.MonoDroidDemo-1.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
... 15 more
} Java.Lang.NoClassDefFoundError
>If this is the issue, the fix is to either (1) Don't Do That, or (2) change
the type that's being passed to JNIEnv.FindClass() so that it has
Java.Lang.Object as a base class.
I'm considering changing the base type for Steema.TeeChart.TChart to
Android.App.Application according to what Andrew Sinclar suggested in the
"Getting objects from an intent" thread. I'm afraid Andrew Sinclair's
suggestion may not help with the NoClassDefFoundError though.
To put this in context, initially the main control at Steema.TeeChart.TChart
derived from ImageView. This worked pretty well for zooming it as an static
image. We are now working on implementing more "intelligent" zooming so an
ImageView is not enough for that. We need a static area at the background
for plotting chart title, legend, axes, etc.; and a dynamic
zoomable/scrollable area on top of it to plot chart series. I found that
adding an ImageView into a GridView for layout purposes made the ImageView
zooming/scrolling very slow. I found that adding the ImageView to an
Activity made it perform the same way it did on its own. Also, when a TChart
component has been added to an activity the programmer would need to access
its properties programmatically, here's where "Getting objects from an
intent" thread comes from. Do you think I'm in the correct way for doing
that?
Thanks in advance.
Best Regards,
Narcís Calvet
Steema Software
http://www.steema.com
http://twitter.com/SteemaSoftware
https://www.facebook.com/SteemaSoftware
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jonathan Pryor
Sent: dimarts, 19 / juliol / 2011 17:55
To: Discussions related to Mono for Android
Subject: Re: [mono-android] Unable to find library
On Jul 19, 2011, at 9:57 AM, Narcís Calvet wrote:
> Re.: If that is the problem, the solution is to add an assembly reference
in
> your project to Steema.TeeChart.TChart.dll, so that mandroid can find it.
If
> that isn't the solution, I'm afraid that you'll need to file a bug report,
> attaching your project, so that I can investigate further. :-(
>
> I have a reference to that assembly in the project references section.
Given
> the problem is NoClassDefFoundError again what do you suggest. Should I
send
> something that you can run to reproduce the problem at your end?
I think it means that JNIEnv.FindClass(Type) needs more error checking. :-)
On a more serious note, what is the stack trace for the
NpClassDefFoundError? My _guess_ is that you're somehow using a
non-Java.Lang.Object subclass in a call to JNIEnv.FindClass(Type), and
mandroid only generates Android Callable Wrappers for Java.Lang.Object
subclasses. For example, the following should result in a
NoClassDefFoundError:
IntPtr c = JNIEnv.FindClass(typeof(List<>)); // or some other
type
A stack trace would help diagnose this and determine what's calling
JNIEnv.FindClass().
If this is the issue, the fix is to either (1) Don't Do That, or (2) change
the type that's being passed to JNIEnv.FindClass() so that it has
Java.Lang.Object as a base class.
- Jon
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid
_______________________________________________
Monodroid mailing list
[email protected]
UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid