Reputation: 15
I have installed an Android Studio, export project and project is building correctly. But I am trying to build the same project in terminal. I run ./gradlew build
in terminal, and gets errors.
> Task :UniterModule:lintDebug FAILED
Lint found 20 errors, 129 warnings. First failure:
/uniter/repo/repo_pull/mobile/UniterModule/src/main/java/com/uniter/mobile/ui/activities/BaseActivity.kt: Error: Unexpected failure during lint analysis of BaseActivity.kt (this is a bug in lint or one of the libraries it depends on)
The full lint text report is located at:
/uniter/repo/repo_pull/mobile/UniterModule/build/intermediates/lint_intermediate_text_report/debug/lint-results-debug.txt
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':UniterModule:lintDebug'.
> Lint found errors in the project; aborting build.
Fix the issues identified by lint, or create a baseline to see only new errors:
```
android {
lint {
baseline = file("lint-baseline.xml")
}
}
```
For more details, see https://developer.android.com/studio/write/lint#snapshot
Building in terminal is successful when i use ./gradlew -x lint
Settings on Android Studio are:
Settings on PC:
------------------------------------------------------------
Gradle 7.3.3
------------------------------------------------------------
Build time: 2021-12-22 12:37:54 UTC
Revision: 6f556c80f945dc54b50e0be633da6c62dbe8dc71
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 11.0.2 (Oracle Corporation 11.0.2+9)
OS: Linux 5.13.0-40-generic amd64
I set in .bashrc path to Android SDK
ANDROID_SDK_ROOT="/home/kamil/Android/Sdk/"
export ANDROID_SDK_ROOT
export PATH=$PATH:$ANDROID_SDK_ROOT
Could You tell me where is the problem.
Upvotes: 1
Views: 2487
Reputation: 3713
I came across a similar issue.
In my case, a custom class such as BaseActivity.kt
here could be, was missing the package
information at the top of the file.
Setting the package and running linter again fixed the issue instead of simply bypassing the error/warning.
Upvotes: 0
Reputation: 263
The build is failed because there are problems in the project which were found by the static analyser (lint).
You can:
@SuppressLint
annotation or specifying them in the lint.xml
filebuild.gradle
file:android {
...
lintOptions {
abortOnError false
}
}
build.gradle
file:android {
...
lintOptions {
baseline file("lint-baseline.xml")
}
}
See https://developer.android.com/studio/write/lint for further details.
Upvotes: 1