开发者

How to send -Dflag to android app

开发者 https://www.devze.com 2022-12-26 15:26 出处:网络
Is there a way to send 开发者_Go百科-D directives to an android app? On desktop java I would just do java -Dsomeflag=value.

Is there a way to send 开发者_Go百科-D directives to an android app? On desktop java I would just do java -Dsomeflag=value.

How would you do this on android? I am building with eclipse.


I assume you want to do this because you want to have conditional if blocks for debugging. You can set android:debuggable="true" in your manifest:

<application android:icon="@drawable/icon" 
    android:name=".SomeApp"
    android:label="@string/app_name" android:debuggable="true">

and then test for it like this:

if(Log.isLoggable(TAG, Log.DEBUG)) {
    Log.d(TAG, "some log statement");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号