Facing an issue if i make any changes in the code ...
# community-support
a
Facing an issue if i make any changes in the code and run the code it's not reflecting, and i'm facing this issue from 1-2 before Current Gradle version is 8.9 Android Gradel Plugin Version 8.7.2 Android Studio Android Studio Ladybug | 2024.2.1 Patch 2 In past 2 days, we have implemented benchmark and created build flavour For Example current PROD_DOMAIN which is selected here is PROD_DOMAIN=https://preprod1.com and when I run it runs with https://prod.com as initially https://prod.com was selected, now if I remove
Copy code
rm -rf app/build/
rm -rf .gradle/
rm -rf buildSrc/.gradle/
rm -rf buildSrc/build/
then this will work fine. In the gradle there are few caching which has been enabled
Copy code
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# <http://www.gradle.org/docs/current/userguide/build_environment.html>
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.daemon=true
org.gradle.jvmargs=-Xmx8g -XX:+UseParallelGC -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.unsafe.configuration-cache=true
org.gradle.unsafe.configuration-cache-problems=warn
org.gradle.vfs.watch=true
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.problems=warn
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# <http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects>
org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# <https://developer.android.com/topic/libraries/support-library/androidx-rn>
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
android.enableR8.fullMode=true
kapt.incremental.apt=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false```
Shared gradle --scan log as well Please let me know if you need more info
j
Where do you set that
PROD_DOMAIN
?
a
in gradle.properties files
v
Shared gradle --scan log as well
The important things to share with
--scan
is the Build Scan URL. 😉 But besides that, it is virtually impossible to say what the problem might be without the build at hand. For example where and how is
PROD_DOMAIN
read and then used? Is it maybe used in some way where it is not recognized as build input and thus the task is up-to-date or coming from cache? It also happened to colleagues of me a few times that Gradle got somehow confused and thought tasks were up-to-date while they were not and deleting
build
just worked as temporary measure and I ended up deleting for those the whole
~/.gradle/
(except for manually created things like init scripts or
gradle.properties
) and
<root project>/.gradle/
as I did not have the time to investigate what is corrupted where.
a
v
Thanks, but most of what I said stays unchanged 🙂
j
did you restart the daemon after changing
gradle.properties
?
v
Why should that be relevant?
And if it is, it is a bug somewhere, most probably in some build logic that uses some static state somewhere
j
not sure it re-reads what's in there
a
it's not because of the prod_domain, If i make any changes in the code and then try to run it won't reflect untill and unless i remove the files like
Copy code
rm -rf app/build/ 
rm -rf .gradle/ r
m -rf buildSrc/.gradle/ 
rm -rf buildSrc/build/
v
not sure it re-reads what's in there
Of course it does, would be pretty strange and a critical bug if not.
it's not because of the prod_domain, If i make any changes in the code and then try to run it won't reflect untill and unless i remove the files like
Sounds like the bug I mentioned I sometimes have seen appearing. If you can reliably reproduce, by all means, report it and make the Gradle folks fix it, I get this occasionally since many years and versions. As a work-around fix, as I said, delete all the non-manual things from
GRADLE_USER_HOME
. At least if it is the same issue that should help as duct-tape solution.
j
anyway the build scan says 0 previous builds, 0 cache hits ...
a
@Vampire Is there any other channel so that gradle folks will know about it ?
j
the build scan you shared, that was recorded just after you deleted the caches, or just after you made the changes that don't appear when you run your app?
a
make the changes and they don't appear
v
@Vampire Is there any other channel so that gradle folks will know about it ?
This is a community Slack, Gradle folks can happen to read things here, but there is no guarantee, especially not that the appropriate person reads it. For bugs, I'd recommend you open a bug issue on GitHub as usual.
a
Ok thanks
j
maybe try to find out which binary you are executing right after your build, put a build timestamp or something in it and confirm you are running a rebuilt binary before looking for gradle bugs not that they don't exist ^ ^ but it's likely to be something else there