Code Monkey home page Code Monkey logo

android-cu's Introduction

Android-CU 使用说明


简介

CU是clear unused的缩写,本项目主要用来清理Android工程中无用的代码文件和资源文件。

CURes.java用于清理资源文件,借助于ADT SDK自带的lint工具,相对路径为\sdk\tools\lint.bat。

CUSrc.java用于清理.java文件,需要Eclipse插件UCDetector配合。

使用

清除无用文件,需要交替运行CURes.javaCUSrc.java,直到没有可删除文件为止。

运行CURes.java

  • 运行参数为lint.bat文件绝对路径和android工程目录,如 D:adt/sdk/tools/lint.bat D:/nova
  • String[] dirArray为要删除资源文件的相对目录,默认为res目录下。一般来说,values不需要删除,故不添加。
  • 运行结果保存在当前目录下,文件名为格式化后的时间戳。

运行CUSrc.java

  • 设置UCDetector,忽略不需要扫描的文件,如Activity
  • 使用UCDetector扫描项目生成txt报告
  • 运行程序需要两个参数,UCDetector生成的报告路径,项目的路径,如 D:/UCDetector/report.txt D:/nova
  • 运行结果会保存在当前目录下的UnusedJava.txt文件中。

注意

  • 清除资源时,如果使用字符串形式调用layout等资源文件,无法被lint识别,会造成误删。
  • 清除代码时,如果使用字符串形式调用fragment等控件或者使用反射时,无法被UCDetector识别,会造成误删。

android-cu's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.