如何在android sdutio提交(SVN)代码后完善代码(根据代码检查器完善)
2017-05-09 15:31
316 查看
用SVN提交代码后代码检查器提示的代码完善
1.Access can be package-private
删除“public”就可以,但如果是类有这个提示,则需要编译进行相应的取舍。
2.Access can be private
需要把“public”改为private
3.A newer version of com.android.support:support-v4 than 25.1.0 is available: 25.2.0
建议升级版本,根据提示更改就好
4.Old buildToolsVersion 25.0.0; recommended version is 25.0.2 or later
当前的buildToolsVersion是旧版本,建议升级
5.Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (com.android.tools.build:gradle:2.3.+)
有了”+“即不确定版本,建议指定一个版本,具体哪个版本,参考主项目的build.gradle文件
6. This `ScrollView` layout or its `LinearLayout` parent is useless; transfer the `background`
attribute to the other view
母布局`LinearLayout`无用,具体看页面具体完善
7.When you define `paddingLeft` you should
probably also define `paddingRight` for right-to-left symmetry
目前发现`paddingLeft`和`paddingRight`只要是只用一个,都会有这个提示,把另一个设置为0dp这个提示会消失
8.[Accessibility]
Missing `contentDescription` attribute on image
`contentDescription`为视力有障碍的人增加对控件的解释,增加这个属性,提示就会消失
9.Consider adding `android:layout_toEndOf="@+id/tv_ini_gtit_1"` to better support right-to-left
layouts
建议增加“android:layout_toEndOf”属性
10.Use "`start`" instead of "`left`" to ensure correct behavior in right-to-left locales
当我们的minSdkVersion>=17时,使用start/end来代替left/right;当minSdkVersion<17时,旧的平台不支持RTL,start/end属性是未知的,会被忽略,所以要同时使用start/end和left/right。
11.Consider adding `android:paddingStart="10dp"`
to better support right-to-left layouts
具体还是"`start`" 和"`left`"的原因,可以参考上一条
12.Nested weights are bad for performance
嵌套权重对性能不好,建议进行完善
13.Do not place Android context classes in static fields; this is a memory leak (and also breaks
Instant Run)
不要将Android上下文类放在静态字段中,这是内存泄漏(也会中断即时运行)
把context的static删除,然后调试下就好
14. '@param str' tag description is missing
把注解的“@”删除就好
15. 'if'
statement can be simplified
if的代码可以简化
16. 'for'
loop replaceable with 'foreach'
for(int
i = 0 ; i < 100 ; i++) 改为 for(数据类型 遍历后的数据:遍历数据源)
17.Method
invocation 'xxx' may produce 'java.lang.NullPointerException'
调用‘xxx’方法,有可能会报空指针异常
18.Result of 'xxx' is ignored
结果'xxx'被忽略
1.Access can be package-private
删除“public”就可以,但如果是类有这个提示,则需要编译进行相应的取舍。
2.Access can be private
需要把“public”改为private
Access Levels Modifier Class Package Subclass World public Y Y Y Y protected Y Y Y N no modifier Y Y N N private Y N N N
3.A newer version of com.android.support:support-v4 than 25.1.0 is available: 25.2.0
建议升级版本,根据提示更改就好
4.Old buildToolsVersion 25.0.0; recommended version is 25.0.2 or later
当前的buildToolsVersion是旧版本,建议升级
5.Avoid using + in version numbers; can lead to unpredictable and unrepeatable builds (com.android.tools.build:gradle:2.3.+)
有了”+“即不确定版本,建议指定一个版本,具体哪个版本,参考主项目的build.gradle文件
6. This `ScrollView` layout or its `LinearLayout` parent is useless; transfer the `background`
attribute to the other view
母布局`LinearLayout`无用,具体看页面具体完善
7.When you define `paddingLeft` you should
probably also define `paddingRight` for right-to-left symmetry
目前发现`paddingLeft`和`paddingRight`只要是只用一个,都会有这个提示,把另一个设置为0dp这个提示会消失
8.[Accessibility]
Missing `contentDescription` attribute on image
`contentDescription`为视力有障碍的人增加对控件的解释,增加这个属性,提示就会消失
9.Consider adding `android:layout_toEndOf="@+id/tv_ini_gtit_1"` to better support right-to-left
layouts
建议增加“android:layout_toEndOf”属性
10.Use "`start`" instead of "`left`" to ensure correct behavior in right-to-left locales
当我们的minSdkVersion>=17时,使用start/end来代替left/right;当minSdkVersion<17时,旧的平台不支持RTL,start/end属性是未知的,会被忽略,所以要同时使用start/end和left/right。
11.Consider adding `android:paddingStart="10dp"`
to better support right-to-left layouts
具体还是"`start`" 和"`left`"的原因,可以参考上一条
12.Nested weights are bad for performance
嵌套权重对性能不好,建议进行完善
13.Do not place Android context classes in static fields; this is a memory leak (and also breaks
Instant Run)
不要将Android上下文类放在静态字段中,这是内存泄漏(也会中断即时运行)
把context的static删除,然后调试下就好
14. '@param str' tag description is missing
把注解的“@”删除就好
15. 'if'
statement can be simplified
if的代码可以简化
16. 'for'
loop replaceable with 'foreach'
for(int
i = 0 ; i < 100 ; i++) 改为 for(数据类型 遍历后的数据:遍历数据源)
17.Method
invocation 'xxx' may produce 'java.lang.NullPointerException'
调用‘xxx’方法,有可能会报空指针异常
18.Result of 'xxx' is ignored
结果'xxx'被忽略
相关文章推荐
- 如何搭建一台 通过SVN 提交代码自动发布的 nodeJs 服务器.
- Android studio svn忽略文件提交代码,混淆代码打包
- Android 和 iOS 团队开发中如何快速定位代码修改者等提交信息
- 如何使用svn提交或者更新本地代码
- AndroidStuido使用SVN提交代码出现 remains in conflict
- android studio svn检出、提交代码时一直弹出输入svn用户信息
- SVN如何commit(提交)项目代码
- Android Studio SVN更新、提交代码
- Android Studio Study之图解如何从svn检出项目以及更新(上传)代码
- git学习------>从SVN迁移到Git之后,项目开发代码继续在SVN提交,如何同步迁移之后继续在SVN提交的代码到Git?
- 如何在Eclipse上使用SVN,安装、提交、拉取代码、解决冲突等操作
- SVN如何commit(提交)项目代码
- 如何在Eclipse上使用SVN,安装、提交、拉取代码、解决冲突等操作
- Android开发之--studio中使用svn提交代码与检出代码
- android studio svn如何上传代码
- SVN 服务器代码提交和更新 如何使用?
- Android团队开发中如何快速定位代码修改者等提交信息
- 如何使用 SVN 找到一段时间内提交的代码文件
- eclipse开发环境下,如何根据已有代码创建一个 Android 工程
- [转]Android 本地代码如何输出日志