① 吉利智上博越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 清除无用资源时,这一点需要注意一下