{"action":"created","issue":{"url":"https://api.github.com/repos/greenrobot/greenDAO/issues/266","labels_url":"https://api.github.com/repos/greenrobot/greenDAO/issues/266/labels{/name}","comments_url":"https://api.github.com/repos/greenrobot/greenDAO/issues/266/comments","events_url":"https://api.github.com/repos/greenrobot/greenDAO/issues/266/events","html_url":"https://github.com/greenrobot/greenDAO/issues/266","id":119506965,"number":266,"title":"NoClassDefFoundError on DaoObject","user":{"login":"leberrm","id":13287503,"avatar_url":"https://avatars.githubusercontent.com/u/13287503?v=3","gravatar_id":"","url":"https://api.github.com/users/leberrm","html_url":"https://github.com/leberrm","followers_url":"https://api.github.com/users/leberrm/followers","following_url":"https://api.github.com/users/leberrm/following{/other_user}","gists_url":"https://api.github.com/users/leberrm/gists{/gist_id}","starred_url":"https://api.github.com/users/leberrm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leberrm/subscriptions","organizations_url":"https://api.github.com/users/leberrm/orgs","repos_url":"https://api.github.com/users/leberrm/repos","events_url":"https://api.github.com/users/leberrm/events{/privacy}","received_events_url":"https://api.github.com/users/leberrm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/greenrobot/greenDAO/labels/More%20info%20required","name":"More info required","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-11-30T14:47:55Z","updated_at":"2015-12-23T10:27:03Z","closed_at":null,"body":"I'm working on an Android app that has been created initially by someone else. This app is using GreenDao 2.0.0 to store objects from the API. Everything works fine on some devices (like Nexus 5) but for some reasons, it's not working on my Android 4.2 and 4.4 devices. The code compiles but when I want to launch my app it crashes and I get the following error :\r\n\r\n11-04 16:26:35.951 6614-6614/com.myeggbox E/AndroidRuntime: FATAL EXCEPTION: main 11-04 16:26:35.951 6614-6614/com.myeggbox E/AndroidRuntime: Process: com.myeggbox, PID: 6614 **11-04 16:26:35.951 6614-6614/com.myeggbox E/AndroidRuntime: java.lang.NoClassDefFoundError: com.myeggbox.api.data.entity.AddressDao\r\n\r\nI never used GreenDao before so I'm lost, if someone has any idea ... In my build.gradle the targetSdk is 22 and the minSdkVersion is 16. This is my EntityGenerator.java:\r\n\r\npackage com.entityGenerator;\r\n\r\nimport de.greenrobot.daogenerator.DaoGenerator;\r\nimport de.greenrobot.daogenerator.Entity;\r\nimport de.greenrobot.daogenerator.Property;\r\nimport de.greenrobot.daogenerator.Schema;\r\n\r\npublic class EntityGenerator {\r\n    private static Entity product;\r\n    private static Entity egg;\r\n    private static Entity category;\r\n    private static Entity store;\r\n    private static Entity document;\r\n    private static Entity code;\r\n    private static Entity brand;\r\n    private static Entity service;\r\n    private static Entity address;\r\n    private static Entity review;\r\n    private static Entity user;\r\n\r\n    public static void main(String[] args) throws Exception {\r\n        Schema schema = new Schema(4, \"com.tymate.myeggbox.api.data.entity\");\r\n        schema.enableKeepSectionsByDefault();\r\n\r\n        createEntities(schema);\r\n        mapEntities();\r\n        addRelationShip();\r\n\r\n        new DaoGenerator().generateAll(schema, \"../app/src/main/java/\");\r\n    }\r\n\r\n    private static void createEntities(final Schema schema) {\r\n        address = schema.addEntity(\"Address\");\r\n        brand = schema.addEntity(\"Brand\");\r\n        category = schema.addEntity(\"Category\");\r\n        code = schema.addEntity(\"Code\");\r\n        document = schema.addEntity(\"Document\");\r\n        egg = schema.addEntity(\"Egg\");\r\n        product = schema.addEntity(\"Product\");\r\n        review = schema.addEntity(\"Review\");\r\n        service = schema.addEntity(\"Service\");\r\n        user = schema.addEntity(\"User\");\r\n        store = schema.addEntity(\"Store\");\r\n    }\r\n\r\n    private static void mapEntities() {\r\n        addEgg();\r\n        addCategory();\r\n        addCode();\r\n        addDocument();\r\n        addProduct();\r\n        addStore();\r\n        addBrand();\r\n        addService();\r\n        addAddress();\r\n        addReview();\r\n        addUser();\r\n    }\r\n\r\n    private static void addRelationShip() {\r\n        //egg <-> user\r\n        Property egg_user_id = egg.addLongProperty(\"user_id\").getProperty();\r\n        egg.addToOne(user, egg_user_id).setName(\"userDb\");//liaison vers l'utilisateur\r\n        user.addToMany(egg, egg_user_id).setName(\"eggListDb\");//liaison inverse\r\n\r\n        //egg <-> product\r\n        Property egg_product_id = egg.addLongProperty(\"product_id\").getProperty();\r\n        egg.addToOne(product, egg_product_id).setName(\"productDb\");//liaison vers le product\r\n        product.addToMany(egg, egg_product_id).setName(\"eggListDb\");//liaison inverse\r\n\r\n        //code <-> egg\r\n        Property code_egg_id = code.addLongProperty(\"egg_id_db\").getProperty();\r\n        code.addToOne(egg, code_egg_id).setName(\"eggDb\");//liaison du code vers l'egg\r\n        egg.addToMany(code, code_egg_id).setName(\"codeListDb\");//liaison inverse\r\n\r\n        //code <-> user\r\n        Property code_user_id = code.addLongProperty(\"user_id\").getProperty();\r\n        code.addToOne(user, code_user_id).setName(\"userDb\");\r\n        user.addToMany(code, code_user_id).setName(\"codeListDb\");\r\n\r\n        //documents <-> egg\r\n        Property doc_egg_id = document.addLongProperty(\"egg_id\").getProperty();\r\n        document.addToOne(egg, doc_egg_id).setName(\"eggDb\");//liaison vers l'egg\r\n        egg.addToMany(document, doc_egg_id).setName(\"documentListDb\");//liaison inverse\r\n\r\n        //egg <-> store\r\n        Property egg_store_id = egg.addLongProperty(\"store_id\").getProperty();\r\n        egg.addToOne(store, egg_store_id).setName(\"storeDb\");//relation vers l'egg\r\n        store.addToMany(egg, egg_store_id).setName(\"eggListDb\");//relation inverse\r\n\r\n        //product <-> brand\r\n        Property product_brand_id = product.addLongProperty(\"brand_id\").getProperty();\r\n        product.addToOne(brand, product_brand_id).setName(\"brandDb\");//liaison vers le product\r\n        brand.addToMany(product, product_brand_id).setName(\"productListDb\");//liaison inverse\r\n\r\n        //product <-> category\r\n        Property product_category_id = product.addLongProperty(\"category_id\").getProperty();\r\n        product.addToOne(category, product_category_id).setName(\"categoryDb\");//liaison vers la category\r\n        category.addToMany(product, product_category_id).setName(\"productListDb\");//liaison inverse\r\n\r\n        //service <-> egg\r\n        Property service_egg_id = service.addLongProperty(\"egg_local_id\").getProperty();\r\n        service.addToOne(egg, service_egg_id);//relation vers l'egg\r\n        egg.addToMany(service, service_egg_id).setName(\"serviceListDb\");//relation inverse\r\n\r\n        //review <-> product\r\n        Property review_product_id = review.addLongProperty(\"product_id\").getProperty();\r\n        review.addToOne(product, review_product_id).setName(\"productDB\");//liaison vers le product\r\n        product.addToMany(review, review_product_id).setName(\"reviewListDb\");//liaison inverse\r\n\r\n        //address <-> user\r\n        Property address_user_id = address.addLongProperty(\"user_id\").getProperty();\r\n        address.addToOne(user, address_user_id).setName(\"userDB\");//liaison vers le user\r\n        user.addToMany(address, address_user_id).setName(\"addressListDb\");//liaison inverse\r\n    }\r\n\r\n    private static void addEgg() {\r\n        egg.implementsInterface(\"Serializable\", \"Comparable<Egg>\");\r\n        egg.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        egg.addStringProperty(\"buying_date\");\r\n        egg.addLongProperty(\"id\");\r\n        egg.addStringProperty(\"picture\");\r\n        egg.addIntProperty(\"warranty_duration\");\r\n        egg.addStringProperty(\"created_at\");\r\n        egg.addStringProperty(\"localPicture\");\r\n    }\r\n\r\n    private static void addCode() {\r\n        code.implementsInterface(\"Serializable\");\r\n        code.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        code.addLongProperty(\"id\");\r\n        code.addStringProperty(\"digest\");\r\n    }\r\n\r\n    private static void addDocument() {\r\n        document.implementsInterface(\"Serializable\");\r\n        document.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        document.addStringProperty(\"content\");\r\n        document.addStringProperty(\"created_at\");\r\n        document.addLongProperty(\"id\");\r\n        document.addStringProperty(\"picture\");\r\n        document.addStringProperty(\"preview\");\r\n        document.addStringProperty(\"title\");\r\n        document.addStringProperty(\"UUID\");\r\n        document.addStringProperty(\"updated_at\");\r\n        document.addStringProperty(\"localPath\");\r\n        document.addStringProperty(\"type\");\r\n    }\r\n\r\n    private static void addStore() {\r\n        store.implementsInterface(\"Serializable\");\r\n        store.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        store.addLongProperty(\"id\");\r\n        store.addStringProperty(\"name\");\r\n        store.addStringProperty(\"phone\");\r\n        store.addStringProperty(\"email\");\r\n        store.addStringProperty(\"website\");\r\n        store.addStringProperty(\"street_name\");\r\n        store.addStringProperty(\"city\");\r\n        store.addStringProperty(\"zip_code\");\r\n        store.addStringProperty(\"country\");\r\n        store.addStringProperty(\"facebook_url\");\r\n        store.addStringProperty(\"logo\");\r\n        store.addStringProperty(\"latitude\");\r\n        store.addStringProperty(\"longitude\");\r\n    }\r\n\r\n    private static void addProduct() {\r\n        product.implementsInterface(\"Serializable\");\r\n        product.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        product.addLongProperty(\"id\");\r\n        product.addStringProperty(\"name\");\r\n        product.addStringProperty(\"picture\");\r\n        product.addStringProperty(\"ean\");\r\n    }\r\n\r\n    private static void addBrand() {\r\n        brand.implementsInterface(\"Serializable\");\r\n        brand.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        brand.addLongProperty(\"id\");\r\n        brand.addStringProperty(\"name\");\r\n    }\r\n\r\n    private static void addCategory() {\r\n        category.implementsInterface(\"Serializable\");\r\n        category.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        category.addLongProperty(\"id\");\r\n        category.addStringProperty(\"image\");\r\n        category.addStringProperty(\"name\");\r\n    }\r\n\r\n    private static void addService() {\r\n        service.implementsInterface(\"Serializable\");\r\n        service.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        service.addLongProperty(\"id\");\r\n        service.addStringProperty(\"kind\");\r\n        service.addStringProperty(\"phone\");\r\n        service.addStringProperty(\"title\");\r\n        service.addStringProperty(\"web_url\");\r\n        service.addStringProperty(\"local_path\");\r\n    }\r\n\r\n    private static void addUser() {\r\n        user.implementsInterface(\"Serializable\");\r\n        user.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        user.addStringProperty(\"id\");\r\n        user.addStringProperty(\"email\");\r\n        user.addStringProperty(\"authentication_token\");\r\n    }\r\n\r\n    private static void addAddress() {\r\n        address.implementsInterface(\"Serializable\");\r\n        address.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        address.addStringProperty(\"city\");\r\n        address.addStringProperty(\"country\");\r\n        address.addStringProperty(\"firstname\");\r\n        address.addLongProperty(\"id\");\r\n        address.addStringProperty(\"lastname\");\r\n        address.addStringProperty(\"street_name\");\r\n        address.addStringProperty(\"zip_code\");\r\n    }\r\n\r\n    private static void addReview() {\r\n        review.implementsInterface(\"Serializable\");\r\n        review.addLongProperty(\"localId\").primaryKey().autoincrement();\r\n        review.addStringProperty(\"content\");\r\n        review.addStringProperty(\"created_at\");\r\n        review.addLongProperty(\"id\");\r\n        review.addStringProperty(\"locale\");\r\n        review.addIntProperty(\"rate\");\r\n        review.addStringProperty(\"title\");\r\n        review.addStringProperty(\"upload_at\");\r\n        review.addIntProperty(\"user_id\");\r\n    }\r\n\r\n}\r\n\r\nThanks for your help !"},"comment":{"url":"https://api.github.com/repos/greenrobot/greenDAO/issues/comments/166856695","html_url":"https://github.com/greenrobot/greenDAO/issues/266#issuecomment-166856695","issue_url":"https://api.github.com/repos/greenrobot/greenDAO/issues/266","id":166856695,"user":{"login":"gonzapico","id":2582927,"avatar_url":"https://avatars.githubusercontent.com/u/2582927?v=3","gravatar_id":"","url":"https://api.github.com/users/gonzapico","html_url":"https://github.com/gonzapico","followers_url":"https://api.github.com/users/gonzapico/followers","following_url":"https://api.github.com/users/gonzapico/following{/other_user}","gists_url":"https://api.github.com/users/gonzapico/gists{/gist_id}","starred_url":"https://api.github.com/users/gonzapico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gonzapico/subscriptions","organizations_url":"https://api.github.com/users/gonzapico/orgs","repos_url":"https://api.github.com/users/gonzapico/repos","events_url":"https://api.github.com/users/gonzapico/events{/privacy}","received_events_url":"https://api.github.com/users/gonzapico/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T10:27:03Z","updated_at":"2015-12-23T10:27:03Z","body":"In my case, it happens when DAO tries to create a table if it doesn't exist with the method:\r\nListaDBDao.createTable(db, ifNotExists);\r\n\r\npublic class ListaDBDao extends AbstractDao<ListDB, Long> {\r\n\r\npublic class ListaDB implements Parcelable {\r\n\r\nI think the trouble it is becuase of the db class implements Parcelable. I say this because the method createAllTables(SQLiteDatabase db, boolean ifNotExists) starts like this..\r\n\r\n public static void createAllTables(SQLiteDatabase db, boolean ifNotExists) {\r\n        TiendaDBDao.createTable(db, ifNotExists);\r\n        LisatDBDao.createTable(db, ifNotExists);\r\n.. and it doesn't crash on the first line (and TiendaDB doesn't implement Parcelable).\r\n\r\nI hope this helps to you! ;)"}}