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?

Était-ce utile?

La 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")

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top