我将我的项目更新为最新的Android API,该项目现在有多个已弃用的方法.Android Studio是否有一种很酷的方式来列出包含所述方法的所有类,例如TODO窗口?我知道我可以通过每个课程和有条不紊地搜索代码,但我宁愿让自己变得容易.任何帮助,提示和/提示都非常感谢.
在我更新Android Studio和SDK后,我确实收到了这些错误:
Error:warning: Ignoring InnerClasses attribute for an anonymous inner class
Error:(org.apache.log4j.chainsaw.ControlPanel$1) that doesn't come with an
Error:associated EnclosingMethod attribute. This class was probably produced by a
Error:compiler that did not target the modern .class file format. The recommended
Error:solution is to recompile the class from source, using an up-to-date compiler
Error:and without specifying any "-target" type options. The consequence of ignoring
Error:this warning is that reflective operations on this class will incorrectly
Error:indicate that it is *not* an inner …Run Code Online (Sandbox Code Playgroud) 在Android Studio中,可以通过Settings => Editor => Inspections管理lint.xml配置和./idea/inspectionProfiles/.xml.据我所知lint.xml由lint命令行工具使用,检查配置文件由Android Studio IDE使用.
官方文档在这里.我还发现这篇文章如何将lint与Android Studio中的IntelliJ检查集成?这篇帖子中的Android lint在命令行中缺少问题组(与Android Studio中可用的选项相比).
这个答案在build.gradle中有一个很好的lintOptions {}块示例.
然而,缺少一些信息.
我已经阅读了很多关于StopShipAndroid Lint Check和Gradle支持的内容
我想使用SO中的一些已经提到的,而不是TODO或FIXME注释,使用它来确保用于开发/调试/测试的代码块不能达到生产.
为此,我想做两件事: - 启用StopShip检查,因为它默认是禁用 - 将严重性从警告(默认)更改为错误
(假设我们abortOnError true在gradle配置上使用).
我没能做到这一点!无论我尝试什么,如果我// STOPSHIP在代码中添加注释,android构建都不会失败.这很奇怪,因为在textEditor中它突出显示为错误,如果我运行Lint检查(Analyze> Inspect Code ...),它将被列为问题之一.
这就是我在我的尝试中所做的 build.gradle
lintOptions {
checkReleaseBuilds true
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError true
enable 'StopShip'
error 'StopShip'
}
Run Code Online (Sandbox Code Playgroud)
我还尝试在"文件">"设置">"项目设置">"检查"(或Android中的Android Studio>"首选项">"检查")中更改我的Android Studio首选项.在这里,我检查Code contains STOPSHIP marker并将严重性更改为错误,但仍然没有.
这是我的lint.xml样子:
<?xml …Run Code Online (Sandbox Code Playgroud) android gradle android-lint build.gradle android-gradle-plugin
我的团队和我开发了Android应用程序,并决定了所有应遵循的编码指南.因此,我开始实现可在此处找到的自定义lint规则,并将其添加到Jenkins的自动构建过程中.
我们现在遇到的问题是,在将我们的Android项目升级
'com.android.tools.build:gradle:2.2.0'到
之后,这些规则不再有效'com.android.tools.build:gradle:2.3.0'
我们不断得到错误:
java.lang.NoSuchMethodError: com.android.tools.lint.detector.api.JavaContext.getContents()Ljava/lang/String;
当切换回gradle 2.2.0all时,检查自定义规则并构建应用程序.
我尝试在lint存储库中更新gradle,不幸的是在第72行的TodoDetector中有完全相同的问题.在Android工作室中,所有依赖关系都得到了很好的解决,但在尝试构建和部署库时./gradlew clean build test install,我们得到了上面列出的错误.
我一直在寻找并且还没有为这个问题找到可行的解决方案.非常感谢任何帮助,提示或建议.
终端输出
:clean
:aarWrapper:clean
:compileJava
:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
:check
:build
:aarWrapper:preBuild UP-TO-DATE
:aarWrapper:preDebugBuild UP-TO-DATE
:aarWrapper:checkDebugManifest
:aarWrapper:prepareDebugDependencies
:aarWrapper:compileDebugAidl
:aarWrapper:compileDebugNdk UP-TO-DATE
:aarWrapper:compileLint
:aarWrapper:copyDebugLint UP-TO-DATE
:aarWrapper:mergeDebugShaders
:aarWrapper:compileDebugShaders
:aarWrapper:generateDebugAssets
:aarWrapper:mergeDebugAssets
:aarWrapper:mergeDebugProguardFiles UP-TO-DATE
:aarWrapper:packageDebugRenderscript UP-TO-DATE
:aarWrapper:compileDebugRenderscript
:aarWrapper:generateDebugResValues
:aarWrapper:generateDebugResources
:aarWrapper:packageDebugResources
:aarWrapper:processDebugManifest
:aarWrapper:generateDebugBuildConfig
:aarWrapper:processDebugResources
:aarWrapper:generateDebugSources
:aarWrapper:incrementalDebugJavaCompilationSafeguard
:aarWrapper:javaPreCompileDebug
:aarWrapper:compileDebugJavaWithJavac
:aarWrapper:processDebugJavaRes UP-TO-DATE
:aarWrapper:transformResourcesWithMergeJavaResForDebug
:aarWrapper:transformClassesAndResourcesWithSyncLibJarsForDebug
:aarWrapper:mergeDebugJniLibFolders
:aarWrapper:transformNativeLibsWithMergeJniLibsForDebug
:aarWrapper:transformNativeLibsWithStripDebugSymbolForDebug
:aarWrapper:transformNativeLibsWithSyncJniLibsForDebug …Run Code Online (Sandbox Code Playgroud) 在更新AndroidStudio之后,我将gradle更新到1.9包装器和0.7.+build.gradle的依赖项中.
从那时起,我在运行时遇到此错误./gradlew check connectedCheck
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:lint'.
> Lint found errors with abortOnError=true; aborting build.
Run Code Online (Sandbox Code Playgroud)
编辑
gradle控制台还显示以下消息:
Ran lint on variant release: 69 issues found
Ran lint on variant debug: 69 issues found
Wrote XML report to <PROJECT>/app/build/lint-results.xml
Wrote HTML report to <PROJECT>/app/build/lint-results.html
:app:lint FAILED
Run Code Online (Sandbox Code Playgroud) 当我尝试构建滑动菜单项目时,我收到以下错误.这个项目在eclipse中使用,但我在android studio中使用默认导入来获得这个项目.
:slidingMenu:lint FAILED
FAILURE:构建因异常而失败.
出了什么问题:任务执行失败':slidingMenu:lint'.
[Ljava/UTIL/HashMap的$条目;
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.
建筑失败
总时间:9.59秒无法使用Gradle分发' http://services.gradle.org/distributions/gradle-1.9-all.zip ' 执行构建.
使用--stacktrace运行没有提供任何新信息.
我已尝试添加一个忽略,如此答案中所述 - gradle构建在lint任务上失败,但这没有帮助.
我正在尝试Kotlin Gradle Script和Android Testing。
当我尝试为测试配置 android 资源时,出现以下错误:
无法访问 includeAndroidResource 在 UnitTestOptions 中是私有的。
在 Android 单元测试中启用使用android Resource的正确方法是什么?
android android-testing build.gradle android-gradle-plugin gradle-kotlin-dsl
android ×7
build.gradle ×4
gradle ×3
java ×3
lint ×3
android-lint ×2
build ×1
dependencies ×1
deprecated ×1