Plugin does not work with library build, error: cannot find symbol Env
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- build-system, mobile
Research direction
Start with library/build.gradle and the dotenv plugin configuration, then run ./gradlew tasks and ./gradlew build to compare the library module's tasks and compilation output. Check whether Env is generated under library/src/main/java/com/example/library and whether the library compile task sees it; done means the library builds with Foo.java resolving Env and the expected dotenv task is present.
Written by the indexing model from the issue text.
Description
I've been using this plugin successfully before, but now I cannot get it to work on a new project.
In this project I am building an Android library that should use dotenv for configuration (in the subfolder library) , as well as a demo application that uses the library (app).
In my library/build.gradle I have:
plugins {
id 'com.android.library'
id 'maven-publish'
id "earth.levi.dotenv-android" version "1.3.0"
}
dotenv {
packageName = "com.example.library"
sourcePath = "src/main/java/"
}
With my main code at ./library/src/main/java/com/example/library/Foo.java, which contains a reference to Env.foo.
In .env, I have:
FOO=bar
In my ./settings.gradle, I have:
// ...
rootProject.name = "library"
include ':app'
include ':library'
Now when I run:
./gradlew build
I get:
> Task :library:compileDebugJavaWithJavac FAILED
/testproject/library/src/main/java/com/example/library/Foo.java:711: error: cannot find symbol
mFoo = Env.foo;
^
symbol: variable Env
location: class Builder
...
FAILURE: Build failed with an exception.
I also do not see any tasks related to dotenv when I run ./gradlew tasks.
Any idea why this would not work?
- Dominant language
- Kotlin
- Stars
- 19
- Forks
- 3
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from levibostian/dotenv-android
-
Gradle 8 supportOpen
Difficulty 4/5 3-5 days Newbie friendliness 25/100
levibostian/dotenv-android#30 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
levibostian/dotenv-android#14 · 3 comments ·
All issues in levibostian/dotenv-android
Similar issues
-
Difficulty 1/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
OpenAPITools/openapi-generator#25454 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
googleads/googleads-mobile-android-mediation#1675 ·
Maintainers usually reply within 2 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
navikt/mock-oauth2-server#1149 ·
Maintainers usually reply within 1 day
-
triaged
Difficulty 1/5 Under an hour Newbie friendliness 65/100
Maintainers usually reply within 1 day