How to fix the connection to the server was unsuccessful. (file ///android_asset/www/index.html)

后端 未结 8 776
借酒劲吻你
借酒劲吻你 2021-02-02 07:24

I\'ve added material icons to ionic2 app , and since then I get error \"\"The connection to the server was unsuccessful. (file:///android_asset/www/index.html)\"\" although the

8条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-02 07:39

    As of now above solutions will work but the app will take time to load, instead of that you can simply add below in your MainActivity.java super.loadUrl("file:///android_asset/www/index.html");

    In MainActivity.java you have to comment below code loadUrl(launchUrl);

    public class MainActivity extends CordovaActivity
    {
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
    
            // enable Cordova apps to be started in the background
            Bundle extras = getIntent().getExtras();
            if (extras != null && extras.getBoolean("cdvStartInBackground", false)) {
                moveTaskToBack(true);
            }
    
            // Set by  in config.xml
            //loadUrl(launchUrl);
            super.loadUrl("file:///android_asset/www/index.html");
    
        }
    }
    

提交回复
热议问题