?

android studio 디버그

지지리 2021. 9. 24. 15:50
...
import android.util.Log;

public class MainActivity extends AppCompatActivity {
    private final static String TAG = MainActivity.class.getSimpleName();
    ...
    Log.d(TAG, "hello");
    ...
}
try {
  ...
} catch (IOException e) {
  StringWriter sw = new StringWriter();
  e.printStackTrace(new PrintWriter(sw));
  String exceptionAsString = sw.toString();

  Log.e("IOException!", exceptionAsString);
}