Deprecated APIs slowing boot time


#1

Please have a look at the build log when I compiled with XLint to check my deprecated files. I am not getting a clear idea how to optimize the app to speed up the booting time. Currently the boot time of the app is arounf 14 - 30 seconds. The app doesn’t use any heavy animation or lots of plugins, still for some reason the app is slow.
These are the list of plugins i have installed:

    <plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
    <plugin name="cordova-plugin-whitelist" spec="1.3.1" />
    <plugin name="cordova-plugin-console" spec="1.0.5" />
    <plugin name="cordova-plugin-statusbar" spec="2.2.1" />
    <plugin name="cordova-plugin-device" spec="1.1.4" />
    <plugin name="cordova-plugin-splashscreen" spec="~4.0.1" />
    <plugin name="cordova-sqlite-storage" spec="~2.0.2" />
    <plugin name="cordova-plugin-inappbrowser" spec="~1.7.1" />
    <plugin name="cordova-plugin-network-information" spec="~1.3.3" />
    <plugin name="de.appplant.cordova.plugin.local-notification" spec="~0.8.4" />

The version I am building on is:


Cordova CLI: 6.5.0
Ionic Framework Version: 2.3.0
Ionic CLI Version: 2.1.17
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 1.1.4
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 8.1
Node Version: v7.2.1
Xcode version: Not installed

The following is my debug log:



:generateArmv7DebugResValues
 UP-TO-DATE

:generateArmv7DebugResources UP-TO-DATE

:mergeArmv7DebugResources
 UP-TO-DATE

:processArmv7DebugManifest
 UP-TO-DATE

:processArmv7DebugResources
 UP-TO-DATE

:generateArmv7DebugSources UP-TO-DATE

:incrementalArmv7DebugJavaCompilationSafeguard
 UP-TO-DATE

:compileArmv7DebugJavaWithJavac

:compileArmv7DebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:42: warning: [deprecation] CookieSyncManager in android.webkit has been deprecated

import android.webkit.CookieSyncManager;

                     ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:56: warning: [deprecation] Config in org.apache.cordova has been deprecated

import org.apache.cordova.Config;
                         ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\io\sqlc\SQLiteAndroidDatabase.java:519: warning: [deprecation] isNull(int,int) in CursorWindow has been deprecated
        if (cursorWindow.isNull(pos, i)) {
                        ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\io\sqlc\SQLiteAndroidDatabase.java:521: warning: [deprecation] isLong(int,int) in CursorWindow has been deprecated

        } else if (cursorWindow.isLong(pos, i)) {
                               ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\io\sqlc\SQLiteAndroidDatabase.java:523: warning: [deprecation] isFloat(int,int) in CursorWindow has been deprecated
        } else if (cursorWindow.isFloat(pos, i)) {
                               ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:152: warning: [deprecation] Config in org.apache.cordova has been deprecated

                                Method iuw = Config.class.getMethod("isUrlWhiteListed", String.class);

                                             ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:637: warning: [deprecation] getDrawable(int) in Resources has been deprecated
                Drawable backIcon = activityRes.getDrawable(backResId);
                                               ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:641: warning: [deprecation] setBackgroundDrawable(Drawable) in View has been deprecated
                    back.setBackgroundDrawable(null);
                        ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:662: warning: [deprecation] getDrawable(int) in Resources has been deprecated
                Drawable fwdIcon = activityRes.getDrawable(fwdResId);
                                              ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:666: warning: [deprecation] setBackgroundDrawable(Drawable) in View has been deprecated
                    forward.setBackgroundDrawable(null);
                           ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:710: warning: [deprecation] getDrawable(int) in Resources has been deprecated
                Drawable closeIcon = activityRes.getDrawable(closeResId);
                                                ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:714: warning: [deprecation] setBackgroundDrawable(Drawable) in View has been deprecated
                    close.setBackgroundDrawable(null);
                         ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppChromeClient.java:55: warning: [deprecation] onExceededDatabaseQuota(String,String,long,long,long,QuotaUpdater) in WebChromeClient has been deprecated
    public void onExceededDatabaseQuota(String url, String databaseIdentifier, long currentQuota, long estimatedSize,
                ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppChromeClient.java:56: warning: [deprecation] QuotaUpdater in WebStorage has been deprecated
            long totalUsedQuota, WebStorage.QuotaUpdater quotaUpdater)
                                           ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:780: warning: [deprecation] setPluginState(PluginState) in WebSettings has been deprecated
                settings.setPluginState(android.webkit.WebSettings.PluginState.ON);
                        ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:801: warning: [deprecation] setDatabasePath(String) in WebSettings has been deprecated
                    settings.setDatabasePath(databasePath);
                            ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:807: warning: [deprecation] removeAllCookie() in CookieManager has been deprecated
                    CookieManager.getInstance().removeAllCookie();
                                               ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:809: warning: [deprecation] removeSessionCookie() in CookieManager has been deprecated
                    CookieManager.getInstance().removeSessionCookie();
                                               ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:945: warning: [deprecation] shouldOverrideUrlLoading(WebView,String) in WebViewClient has been deprecated

        public boolean shouldOverrideUrlLoading(WebView webView, String url) {
                       ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:1046: warning: [deprecation] CookieSyncManager in android.webkit has been deprecated

                CookieSyncManager.getInstance().sync();
                ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:1046: warning: [deprecation] sync() in CookieSyncManager has been deprecated
                CookieSyncManager.getInstance().sync();
                                               ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:1064: warning: [deprecation] onReceivedError(WebView,int,String,String) in WebViewClient has been deprecated
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                    ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:1065: warning: [deprecation] onReceivedError(WebView,int,String,String) in WebViewClient has been deprecated
            super.onReceivedError(view, errorCode, description, failingUrl);
                 ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\apache\cordova\splashscreen\SplashScreen.java:210: warning: [deprecation] getDrawable(int) in Resources has been deprecated

                    splashImageView.setImageDrawable(cordova.getActivity().getResources().getDrawable(drawableId));
                                                                                         ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\crosswalk\engine\XWalkCordovaResourceClient.java:68: warning: [deprecation] shouldInterceptLoadRequest(XWalkView,String) in XWalkResourceClient has been deprecated
    public WebResourceResponse shouldInterceptLoadRequest(XWalkView view, String url) {
                               ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\crosswalk\engine\XWalkWebViewEngine.java:136: warning: [deprecation] load(String,String) in XWalkView has been deprecated

                    webView.load(startUrl, null);

                           ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\crosswalk\engine\XWalkWebViewEngine.java:309: warning: [deprecation] load(String,String) in XWalkView has been deprecated

        webView.load(url, null);
               ^

C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\crosswalk\engine\XWalkCordovaView.java:94: warning: [deprecation] startActivityForResult(Intent,int,Bundle) in XWalkView has been deprecated

    public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
                ^
C:\Users\Orpheus\Desktop\cc4\platforms\android\src\org\crosswalk\engine\XWalkCordovaView.java:100: warning: [deprecation] onActivityResult(int,int,Intent) in XWalkView has been deprecated
                XWalkCordovaView.this.onActivityResult(requestCode, resultCode, intent);
                                     ^

29 warnings

Please help me out so that I can improve my app.


#2

You have to run the build process with the --prod flag at the end to use AOT.
Run ionic cordova run android --prod


#3

All the has been deprecated messages you posted here come from cordova-android or Cordova plugins and are out of control of Ionic. You would have to talk to the Cordova people if they see a problem in this or not.

But normally these are not a problem, deprecated only means that it can be removed soon - not that it is slow in any way.


#4

This reminds me of government offices where they make me run from floor to floor for fixing an issue. When a plugin that Ionic uses it should MAKE SURE that it is free of bugs before production. It is waste of resource and money if we use such buggy plugins in production sometimes.

Anyways I figured out a solution. Thanks for help.


#5

I am sure you can pay the company working on Ionic or many Ionic freelancers here appropiate amounts of money to fix these plugins to your requirements.

Most of the notices were triggered by Crosswalk by the way - which is not part of any default Ionic template.

Could you share that solution with the rest of the forum?


#6

I am sure you can pay the company working on Ionic or many Ionic freelancers here appropiate amounts of money to fix these plugins to your requirements.

Sure thing :smiley: