Question

I have problem with my generated dao files. Everything is right in android studio, but after compile I have errors that my classes didn't get found. I found that I need to add source set manually in build.gradle file. If anyone done this before?

This is my fodler structure:

+src
 +main
  +java
  +dao

java is actually a source folder with all packages of application. How to add dao as source folder, that gradle will respect or how to disable gradle build and do this with old way?

Was it helpful?

Solution

You can add a new source set in your build.gradle :

sourceSets {
    main {
        java {
            srcDir 'src/main/dao'
        }
    }
}

More info here : http://tools.android.com/tech-docs/new-build-system/user-guide.

Alternatively, you can also directly generate your GreenDAO models into the existing source set (just make sure to generate them into a non-existing package) : new de.greenrobot.daogenerator.DaoGenerator().generateAll(schema, "./src")

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top