2

Generic collection:

class B {}
class A extends A {}

List<Class<? extends B>> bs = new ArrayList<Class<? extends B>>();
bs.add(A.class);

Works fine (as expected).

But when i try to use androrm(http://androrm.the-pixelpla.net/) library:

class A extends com.orm.androrm.Model {}
List<Class<? extends com.orm.androrm.Model>> models = new ArrayList<Class<? extends com.orm.androrm.Model>>();
models.add(A.class);

I get a runtime error:

E/AndroidRuntime(2177): java.lang.NoClassDefFoundError: com.my.android.A

I can't understand why?

user1312837
  • 1,268
  • 1
  • 11
  • 29

2 Answers2

1

I think you are not exporting the androrm library with your application on the android emulator.

If you want to use the androrm library at runtime then you should save the androrm library jar in the assets/ folder of your app.

If you are using eclipse then right click on project and go to "Project Properties". You will find a tab called "Build Path". Add the androrm library you are using (in the assets/ folder) under the sub-tab called "Libraries" and make sure to click on export androrm library on sub-tab in "Order and Export" tab.

This should set the "export" flag in the classpath to "true". Now run your app and see if this fixes the error.

sultan.of.swing
  • 1,090
  • 1
  • 12
  • 23
1

if you using ADT 17 or above version

then create folder libs and put all jar in this folder

must see this answer https://stackoverflow.com/a/10046725/1289716

Community
  • 1
  • 1
MAC
  • 15,799
  • 8
  • 54
  • 95