Bulk Delete obsolete resources in Android projects under Mac Platform

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.