简体   繁体   中英

Organize Java Imports programmatically

I have written a custom build script for my android app. I included some "easy" preprocessing, so I can define comments like

//#ifdef something
... CODE
//#endif

and get rid of the Code part if configured so. The Problem is, that after preprocessing I don't need some modules anymore, so I leave them out. What remains is the import statement for that module which bites me, if I want to build the app finally. I'm searching for a way within my preprocessing, to organize the java Imports inside my script after preprocessing happens. Any Solution without the need for additional "clicks" is very welcome.

Sometimes you're really need preprocessor (quite rare). But you could actually achieve same goal with right build process.

Anyway back to the question you could use next technique:

//#ifdef something
... IMPORTS
//#endif

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