I am using YuvImage
to compress the android.hardware.Camera
feed to jpeg. Since then, I keep seeing skia onFlyCompress
messages in logcat, which completely pollutes it. Is there any way to disable this message? I know I can filter the logcat output but that means doing it everywhere all the time, which is not a fix but a workaround. I simply don't want those messages printed at all

- 2,912
- 3
- 35
- 59
-
1Does this affect release build of your app? Skia uses DEBUG priority for these messages, they should only be present in a debug build. – Константин Осипов Apr 08 '18 at 19:07
-
do you restart your devices and then try to debug it. – krishank Tripathi Apr 14 '18 at 10:13
-
1this amy help you https://stackoverflow.com/questions/15696165/out-of-memory-when-using-compresstojpeg-on-multiple-yuvimage-one-at-a-time – krishank Tripathi Apr 14 '18 at 10:21
-
Have you seen [this](https://stackoverflow.com/questions/5511433/how-to-exclude-certain-messages-by-tag-name-using-android-adb-logcat/29634795) question? – azizbekian Apr 14 '18 at 15:44
-
@shakram02 Do you accept what runs on rooted devices? – KYHSGeekCode Apr 15 '18 at 06:59
-
I wanted to fix it actually, not just remove the log message. I compress YuvImages and that's what caused the message. I didn't know about XPosed, thanks for your effort! – shakram02 Apr 15 '18 at 09:29
2 Answers
You may can (i am not sure) subclass the class YuvImage
which prints log and override the method of that class which prints the log and simply copy all code of that method but the Log.d()
or Log.v()
or Log.w()
, ... code to the overridden method.
Look at the following answer too:

- 3,630
- 2
- 18
- 29
-
2`android.util.Log` is a final class and can't be overridden. Anyway the called methods are static and therefore overriding won't help. – Robert Apr 14 '18 at 12:50
-
@Robert there is no need to override `android.util.Log` or its methods .However if called method of `YuvImage` is static you may can copy codes to your class and change them as you want. you need to have source codes in this way – ygngy Apr 14 '18 at 13:26
-
Short answer
Try accomplishing your goal with method hooking.
You can hook android.util.log
methods using XPosed Framework
on ROOTed devices.
Detailed methods
- Use XPosed Framework to hook the
android.util.Log
's methods. - In the hooking method, check if the message contains
skia onFlyCompress
. - If then call
setResult(null);
to prevent it from printing out the log message.
Though these methods can only be used on rooted devices, but I hope my answer help at least some users that can use rooted devices.
(Hmm, because no customers will have to block the log messages, so all you need to do is to just root your local device only and install the auto-filtering app that uses XPosed framework.)
To see an example of blocking a method from executing rest of its code: This answer(especially the last paragraph) contains some examples to use Xposed framework. As you can see, the codes are very short(no longer than 40 lines.)
I will implement some codes if needed/seen potentially useful.
Sample code snippet
As someone upvoted mine, I assume that someone liked my suggestions. So I post some codes.
import android.util.*;
import de.robv.android.xposed.*;
import de.robv.android.xposed.callbacks.XC_LoadPackage.*;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
public class LogFilterApp implements IXposedHookLoadPackage
{
private String TAG="LogFilter";
public void handleLoadPackage(final LoadPackageParam lpparam) throws Throwable
{
XposedBridge.log("Package name: " + lpparam.packageName);
try
{
findAndHookMethod("android.util.Log", lpparam.classLoader, "i", String.class, String.class, new XC_MethodHook()
{
@Override
protected void beforeHookedMethod(MethodHookParam param) throws Throwable
{
//do something before
if(((String)(param.args[1])).indexOf("skia onFlyCompress")>=0)
{
param.setResult(null);
}
}
});
}
catch (XposedHelpers.ClassNotFoundError e)
{
XposedBridge.log("ClassNotFoundError");
}
catch (NoSuchMethodError e)
{
XposedBridge.log("NoSuchMethodError");
}
}
}
}
}
Code reference: this XDA thread

- 1,068
- 2
- 12
- 30
-
The Windows related part at the beginning is a bit misleading - I would remove it because it diverts the readers attention from the Xposed idea - which is quite good. Especially because the problem is only relevant on the used debugging device. – Robert Apr 14 '18 at 18:55
-
@Robert You are definitely right. Thank you for your recommendation. – KYHSGeekCode Apr 15 '18 at 00:40
-