不久前,我尝试通过在应用程序模块中添加 lint.xml 文件并添加以下 lintOptions 来将 lint 添加到我的 android studio 项目中:
lintOptions {
abortOnError true
checkReleaseBuilds true
lintConfig file("lint.xml")
}
一切正常,调试构建在出现 lint 错误时失败,否则通过。不过,我没有将更改合并到项目中,最近我返回到这些更改,发现构建不再因 lint 错误而失败。我似乎无法找到导致此问题的那段时间在项目中所做的更改。发布版本仍然如预期的那样因 lint 错误而失败。
据我所知,lint 任务应该默认运行,但我没有将其视为构建时运行的任务的一部分
可能有帮助的其他信息:
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!--The given layout_param is not defined for the given layout, meaning it has no
effect.-->
<issue id="ObsoleteLayoutParam" severity="error" />
<!--A layout that has no children or no background can often be removed-->
<issue id="UselessLeaf" severity="error" />
<issue id="HardcodedText" severity="error" />
<issue id="UnusedResources" severity="error" />
<!--AdapterViews such as ListViews must be configured with data from Java code,
such as a ListAdapter.-->
<issue id="AdapterViewChildren" severity="error" />
<!--Missing commit() on SharedPreference editor-->
<issue id="CommitPrefEdits" severity="error" />
<!--looks for cases where you have cut & pasted calls to
findViewById but have forgotten to update the R.id field-->
<issue id="CutPasteId" severity="error" />
<!--Calling String#toLowerCase() or #toUpperCase() without specifying an explicit
locale is a common source of bugs.-->
<issue id="DefaultLocale" severity="error" />
<!--Implied locale in date format-->
<issue id="SimpleDateFormat" severity="error" />
<!--Incorrect order of elements in manifest-->
<issue id="ManifestOrder" severity="error" />
<!--Using STRING instead of TEXT-->
<issue id="SQLiteString" severity="error" />
<!--Memory allocations within drawing code-->
<issue id="DrawAllocation" severity="error" />
<!--Handler is declared as an inner class, it may prevent the outer
class from being garbage collected.-->
<issue id="HandlerLeak" severity="error" />
<!--Ellipsis string can be replaced with ellipsis character-->
<issue id="TypographyEllipsis" severity="error" />
<!--ScrollViews can have only one child-->
<issue id="ScrollViewCount" severity="error" />
<!--FragmentTransaction, you typically need to commit it as well-->
<issue id="CommitTransaction" severity="error" />
<!--A scrolling widget such as a ScrollView should not contain any nested
scrolling widgets since this has various usability issues-->
<issue id="NestedScrolling" severity="error" />
<!--ScrollView children must set their layout_width or layout_height attributes to
wrap_content-->
<issue id="ScrollViewSize" severity="error" />
<!--Using Wrong AppCompat Method-->
<issue id="AppCompatMethod" severity="error" />
<!--Some methods have no side effects, an calling them without doing something
without the result is suspicious.-->
<issue id="CheckResult" severity="error" />
<!--Duplicate ids across layouts combined with include tags-->
<issue id="DuplicateIncludedIds" severity="error" />
<!--This check ensures that a layout resource which is defined in multiple
resource folders, specifies the same set of widgets.-->
<issue id="InconsistentLayout" severity="error" />
<!--Wrong locale name-->
<issue id="LocaleFolder" severity="error" />
<!--Target SDK attribute is not targeting latest version-->
<issue id="OldTargetApi" severity="error" />
<!--Frequent alarms are bad for battery life.-->
<issue id="ShortAlarm" severity="error" />
<!--Using system app permission-->
<issue id="ProtectedPermissions" severity="ignore" />
<!--Package not included in Android-->
<issue id="InvalidPackage" severity="ignore" />
</lint>
最佳答案
在 Run lint when building android studio projects 上找到了解决方案.基本上你让 assemble 任务依赖于 lint 任务来强制它运行:
applicationVariants.all { variant ->
variant.outputs.each { output ->
def lintTask = tasks["lint${variant.name.capitalize()}"]
output.assemble.dependsOn lintTask
}
对于图书馆项目 -
libraryVariants.all { variant ->
variant.outputs.each { output ->
def lintTask = tasks["lint${variant.name.capitalize()}"]
tasks["bundle${variant.name.capitalize()}"].dependsOn lintTask
}
}
关于android - lint 不会失败的构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36309250/
设置:狂欢ruby1.9.2高线(1.6.13)描述:我已经相当习惯在其他一些项目中使用highline,但已经有几个月没有使用它了。现在,在Ruby1.9.2上全新安装时,它似乎不允许在同一行回答提示。所以以前我会看到类似的东西:require"highline/import"ask"Whatisyourfavoritecolor?"并得到:Whatisyourfavoritecolor?|现在我看到类似的东西:Whatisyourfavoritecolor?|竖线(|)符号是我的终端光标。知道为什么会发生这种变化吗? 最佳答案
我在我的Rails项目中使用Pow和powifygem。现在我尝试升级我的ruby版本(从1.9.3到2.0.0,我使用RVM)当我切换ruby版本、安装所有gem依赖项时,我通过运行railss并访问localhost:3000确保该应用程序正常运行以前,我通过使用pow访问http://my_app.dev来浏览我的应用程序。升级后,由于错误Bundler::RubyVersionMismatch:YourRubyversionis1.9.3,butyourGemfilespecified2.0.0,此url不起作用我尝试过的:重新创建pow应用程序重启pow服务器更新战俘
我已经构建了一些serverspec代码来在多个主机上运行一组测试。问题是当任何测试失败时,测试会在当前主机停止。即使测试失败,我也希望它继续在所有主机上运行。Rakefile:namespace:specdotask:all=>hosts.map{|h|'spec:'+h.split('.')[0]}hosts.eachdo|host|begindesc"Runserverspecto#{host}"RSpec::Core::RakeTask.new(host)do|t|ENV['TARGET_HOST']=hostt.pattern="spec/cfengine3/*_spec.r
在编写Ruby(客户端脚本)时,我看到了三种构建更长字符串的方法,包括行尾,所有这些对我来说“闻起来”有点难看。有没有更干净、更好的方法?变量递增。ifrender_quote?quote="NowthatthereistheTec-9,acrappyspraygunfromSouthMiami."quote+="ThisgunisadvertisedasthemostpopularguninAmericancrime.Doyoubelievethatshit?"quote+="Itactuallysaysthatinthelittlebookthatcomeswithit:themo
我正在尝试在Rails上安装ruby,到目前为止一切都已安装,但是当我尝试使用rakedb:create创建数据库时,我收到一个奇怪的错误:dyld:lazysymbolbindingfailed:Symbolnotfound:_mysql_get_client_infoReferencedfrom:/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundleExpectedin:flatnamespacedyld:Symbolnotfound:_mysql_get_client_infoReferencedf
最近因为项目需要,需要将Android手机系统自带的某个系统软件反编译并更改里面某个资源,并重新打包,签名生成新的自定义的apk,下面我来介绍一下我的实现过程。APK修改,分为以下几步:反编译解包,修改,重打包,修改签名等步骤。安卓apk修改准备工作1.系统配置好JavaJDK环境变量2.需要root权限的手机(针对系统自带apk,其他软件免root)3.Auto-Sign签名工具4.apktool工具安卓apk修改开始反编译本文拿Android系统里面的Settings.apk做demo,具体如何将apk获取出来在此就不过多介绍了,直接进入主题:按键win+R输入cmd,打开命令窗口,并将路
我需要一个非常简单的字符串验证器来显示第一个符号与所需格式不对应的位置。我想使用正则表达式,但在这种情况下,我必须找到与表达式相对应的字符串停止的位置,但我找不到可以做到这一点的方法。(这一定是一种相当简单的方法……也许没有?)例如,如果我有正则表达式:/^Q+E+R+$/带字符串:"QQQQEEE2ER"期望的结果应该是7 最佳答案 一个想法:你可以做的是标记你的模式并用可选的嵌套捕获组编写它:^(Q+(E+(R+($)?)?)?)?然后你只需要计算你获得的捕获组的数量就可以知道正则表达式引擎在模式中停止的位置,你可以确定匹配结束
我正在尝试在配备ARMv7处理器的SynologyDS215j上安装ruby2.2.4或2.3.0。我用了optware-ng安装gcc、make、openssl、openssl-dev和zlib。我根据README中的说明安装了rbenv(版本1.0.0-19-g29b4da7)和ruby-build插件。.这些是随optware-ng安装的软件包及其版本binutils-2.25.1-1gcc-5.3.0-6gconv-modules-2.21-3glibc-opt-2.21-4libc-dev-2.21-1libgmp-6.0.0a-1libmpc-1.0.2-1libm
一段时间以来,我一直在使用open_uri下拉ftp路径作为数据源,但突然发现我几乎连续不断地收到“530抱歉,允许的最大客户端数(95)已经连接。”我不确定我的代码是否有问题,或者是否是其他人在访问服务器,不幸的是,我无法真正确定谁有问题。本质上,我正在读取FTPURI:defself.read_uri(uri)beginuri=open(uri).readuri=="Error"?nil:urirescueOpenURI::HTTPErrornilendend我猜我需要在这里添加一些额外的错误处理代码...我想确保我采取一切预防措施来关闭所有连接,这样我的连接就不是问题所在,但是我
我遇到了一个非常奇怪的问题,我很难解决。在我看来,我有一个与data-remote="true"和data-method="delete"的链接。当我单击该链接时,我可以看到对我的Rails服务器的DELETE请求。返回的JS代码会更改此链接的属性,其中包括href和data-method。再次单击此链接后,我的服务器收到了对新href的请求,但使用的是旧的data-method,即使我已将其从DELETE到POST(它仍然发送一个DELETE请求)。但是,如果我刷新页面,HTML与"new"HTML相同(随返回的JS发生变化),但它实际上发送了正确的请求类型。这就是这个问题令我困惑的