Originally here a lot of methods, on the Mac to do or not win under convenient,
1, with a jar package (Androidunusedresources1.6.2.jar):
Place the jar package in the project directory as shown in:
Then execute it on the console: CD your project path
Example: Cd/users/hl/documents/workspace/yourproject
And then execute
Java-jar Androidunusedresources1.6.2.jar > Del.txt
This sentence means to find and generate a file directly from the path of the discarded resource, which may take several minutes, so that you can refresh the project directory and find a del.txt file
2, you can open a del.txt file after
Will find a lot of address path, if you delete in bulk at this time, there are a lot of possible mistakenly deleted, so I will be based on the format of the last path to delete in bulk
3, create a new Java project
PackageCom.hloong.deletefile;ImportJava.io.BufferedReader;ImportJava.io.File;ImportJava.io.FileInputStream;ImportJava.io.IOException;ImportJava.io.InputStreamReader; Public class Delete { Private StaticString dir ="/users/hl/documents/workspace/yourproject/del.txt"; Public Static void Main(string[] args) {Try{DeleteFile (dir); }Catch(IOException ex) {System.out.println ("Etes"); } }Private Static void DeleteFile(String dir)throwsIOException {//TODO auto-generated method stubFile File =NewFile (dir); InputStreamReader Read =NewInputStreamReader (NewFileInputStream (file),"UTF-8");//Considering the encoding formatBufferedReader Breader =NewBufferedReader (read); String string =""; while(String = Breader.readline ())! =NULL) {//loop Read line if(!string.contains ("Ssdk_")) {//Reserve SHARESDK resources to prevent accidental deletion if(String.contains (". png") || String.contains (". xml")) {//If it is a picture or. xmlSystem.out.println (String.replaceall ("/","//"). ToString (). Trim ());NewFile (String.replaceall ("/","//"). Trim ()). Delete (); }}} read.close (); }}
Run and then refresh the project directory and you'll find that a lot of resources have been deleted.
But if you do not keep some third-party resources such as SHARESDK, you will find that they have also been deleted, so there is no way you can only keep sharesdk resources, you can delete files in the Java Project Filter (the code has an example)
The other can only be manually deleted, after all, this jar package is still limited capacity
Jar Package: http://download.csdn.net/detail/tmacsky/8705755
Bulk Delete obsolete resources in Android projects under Mac Platform