LoginSignup
0
3

More than 5 years have passed since last update.

"Method d in android.util.Log not mocked." をころす

Posted at

後から試験書いたらこんなこと言われた。

java.lang.RuntimeException: Method d in android.util.Log not mocked. See http://g.co/androidstudio/not-mocked for details.

    at android.util.Log.d(Log.java)
...

Process finished with exit code -1

そしたら、これを

Log.d(TAG, "ウェーイ");

こうして

log("ウェーイ");
private static void log(String msg) {
    Log.d(TAG, msg);
}

こう。

private static void log(String msg) {
    try {
        Log.d(TAG, msg);
    } catch (RuntimeException ignored) {
    }
}

やったぜ。

ちなみに sout に置き換えると出力がうるさい感じです。見たいならそれで良いけど。

他の人どうしてるんだろ。こういう↓ことしてるのかな。

0
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
3