在Android Studio中計算所有java類的代碼行數

[英]Count lines of code in all java classes in Android Studio


Is there any way I can view the total lines of code in each java class in my project?

我是否可以查看項目中每個java類的總代碼行?

Looking for something like this for Android Studio.

為Android Studio尋找類似的東西。

3 个解决方案

#1


168  

Go to https://plugins.jetbrains.com/idea/plugin/4509-statistic and install the latest version

訪問https://plugins.jetbrains.com/idea/plugin/4509統計並安裝最新版本

To install

安裝

  1. Run Android Studio

    運行Android的工作室

  2. From the menu bar, select File-->Settings

    在菜單欄中,選擇File——>設置

  3. Under IDE Settings, click Plugins, and then click Install plugin from disk

    在IDE設置下,單擊插件,然后單擊從磁盤安裝插件

  4. Navigate to the folder where you downloaded the plugin and double-click it

    導航到下載插件的文件夾並雙擊它

  5. Restart Android Studio

    重新啟動Android工作室

To count the lines

數線

  1. Check the statistics option that is visible after installing the plugin
  2. 檢查在安裝插件后可見的統計選項
  3. This option is near the run, debug, gradle console, bottom left corner of Android studio
  4. 這個選項在Android studio的運行、調試、漸變控制台、左下角附近

21/05/2015

21/05/2015

If you cannot see the Statistics options, do the following:

如果您看不到統計選項,請執行以下操作:

  1. Select VIEW from the toolbar.

    從工具欄中選擇VIEW。

  2. Select TOOLS Windows.

    選擇工具窗口。

  3. Choose STATISTICS.

    選擇統計數據。

You will see the statistics of your project and at the bottom, there is TOTAL section which displays the total lines under the Column of LINES.

您將看到您的項目的統計信息,在底部,有一個總區,它顯示了行列下的總行數。

#2


17  

You could try this plugin (It is for IntelliJ but should work with AS): http://plugins.jetbrains.com/plugin/?idea&id=4509

您可以嘗試這個插件(它是針對IntelliJ的,但是應該使用AS): http://plugins.jetbrains.com/plugin/?idea&id=4509

#3


2  

Jetbrain's statistics plugin is counting only .java files. It is not accurate for getting android app source line of code.

Jetbrain的統計插件只計算.java文件。這對於獲取android應用程序源代碼是不准確的。

We can use locmatrics for this.

我們可以用locmatrics來做這個。

http://www.locmetrics.com/

http://www.locmetrics.com/

This will return loc for all the entered extensions.

這將為所有輸入的擴展返回loc。

Please set a valid output directory while checking this. Otherwise garbage files will be generated inside source directory

請在檢查時設置一個有效的輸出目錄。否則將在源目錄中生成垃圾文件


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2014/08/26/72f8ac11045d0ae7c51403f11c10159d.html



 
粤ICP备14056181号  © 2014-2021 ITdaan.com