std::cout Logs Not Appearing for React Native C++ Turbo Module #244
-
I'm working on a React Native C++ Turbo Module, and I'm trying to use std::cout to print logs for debugging purposes. However, the logs from std::cout are not showing I'm unable to find any of my output in the console when I run my React Native app on an Android device. #include "NativeSampleModule.h" namespace facebook::react { NativeSampleModule::NativeSampleModule(std::shared_ptr jsInvoker) std::string NativeSampleModule::reverseString(jsi::Runtime& rt, std::string input) {
} void NativeSampleModule::getRms(jsi::Runtime& rt) { } // namespace facebook::react |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You won't be able to use #include <android/log.h>
#define APPNAME "MyApp"
__android_log_print(ANDROID_LOG_VERBOSE, APPNAME, "The value of 1 + 1 is %d", 1+1); You might have to also link the |
Beta Was this translation helpful? Give feedback.
You won't be able to use
std::cout
as you'll have to use Android NDK's logging utils, like this:You might have to also link the
log
library in your CMake file (but that depends on your specific setup)Source https://stackoverflow.com/a/4629747