Lint error fixing - android

I am getting lint error in android studio as
Error:Execution failed for task ':app:lint'. Lint found errors in the
project; aborting build. Fix the issues identified by lint, or add the
following to your build script to proceed with errors:
android {
lintOptions {
abortOnError false
} }
Information:BUILD FAILED Information:Total time: 7.288 secs Information:1 >error Information:0 warnings
Build is getting failed
But it is not showing where exactly the error and even IDE(Android studio) is also not displaying any error mark in files.
How to redirect lint error to source file.?
I don't want to skip the lint check.
Please help me.

From the command line, run gradlew lintDebug (or gradlew lint[variantName] for a different variant).
This will generate a full lint report at /app/build/outputs. I recommend the HTML version (lint-results-debug.html). In there you will find all Android lint issues and their severity.
Alternatively, you can go to Analyze > Inspect Code in Android Studio to run lint. Switch the view to group them by severity- the errors are the ones blocking your build.

The erros reports with the lines and exactly erros font are found in: Your app release builds folder, then:appname/app/build/reports.
there you will find the lint-results-release-fatal. Open it in any browser to find the problems.
Hope it helps.

Related

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mergeDevOnlySlDebugResources' only on Jenkins

When I use Android Studio 3.0 Beta 7 and update my project with the Android Gradle 3.0.0-beta7 plugin my project builds fine in both the debug and rc (proguard enabled) variants.
When I attempt to build on my Jenkins box, I get a bunch of:
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\androidsdk-2.4.12-fullRelease.aar\222313e24d6c4b00972b4191a95e6e2e\res\drawable-xxhdpi-v4\ic_teads_sdk_contact_us.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\appcompat-v7-25.3.1.aar\c8fedf0a28e83c9ac57e1ac18693c6a0\res\drawable-hdpi-v4\abc_tab_indicator_mtrl_alpha.9.png: error: file not found.
C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-1\files-1.1\android-sdk-ui-2.0.4.aar\0b51ce1d665e491601444168a26000ca\res\drawable-xhdpi-v4\com_appboy_inappmessage_chevron.png: error: file not found.
What went wrong:
Execution failed for task ':mergeDevOnlySlDebugResources'.
Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details
I tried to use AAPT instead of AAPT2 and that still gives me the same problem. My other jenkins projects that are not running this gradle 3 change still run fine. Also the files that can't be found from above are indeed on my machine in the location that AAPT can't find.
Has anyone run into this before?
I've seen error's online about invalid PNG or actual errors from using the new AAPT2, but this is different.
I solved this problem by adding the below line to the gradle.properties file:
android.enableAapt2=false

:app:transformDexArchiveWithDexMerger IllegalStateException using AS 3.0 beta6

I've started getting following error after updating to AS 3.0 beta 6. Has anyone else come across this? I'm only seeing this error when I try to build/run from AS.....no issue if I run gradle on command line.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithDexMergerFor<BuildVariantName>Debug'.
> com.android.build.api.transform.TransformException: java.lang.IllegalStateException
Thanks to #Nabin in the comments we found out that enabling Instant Run fix that issue.
Unfortunately - other than the original poster - we had the same issue on the command line. Which means our CI doesn't run.
We found out that we can disabling the incremental dexing by setting the flag -Pandroid.useDexArchive=false. See here for more infos:
A new incremental dexing pipeline has been implemented. Now the Gradle plugin dex only the class files that have changed. It is enabled by default, but you can disable it by doing one of the following:
Passing -Pandroid.useDexArchive=false when running builds from command line e.g. ./gradlew :app:assembleDebug -Pandroid.useDexArchive=false.
Adding android.useDexArchive=false to the gradle.properties file in your root project.
Luckily we don't need incremental dexing on our CI.
Unfourtnaly it doesn't help us in Android Studio with disabled Instant Run!

Gradle error: Execution failed for task ':crashlyticsGenerateSymbolsArmRelease'. > Crashlytics Developer Tools error

I had setup crashlytics to get ndk crashes for my Android app. Crashes are getting recorded in crashlytics but I am not getting the line numbers.
Went through: https://support.crashlytics.com/knowledgebase/articles/605190-missing-line-numbers-in-native-crashes
I am getting the following error on running below command:
./gradlew crashlyticsUploadSymbolsArmRelease
What went wrong:
Execution failed for task ':crashlyticsGenerateSymbolsArmRelease'.
Crashlytics Developer Tools error.
I have tried various solutions but nothing is helping.
In case you are still looking: I had the same problem and found the correct command in the Gradle view:
app->Tasks->other->crashlyticsUploadSymbolsMYAPPVARIANTNAME
You can search the gradle tasks in the gradle window as well by just starting to type:

What errors get detected in "build" in Android Studio - role of Gradle

I'm transitioning over from Eclipse to Android Studio and I find that I'm still confused about the different components of Android Studio regarding detecting errors. I have a project with about 20 Java files and 30 XML files. I recently ran a clean and build and got
Gradle build finished with 5 error(s) in 13s 397 ms
Two XML files were indicated and in both of them there was whitespace in front of the first element with an error saying ...
Xml declaration should precede all document content
So I fixed those and ran the build again with no errors.
I then ran Lint and found 8 more XML files with errors (NB, errors, not warning) saying "Element selector doesn't have required attribute:layout_height ". This error was apparently due to these files being in a layout folder instead of a drawable folder, although why that didn't cause problems in Eclipse is unclear.
My Questions:
Why does Gradle Build only detect some errors, but other have
to be found via lint?
What categories of errors will be found via Gradle Build?
How hard is it to add something to the Gradle Build script to find
all errors?
Edit: actually this is also true for regular Java files - I'll get "0 errors" in the Gradle build and then I'll step into a source file in the debugger and see 4 errors from Lint.
Why does Gradle Build only detect some errors, but other have to be
found via lint?
Lint errors are not compile errors, but code issues, and by default AndroidStudio will not check those. (Same goes for standard javac).
What categories of errors will be found via Gradle Build?
Gradle will detect all compile time errors, annotation processing, packaging errors, dex, signing, incorectly defined xml, incorrect file naming, etc.
How hard is it to add something to the Gradle Build script to find all errors?
Surprisingly easy in fact, source
To enable lint checks when compiling add in your application level build.gradle
android {
lintOptions {
// set to true to turn off analysis progress reporting by lint
quiet false
// if true, stop the gradle build if errors are found
abortOnError true
// if true, only report errors
ignoreWarnings false
}
...
}
If this will not work for U, add lint after each make, to do this you can follow this answer
I will add that this config will detect all enabled inspections with severity warning and error under:
File > Other Settings > Default Settings > Editor > Inspections
Android Studio will run code inspections checks live so all lint warnigns / errors are displayed in code while editing, lint errors are marked with red underscore, and warnings by marking code fragment with yellow background. Even if lint errors are marked the same as compile time errors they will not stop build by default.

Gradle Android task crashing with unclear error

I am trying to run a Gradle Android task generated by libGDX utility (the desktop task runs fine) in IntelliJ IDEA, but I'm only getting this nonspecific error message. What is the issue, or where are the logs, or how to enabled logs?
Information:Gradle: Executing tasks: [:core:assemble, :android:assembleDebug]
Information:24. 10. 2015 16:58 - Compilation completed with 1 error and 0 warnings in 9s 415ms
Error:Gradle: Execution failed for task ':android:proguardDebug'.
> java.io.IOException: Please correct the above warnings first.
PS: Not sure if it is relevant, but I have modified build files and ProGuard file to support Scala as described there.
I did not find a way of getting any useful logs from IntelliJ IDEA. I solved the problem by running Gradle from console.
gradlew assemble --stacktrace --info
Problem was Gradle could not find tools.jar. Adding system environment variable JAVA_HOME pointing to Java SDK directory fixed the issue.

Categories

Resources