Android: Build failed because of `BuildConfig cannot find symbol`

android
#1

Bitrise Build Issue Report template

Description of the issue

Hi

Me and my team are currently using a file only for a specific environment. Therefore, our project structure is like below :

.
+-- app
|   +-- src
|   |   +-- A
|   |   |   +-- com.package.test
|   |   |   |   +-- Test.kt
|   |   +-- B
|   |   +-- main
|   |   |   +-- com.package.test

We have in our gradle file, the following configuration

  buildTypes {
    a {
      //...
      buildConfigField "com.package.test.Test", "test", "new com.package.test.Test()"
    }
  }

When we build our project locally it works fine, but on Bitrise.io, it looks like it couldn’t find the Test.kt file.

Environment:

Bitrise.io only. It works perfectly on local

Step: Gradle Runner and Android Lint
After running the gradle task lintADebug it failed at

Task :app:compileADebugJavaWithJavac

Reproducibility

Just do the same project structure as I have described above

Build log

> Task :app:compileADebugJavaWithJavac
/bitrise/src/app/build/generated/source/buildConfig/.../[REDACTED]/BuildConfig.java:16: error: cannot find symbol
  public static final [REDACTED].Test test = new [REDACTED].Test();
                                                                                                                                                   ^
  symbol:   class Test
  location: package [REDACTED].internal
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error
> Task :app:compileADebugJavaWithJavac FAILED

The only solution we have found is to move the specific file into the main folder. However, we do not want this file to be build on other build variant… Please let me know if you know how to figure it out. Any assistance would be appreciated.

0 Likes

#2

Hi @Yujiro45!

Can you please include an URL to the build so we can check out the whole log?

0 Likes

#3

Hi @bitce
Here is the build log

0 Likes

#4

Hi @bitce
Here is the link of the build for that part

The only solution we have found is to move the specific file into the main folder. However, we do not want this file to be build on other build variant…

build link
Please let us know if you find something.

0 Likes

#5

Thanks!

Is this project passing your lint tests locally? :thinking: Have you modified the default report export path in the project? It’d be great to be able to take a look at the test results and we might need your BuildConfig.java file to investigate this, so our on-site chat is possibly better suited for debugging this problem than a public thread.

0 Likes

#6

Hi @bitce

Thank you for your support.
I will do it in your on-site chat :slight_smile:

1 Like