Print the obfuscated stacktrace when --print_obfuscated_stacktraces is used

Change-Id: Ia1e357104bd0dacb5bbc36b713621ec3bcf88265
diff --git a/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt b/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt
index 37196a9..909ab68 100644
--- a/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt
+++ b/d8_r8/commonBuildSrc/src/main/kotlin/TestConfigurationHelper.kt
@@ -2,8 +2,10 @@
 // for details. All rights reserved. Use of this source code is governed by a
 // BSD-style license that can be found in the LICENSE file.
 
+import java.io.ByteArrayOutputStream
 import java.io.File
 import java.io.PrintStream
+import java.nio.charset.StandardCharsets
 import java.util.Date
 import java.util.concurrent.TimeUnit
 import org.gradle.api.Project
@@ -44,6 +46,9 @@
         out.append("\n\n--------------------------------------\n")
         out.append("OBFUSCATED STACKTRACE\n")
         out.append("--------------------------------------\n")
+        var baos = ByteArrayOutputStream();
+        exception.printStackTrace(PrintStream(baos, true, StandardCharsets.UTF_8))
+        out.append(baos.toString())
       }
       return out.toString()
     }