Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

deprecated warning while compiling

i have a question regarding development environments settings. i am trying to see if there is any possibility to make a compilation warning in a development environment(eclipse,android studio)for android applications using a deprecated feature(could be a method , constructor or whatever you can think of ). until now i am working manually to find the use of this deprecated features , and my boss asked me to look for an automatic settings in my idea ...

so lets say for a specific code :

 protected void onPrepareDialog(int paramInt, Dialog paramDialog)
  {
    try
    {
      super.onPrepareDialog(paramInt, paramDialog);
      AlertDialog localAlertDialog = (AlertDialog)paramDialog;
      localAlertDialog.setTitle("Passphrase required");
      ((TextView)localAlertDialog.findViewById(2131230727)).setText(Preferences.getConfigName(this, getConfigFile()));
      Button localButton = localAlertDialog.getButton(-3);
      if (this.mOpenVpnService != null);
      for (boolean bool = true; ; bool = false)
      {
        localButton.setEnabled(bool);
        return;
      }

i have several deprecated features here , and android studio declares it , but what i need is a configuration for this warning to be automated and save me the need of walking through each class manually ...

like image 320
TubusMan Avatar asked Dec 30 '14 11:12

TubusMan


People also ask

What does is deprecated warning mean?

Deprecation warnings are a common thing in our industry. They are warnings that notify us that a specific feature (e.g. a method) will be removed soon (usually in the next minor or major version) and should be replaced with something else.

What is deprecation warning in node JS?

In Node. js, util. deprecate() wraps around a function in such a way that the function is marked deprecated. util. deprecate() throws a warning on STDERR , along with the supplied ERRCODE .

What does deprecation warning mean in Python?

removing is danger because user may used that and if a developer want to remove a thing first have to notify others to don't use this feature or things and after this he can remove. and DeprecationWarning is this notification.


1 Answers

For me the best solution is add this lines in the file build.gradle(project:appname)

allprojects {
tasks.withType(JavaCompile) {
    options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}

Then all the deprecated methods in the java files appear in the build tab: deprecated api tab android studio

This works on gradle 5.1.1

like image 153
Evilripper Avatar answered Oct 20 '22 17:10

Evilripper