简体   繁体   中英

debug only JAVA code in android studio

I am new to android. I have developed an app which is working fine. It is a distributed app where different devices can interact with each other with shared data between them. However what i do is that most of the portion is java code, which i did in NetBeans and then copy paste with minor changes so that it works in the android environment.

Now my question is regarding the debugging i don't want the emulator to pop up and process the whole thing, as any input from textbox or any other source, i have provided as a static text to the variables, for debugging sake. is it possible to just debug the java file and see the result in the log? as i keep testing the code in Netbeans and once it works i copy it to Android, i searched but did not find any answer, but i am sure there will be some way around.

is it possible to just debug the java file and see the result in the log?

actually don't need to debug to get a log because:

log != debug


LOGGING

If your app works fine and you want to collect info when app is running (also in the case of errors or failures), configure a complete logging system .

Once done, normal app use will generate the info you need just changing to a low logging level like DEBUG , TRACE ...

DEBUGGING

If your app has errors and you cannot find/solve it via logs, you need more logs , but you may want to debug it, via device (connecting to the computer) or via emulator

CONCLUSION: IMHO best option is, once released, implement a logging system always and only debug if log cannot give you enough info to fix the problem.


NOTE: as you must know, yes, there is a log level called DEBUG and commands like log.d , that's the level you must implement in the java code for extra info, and set it in your config this info in the moments you have problems, after solving issues, don't forget to return to INFO , ERROR or other high level with less information in order to don't affect performance.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM