① 吉利智上博越androidlink連不上怎麼辦
插上數據線,然後設置里--->開發者選項-->USB鏈接;
用carplay或者Glink可以互聯,車機本身有提示;
多看看說明書,不行就4s店裡問問。
② 怎樣定製Android-Lint檢查問題的現有規則
Android SDK自帶的APIDemo用Android-Lint檢查一下,也還報了很多的問題。
一、忽略XML文件中的問題
1.1 MissingPrefix問題
Layout的device_admin_sample.xml文件中定義了下面的Button
[html] view plainprint?
<Button
android:id="@+id/set_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android_layout_gravity="east|center_vertical"
android:text="@string/set_password">
</Button>
<Button
android:id="@+id/set_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android_layout_gravity="east|center_vertical"
android:text="@string/set_password">
</Button>執行Android-Lint就會報MissingPrefix警告:
1.2 解決XML中的問題
可以在Lint Warnings View中解決(圖中圖標從左至右順序)
Suppress this error with an annotation/attribute
點擊該圖標之後,直接更改了device_admin_sample.xml文件:
[html] view plainprint?
<Button
android:id="@+id/set_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android_layout_gravity="east|center_vertical"
android:text="@string/set_password"
tools:ignore="MissingPrefix" >
</Button>
<Button
android:id="@+id/set_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android_layout_gravity="east|center_vertical"
android:text="@string/set_password"
tools:ignore="MissingPrefix" >
</Button>XML文件中直接增加了tools:ignore="MissingPrefix"。
Ignore in this file
在本文件中忽略,而在別的文件中仍然出現。
Ignore in this project
當前項目中都忽略該Issue。
執行之後,在本項目根目錄下創建了lint.xml的文件,內容為:
[html] view plainprint?
<?xml version="1.0"encoding="UTF-8"?>
<lint>
<issue id="MissingPrefix"severity="ignore" />
</lint>
<?xml version="1.0"encoding="UTF-8"?>
<lint>
<issue id="MissingPrefix"severity="ignore" />
</lint> Always ignore
所有項目中都忽略。
[TIPS#1] Ignore in this project和 Always ignore操作,同執行Lint Warnings View中的最後一個Icon -- Options…,然後配置某一個項目或者全局設置中該Issue的Severity為ignore。
[TIPS#2] Eclipse中的實現有BUG,有時設置了這些Ignore操作,即便立即執行檢查也不一定生效,需要重啟Eclipse。
二、解決Java代碼中的問題
2.1 NewAPI問題
APIDemo中指明了支持最低API-1,但是代碼里卻用了API-3的介面,執行Lint會報錯:
2.2 解決問題
把游標放在報錯代碼處,會自動提示如何快速fix。
1. 前面紅色圓角框內是用Javaannotation方式解決(API-16之後才有):@SuppressLint『<IssueId>』或@TargetAPI(<api>)
@SuppressLint 『<IssueId>』用來忽略<IssueId>。適用范圍在所調用的方法處或整個類中。
@TargetAPI(<api>)用來指示API用給定的<api>,而不是項目中指定的。適用范圍在所調用的方法處或整個類中。
2. 後麵粉紅色圓角框內同XML中解決方式——在本文件/ 本項目/ 全局范圍內忽略檢查。
三、命令行下解決問題
從上面Eclipse環境下的解決問題的方式知道,可以指定文件來定製Lint檢查Issue的處理方式。
下面是一個lint.xml的例子:
[html] view plainprint?
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable the given check in thisproject -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParamissue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
<!-- Ignore the UselessLeaf issue inthe given file -->
<issue id="UselessLeaf">
<ignore path="res/layout/main.xml" />
</issue>
<!-- Change the severity of hardcodedstrings to "error" -->
<issue id="HardcodedText" severity="error" />
</lint>
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Disable the given check in thisproject -->
<issue id="IconMissingDensityFolder" severity="ignore" />
<!-- Ignore the ObsoleteLayoutParamissue in the given files -->
<issue id="ObsoleteLayoutParam">
<ignore path="res/layout/activation.xml" />
<ignore path="res/layout-xlarge/activation.xml" />
</issue>
③ android開發平台中lint.xml文件怎麼建立
1)性能
布局性能(以前是 layoutopt工具,可以解決無用布局、嵌套太多、布局太多、overdraw)
其他性能(如:draw/layout 時進行對象的聲明等)
2)未使用到資源、資源缺少(不同資源的適配)
3)有更高性能的資源替換 ---- eg:SparseBooleanArray SparseIntArray
4)國際化問題(硬編碼)
5)圖標的問題(重復的圖標,錯誤的大小)
6)可用性問題(如不指定的文本欄位的輸入型)
7)manifest文件的錯誤 -- 未注冊activity service等等
8)內存泄露 --- 如:handle的不當使用 。
9)占內存的資源及時回收 --- 如:TypedArray未回收資源等
④ 怎麼用androidstudio的lint工具掃描代碼
1、在Android studio的中進行導入一個Android的開發的項目的文件,然後在項目中選中一個需要檢查的文件。
2、項目的文件被選中完成之後,進行點擊Android studio菜單中的Analyze選項菜單。
3、進行點擊完Analyze菜單中之後,就會彈出了一個下拉的菜單的inspect code選項菜單。
4、然後就會彈出了一個speoify inspection scope的談出框,在inspection scope中,whole project為是整個的項目檢查,如果只想檢查剛才選中的文件,進行選中第四個選項即可file【app】即可,然後進行點擊OK。
5、那麼在就會Android studio的底部位置中,彈出了一個項目的檢查的結果,也是檢查結果的列表。
6、如果要查看具體的檢查的內容的話,進行點擊檢查的結果的文件之後,可以查看到的是檢查結果的具體信息內容。
⑤ 什麼叫android lint錯誤
lint錯誤呢,是android自動化檢測工程中的一些容易被開發人員忽視的(我理解成小問題,很多不影響運行的錯誤),比如xml文件裡面直接使用語言,沒有提取到string.xml文件裡面、比如有些類定義了卻沒有使用,在你編寫代碼的時候,都會自動運行監測的。
⑥ lint 命令行運行 能檢查android studio工程的無用資源嗎
This problem can be said is unprecedented. No latecomers, answer the Chinese civilization for five thousand years, every year have a explain yourself, then later overturned, re established, so repeatedly complex for thousands of years, you are so lucky, today, I can tell you a standard answers, at least 5000 years won't be overthrown, that card is the kingly way.
⑦ android lint工具在哪
在最上方的工具欄,點擊windows,選擇show view,就可以看到lint工具,單擊就會出現的。
⑧ android lint怎麼用
定製Android-Lint檢查問題的現有規則 對Android-Lint發現的問題進行處理。可定製項目中採用的規則。 Android-Lint檢查問題列表 Android SDK Tools / ADT 20.0.3中所支持的默認檢查的所有問題。 有英文版本和中文版本。英文版本從Android-Lint中直接導出;中文版本還不完整,對每一條的解釋會逐步完善。 Android SDK自帶的APIDemo用Android-Lint檢查一下,也還報了很多的問題。 一、忽略XML文件中的問題 1.1 MissingPrefix問題 Layout的device_admin_sample.xml文件中定義了下面的Button [html] view plainprint? <Button android:id="@+id/set_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android_layout_gravity="eastcenter_vertical" android:text="@string/set_password"> </Button> <Button android:id="@+id/set_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android_layout_gravity="eastcenter_vertical" android:text="@string/set_password"> </Button>執行Android-Lint就會報MissingPrefix警告: 1.2 解決XML中的問題 可以在Lint Warnings View中解決(圖中圖標從左至右順序) Suppress this error with an annotation/attribute 點擊該圖標之後,直接更改了device_admin_sample.xml文件: [html] view plainprint? <Button android:id="@+id/set_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android_layout_gravity="eastcenter_vertical" android:text="@string/set_password" tools:ignore="MissingPrefix" > </Button> <Button android:id="@+id/set_password" android:layout_width="wrap_content" android:layout_height="wrap_content" android_layout_gravity="eastcenter_vertical" android:text="@string/set_password" tools:ignore="MissingPrefix" > </Button>XML文件中直接增加了tools:ignore="MissingPrefix"。 Ignore in this file 在本文件中忽略,而在別的文件中仍然出現。 Ignore in this project 當前項目中都忽略該Issue。 執行之後,在本項目根目錄下創建了lint.xml的文件,內容為: [html] view plainprint? <?xml version="1.0"encoding="UTF-8"?> <lint> <issue id="MissingPrefix"severity="ignore" /> </lint> <?xml version="1.0"encoding="UTF-8"?> <lint> <issue id="MissingPrefix"severity="ignore" /> </lint> Always ignore 所有項目中都忽略。 [TIPS#1] Ignore in this project和 Always ignore操作,同執行Lint Warnings View中的最後一個Icon -- Options…,然後配置某一個項目或者全局設置中該Issue的Severity為ignore。 [TIPS#2] Eclipse中的實現有BUG,有時設置了這些Ignore操作,即便立即執行檢查也不一定生效,需要重啟Eclipse。 二、解決Java代碼中的問題 2.1 NewAPI問題 APIDemo中指明了支持最低API-1,但是代碼里卻用了API-3的介面,執行Lint會報錯: 2.2 解決問題 把游標放在報錯代碼處,會自動提示如何快速fix。 1. 前面紅色圓角框內是用Javaannotation方式解決(API-16之後才有):@SuppressLint『<IssueId>』或@TargetAPI(<api>) @SuppressLint 『<IssueId>』用來忽略<IssueId>。適用范圍在所調用的方法處或整個類中。 @TargetAPI(<api>)用來指示API用給定的<api>,而不是項目中指定的。適用范圍在所調用的方法處或整個類中。 2. 後麵粉紅色圓角框內同XML中解決方式——在本文件/ 本項目/ 全局范圍內忽略檢查。 三、命令行下解決問題 從上面Eclipse環境下的解決問題的方式知道,可以指定文件來定製Lint檢查Issue的處理方式。 下面是一個lint.xml的例子: [html] view plainprint? <?xml version="1.0" encoding="UTF-8"?> <lint> <!-- Disable the given check in thisproject --> <issue id="IconMissingDensityFolder" severity="ignore" /> <!-- Ignore the ObsoleteLayoutParamissue in the given files --> <issue id="ObsoleteLayoutParam"> <ignore path="res/layout/activation.xml" /> <ignore path="res/layout-xlarge/activation.xml" /> </issue> <!-- Ignore the UselessLeaf issue inthe given file --> <issue id="UselessLeaf"> <ignore path="res/layout/main.xml" /> </issue> <!-- Change the severity of hardcodedstrings to "error" --> <issue id="HardcodedText" severity="error" /> </lint> <?xml version="1.0" encoding="UTF-8"?> <lint> <!-- Disable the given check in thisproject --> <issue id="IconMissingDensityFolder" severity="ignore" /> <!-- Ignore the ObsoleteLayoutParamissue in the given files --> <issue id="ObsoleteLayoutParam"> <ignore path="res/layout/activation.xml" /> <ignore path="res/layout-xlarge/activation.xml" /> </issue> <!-- Ignore the UselessLeaf issue inthe given file --> <issue id="UselessLeaf"> <ignore path="res/layout/main.xml" /> </issue> <!-- Change the severity of hardcodedstrings to "error" --> <issue id="HardcodedText" severity="error" /> </lint>Lint.xml中關鍵是對issue(用id指定)的severity進行指定,並且可以指定該issue作用於指定的文件還是當前項目。 把lint.xml放在項目的根目錄中,命令行執行lint時候,lint就會用lint.xml中的規則。 另外,執行lint時還可以用參數--config<fileName>指定一個全局的配置用於所有的項目。當項目中已有lint.xml,則對於某個issue而言,在lint.xml中沒有對該issue特別定製的情況下,--config指定的文件<fileName>中的該issue的定製才起作用。 四、定製Lint檢查的規則 Android-Lint有默認的檢查和報錯的規則,但通過上面的分析知道,可以在Eclipse或者命令行下改變這種規則,從而可以定製Lint檢查的規則。 推薦定製的路線: 在Eclipse中基於現有的問題,逐個分析並解決,然後就能得到一個Eclipse自動生成的lint.xml這個定製文件; 然後這個lint.xml用於Eclipse和/或命令行下進行後續的檢查; 後續發現的問題再進一步處理,逐步完善lint.xml這個定製文件。 當然,如果有足夠的時間,完全也可以Review一遍Android-Lint已經支持的所有的Issue,對他們逐個進行定製。對這些Issue的 Review,也能加深對Android設計中問題解決和性能優化方法的理解。
⑨ Android Studio怎麼使用lint清除無用的資源文件
使用lint清除無用資源的步驟:
1、
需注意的是,如果用到第三方jar,如果裡面運用反射引用到本地資源(如圖片,文件)之類的,使用lint查找時,這些資源也會被標出成沒用的資源,所以在使用lint 清除無用資源時,這一點需要注意一下