Search code examples
javaandroiddbflow

how to set prefix to GeneratedDatabaseHolder.java class in dbflow in android studio 3


in android studio 2.3.3 when useing dbflow in a module you can add a prefix to GeneratedDatabaseHolder class like this

apt {
     arguments {
          targetModuleName 'PreFixTitle'
     }
}

but in android studio 3 we cannot use apt right so how can I add prefix to that class ?


Solution

  • I have this problem today! I solve this problem in this way:

    android {
        compileSdkVersion rootProject.ext.compileSdkVersion
        buildToolsVersion rootProject.ext.buildToolsVersion
        defaultConfig {
            // ...
            android.compileOptions.sourceCompatibility 1.8
            android.compileOptions.targetCompatibility 1.8
            javaCompileOptions {
                annotationProcessorOptions {
                    arguments = [ targetModuleName : 'Ship' ]
                }
            }
    
        }
    }
    

    my project Build.gradle:

    buildscript {
    
        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.0.0'
        }
        allprojects {
            repositories {
                google()
                jcenter()
                maven { url "https://jitpack.io" } 
            }
        }
        task clean(type: Delete) {
            delete rootProject.buildDir
        }
    }
    

    my demo