Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Apk build warnings - shared_preferences and AsyncTask

Tags:

flutter

Hello whenever I build the apk I get these warnings. I have pretty much no idea what's going on there.

But I think it isn't something about my code.

Can I do something about it or should I just ignore these warnings for now and wait for this package to be updated?

C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:9: warning: [deprecation] AsyncTask in android.os has been deprecated
import android.os.AsyncTask;
                 ^
C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:121: warning: [deprecation] AsyncTask in android.os has been deprecated
    new AsyncTask<Void, Void, Boolean>() {
        ^
C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:121: warning: [deprecation] AsyncTask() in AsyncTask has been deprecated
    new AsyncTask<Void, Void, Boolean>() {
    ^
C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:123: warning: [deprecation] doInBackground(Params...) in AsyncTask has been deprecated
      protected Boolean doInBackground(Void... voids) {
                        ^
  where Params,Result are type-variables:
    Params extends Object declared in class AsyncTask
    Result extends Object declared in class AsyncTask
C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:121: warning: [deprecation] AsyncTask() in AsyncTask has been deprecated
    new AsyncTask<Void, Void, Boolean>() {
                                         ^
C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:128: warning: [deprecation] onPostExecute(Result) in AsyncTask has been deprecated
      protected void onPostExecute(Boolean value) {
                     ^
  where Result is a type-variable:
    Result extends Object declared in class AsyncTask
C:\Apps\flutter\.pub-cache\hosted\pub.dartlang.org\shared_preferences-0.5.12+4\android\src\main\java\io\flutter\plugins\sharedpreferences\MethodCallHandlerImpl.java:131: warning: [deprecation] execute(Params...) in AsyncTask has been deprecated
    }.execute();
     ^
  where Params,Progress,Result are type-variables:
    Params extends Object declared in class AsyncTask
    Progress extends Object declared in class AsyncTask
    Result extends Object declared in class AsyncTask
7 warnings
like image 735
StrangeGirlMurph Avatar asked Nov 21 '20 20:11

StrangeGirlMurph


1 Answers

Right now we can only wait for further update from sharedpreference. If you want to curb the warning then reduce SdkTarget to 29 instead of 30 in android/app/gradle file.

like image 104
Hritik Bhat Avatar answered Nov 18 '22 16:11

Hritik Bhat