Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not find BuildConfig in a java file #27

Open
marcogalicia25 opened this issue Jul 13, 2018 · 5 comments
Open

Can not find BuildConfig in a java file #27

marcogalicia25 opened this issue Jul 13, 2018 · 5 comments

Comments

@marcogalicia25
Copy link

Can not find BuildConfig in a java file.

plugins {
id 'java'
id 'de.fuerstenau.buildconfig' version '1.1.8'
}

version '0.1'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

test {
useTestNG()
}

buildConfig {
buildConfigField 'String', 'MY_STR_FIELD', '"my message to the app"'
}

dependencies {
compile group: 'org.testng', name: 'testng', version: '6.14.3'
compile group: 'io.appium', name: 'java-client', version: '6.1.0'
}
apply plugin: 'idea'

@adiaholic
Copy link

If anyone has a solution please suggest this problem :(

@marcogalicia25
Copy link
Author

Just run gradle compileBuildConfig in your terminal of course inside the project

@wonsuc
Copy link

wonsuc commented Sep 27, 2019

It's here.

image

@YuriyBergrin
Copy link

I have had this problem too.
Just rebuild your project in IDE.
Build > Rebuild Project

@allanveloso
Copy link

If the problem is that the file was not created, just run gradle compileBuildConfig or build, as other already answered.

If the problem is that the file was created but your IDE is not recognizing it, if your IDE is IntelliJ adding this to your gradle might help:

build.gradle.kts (it's similar in groovy)

plugins {
    ...
    kotlin("jvm") version "1.6.20"
    id("idea")
}

// For Kotlin (similar for Java)
kotlin {
    sourceSets {
        main {
            this.kotlin.srcDir("$buildDir/gen/buildconfig/src/")
        }
    }
}

idea {
    module {
        // Tell idea to mark the folder as generated sources
        generatedSourceDirs.add(File("$buildDir/gen/buildconfig/src/"))
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants