I have a build.gradle
file with dependencies { classpath 'com.android.tools.build:gradle:0.13.3'}
and apply plugin: 'com.android.application'
.
When I do a debug build I get:
gradle clean assembleDebug :myapp:preBuild (...) :myapp:compileDebugJava Note: C:\path\to\MyClass.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. :myapp:preDexDebug (...) :myapp:assembleDebug BUILD SUCCESSFUL
How can I add the -Xlint:unchecked
to the underlying task? Gradle Plugin User Guide on Java compilation options is unhelpful.
Class ProcessResourcesCopies resources from their source to their target directory, potentially processing them. Makes sure no stale resources remain in the target directory.
According to Gradle documentation: sourceCompatibility is "Java version compatibility to use when compiling Java source." targetCompatibility is "Java version to generate classes for."
main. runtimeClasspath' contains the compiled classes of the source set, and task autowiring automatically adds the necessary task dependencies. Maybe you want 'sourceSets. main. compileClasspath'.
An annotation processor is a class which extends AbstractProcessor (in the package javax. annotation. processing ) providing the functionality needed to generate whatever it needs to generate, such as classes in the case of mapstruct.
I tried the solution posed by @Konrad Jamrozik but it didn't work with my project due to flavours in my project.
Given that we're just turning on additional warnings, not something that's significantly changing how the compiler operates, I don't see it being an issue that it will be added to both release and debug builds. As such, this answer has a cleaner method that works with flavours: How to add -Xlint:unchecked to my Android Gradle based project?
In my case, adding this to the build.gradle file of the affected module:
gradle.projectsEvaluated { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With