hi there, we use gradle to build our android projects and have recently upgraded from android NDK r21e to r23c and are seeing problems with gradle not outputting STDOUT compared to the older gradle/NDK versions
i’ve upgraded our gradle to 7.4 and the plugin to 7.3 per the documentation here Install and configure the NDK and CMake | Android Studio | Android Developers and the projects build with no issues, but previously with android ndk r21e and gradle 5.1.1 we were receiving a ton of STDOUT from gradle about how our project is being built which is very important that no longer appears after upgrading,
one curious thing i’ve noticed is that if i force a error during build i get the STDOUT, but only if i force an error, which is not ideal. so how can i get all the stdout from gradle? i’ve tried several things, none of which seem to work, which are listed below that i can remember:
- create a custom build that builds successfully but still doesn’t have all the proper STDOUT - i added some code into our
build.gradle
file
task customBuildWithDebug {
doLast {
// Run the build with debug information
exec {
commandLine 'bash', 'gradlew', ,'--debug', '--no-daemon', '-Dorg.gradle.jvmargs=-Xmx256m'
}
}
}
the above will build successfully when called with bash gradlew customBuildWithDebug
, but is missing a lot of important STDOUT we use to verify it built correctly
- use a custom logger in an attempt to log everything - made a new file
customerLogger.init.gradle
useLogger(new CustomEventLogger())
@SuppressWarnings("deprecation")
class CustomEventLogger extends BuildAdapter implements TaskExecutionListener {
void beforeExecute(Task task) {
println "[$task.name]"
}
void afterExecute(Task task, TaskState state) {
println()
}
void buildFinished(BuildResult result) {
println 'build completed'
if (result.failure != null) {
result.failure.printStackTrace()
}
}
}
the above also builds successfully, but doesn’t contain the STDOUT we need.
- using Logging i added a logger to our
build.gradle
file
logging.captureStandardOutput LogLevel.INFO
again, a successful build, but missing the STDOUT that lets us know the other pieces built correctly. i’m fairly certain this is being built correctly and just not outputting STDOUT as we have tests that then call on this successful build for additional output that is present that couldn’t be possible unless those pieces built correctly.
is there a workaround for this or something i’m overlooking? any help would be appreciated