So after looking at the classes.dex it turns out that this library types are not in there. Having in mind that this mean that "that's a problem. :-)" what should be done to fix this problem?

On 26.11.2013 г. 16:14 ч., Jonathan Pryor wrote:
On Nov 26, 2013, at 8:27 AM, Vladimir Dimitrov <vlad.dimit...@gmail.com> wrote:
I am trying to make a jar bindings project that I need in my app.
1. I created a jar binding project.
2. Added the .jar file in the Jars folder.
3. Made it an EmbeddedJar
4. Build the project
5. Referenced the project from another project and added some logic using the 
callable wrappers.

Now when I build the project I see that an assembly is generated with the .jar 
file inside it as a resource.
But when I try to run in debug mode I get a java.lang.NoClassDefFoundError 
exception.
I noticed that if I build an .apk, unzip it and decompile the jar bindings 
assembly, the jar file is no longer in it.
This is by design, and is unrelated to your error.

Android doesn't run Java bytecode, it runs Dalvik bytecode. Consequently, .jar 
files on device are entirely useless, and would only serve to bloat your 
application size for no benefit.

Instead, what should be happening is that the .jar resource is extracted, and 
the .jar is then passed to dx.jar (the Dex compiler) along with all the other 
Java bytecode that makes up the app (compiled Android Callable Wrappers, etc.).

The important part, then, is the `classes.dex` entry within the .apk. The "sanity 
check" is to extract your .apk, run `dexdump classes.dex`, and see if the type 
you're getting a NoClassDefFoundError for is present (or not present) within classes.dex. 
(`dexdump` is located in the Android SDK, e.g. 
$ANDROID_SDK_PATH/build-tools/19.0.0/dexdump.)

Note that dexdump lists types in JNI format, e.g. you'll see 
"L/your/package/name/TypeName;".

If the type is missing from classes.dex, that's a problem. :-)

I would suggest cleaning everything, nuking all bin & obj directories, and 
rebuilding. If that doesn't fix it, please provide the diagnostic build output. In 
particular, you want to find `dx.jar` invocation, and double-check that your 
embedded .jar is listed:

        Tool /usr/bin/java execution started with arguments: -jar 
/opt/android/sdk/platform-tools/lib/dx.jar --no-strict --dex 
--output=obj/Release/android/bin/classes.dex obj/Release/android/bin/classes 
/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-8/mono.android.jar
 obj/Release/__library_projects__/android-support-v4.jar

  - Jon

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

_______________________________________________
Monodroid mailing list
Monodroid@lists.ximian.com

UNSUBSCRIBE INFORMATION:
http://lists.ximian.com/mailman/listinfo/monodroid

Reply via email to