Application error the connection to the server was unsuccessful file android asset www index html

Application Error The connection to the server was unsuccessful. (file:///android_asset/www/index.html) I'm getting this error only the first time the app runs after being installed. Subsequent...

@lostintangent

I just managed to reproduce it again!

  1. Publish APK v1.0.0 to (beta) Play Store
  2. Publish mandatory update targeting "^1.0.0"
  3. Install the beta and run the app
  4. Publish APK v1.0.1 to (beta) Play Store
  5. Install the beta and run the app — it now breaks with the Application Error from above

I’ve included the log from my test device below or at least the parts pertaining to the process id 18103:

05-04 13:23:36.930   777 10374 I ActivityManager: Start proc 18103:com.example.app/u0a184 for activity com.example.app/.MainActivity
05-04 13:23:36.939  1825  1825 I MicroDetector: Keeping mic open: false
05-04 13:23:36.939  1825  1825 I MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.ah@7bd9d83
05-04 13:23:36.939  1825 18065 I DeviceStateChecker: DeviceStateChecker cancelled
05-04 13:23:36.939  1825 18018 E AudioRecord-JNI: Error -4 during AudioRecord native read
05-04 13:23:36.985   203 18068 D audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record
05-04 13:23:36.985   203 18068 D audio_hw_primary: disable_snd_device: snd_device(61: voice-rec-mic)
05-04 13:23:36.991  1825 18066 I MicroRecognitionRunner: Detection finished
05-04 13:23:36.991  1825  7361 I MicroRecognitionRunner: Stopping hotword detection.
05-04 13:23:37.051 18103 18103 D XWalkLib: Pre init xwalk core in com.example.app.MainActivity
05-04 13:23:37.058 18103 18103 D XWalkLib: Reserve class class org.xwalk.core.XWalkPreferences to com.example.app.MainActivity
05-04 13:23:37.058 18103 18103 D XWalkLib: Reserve method setValue to com.example.app.MainActivity
05-04 13:23:37.059 18103 18103 D XWalkLib: Reserve class class org.xwalk.core.XWalkPreferences to com.example.app.MainActivity
05-04 13:23:37.059 18103 18103 D XWalkLib: Reserve method setValue to com.example.app.MainActivity
05-04 13:23:37.059 18103 18103 D XWalkLib: Reserve class class org.xwalk.core.XWalkPreferences to com.example.app.MainActivity
05-04 13:23:37.059 18103 18103 D XWalkLib: Reserve method setValue to com.example.app.MainActivity
05-04 13:23:37.063 18103 18103 D XWalkLib: Reserve object class org.crosswalk.engine.XWalkCordovaView to com.example.app.MainActivity
05-04 13:23:37.072 18103 18103 D XWalkLib: Reserve object class org.crosswalk.engine.XWalkCordovaResourceClient to com.example.app.MainActivity
05-04 13:23:37.072 18103 18103 D XWalkLib: Reserve method setResourceClient to com.example.app.MainActivity
05-04 13:23:37.073 18103 18103 D XWalkLib: Reserve object class org.crosswalk.engine.XWalkCordovaUiClient to com.example.app.MainActivity
05-04 13:23:37.073 18103 18103 D XWalkLib: Reserve method setUIClient to com.example.app.MainActivity
05-04 13:23:37.131 18103 18121 D OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true
05-04 13:23:37.182 18103 18103 V StatusBar: StatusBar: initialization
05-04 13:23:37.290 18103 18103 D XWalkActivity: Initialize by XWalkActivity
05-04 13:23:37.290 18103 18103 D XWalkLib: DecompressTask started
05-04 13:23:37.291 18103 18103 W ResourceType: No package identifier when getting value for resource number 0x00000000
05-04 13:23:37.307 18103 18121 I Adreno-EGL: <qeglDrvAPI_eglInitialize:379>: QUALCOMM Build: 10/21/15, 369a2ea, I96aee987eb
05-04 13:23:37.309 18103 18121 I OpenGLRenderer: Initialized EGL, version 1.4
05-04 13:23:37.375   777  1536 I WindowManager: Switching to real app window: Window{89ef657 u0 com.example.app/com.example.app.MainActivity}
05-04 13:23:37.377 18103 18103 D XWalkLib: DecompressTask finished, 0
05-04 13:23:37.378  1588  1588 I Keyboard.Facilitator: onFinishInput()
05-04 13:23:37.379 18103 18103 D XWalkLib: ActivateTask started
05-04 13:23:37.380 18103 18137 D XWalkLib: Attach xwalk core
05-04 13:23:37.389 18103 18137 D XWalkLib: lib version, api:5, min api:5
05-04 13:23:37.389 18103 18137 D XWalkLib: app version, api:5, min api:5
05-04 13:23:37.566   777   799 I ActivityManager: Displayed com.example.app/.MainActivity: +652ms (total +5m52s235ms)
05-04 13:23:37.602 18103 18137 I LibraryLoader: Time to load native libraries: 4 ms (timestamps 5108-5112)
05-04 13:23:37.602   777 10374 W InputMethodManagerService: Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@44c594f attribute=null, token = android.os.BinderProxy@e81910a
05-04 13:23:37.605 18103 18137 I LibraryLoader: Expected native library version number "",actual native library version number ""
05-04 13:23:37.605 18103 18137 D XWalkLib: Running in embedded mode
05-04 13:23:37.614 18103 18103 D XWalkLib: Dock xwalk core
05-04 13:23:37.614 18103 18103 D XWalkLib: Init core bridge
05-04 13:23:37.615 18103 18103 D XWalkLib: Init xwalk view
05-04 13:23:37.620   777   883 D ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 129]
05-04 13:23:37.639 18103 18103 I LibraryLoader: Expected native library version number "",actual native library version number ""
05-04 13:23:37.639 18103 18103 I chromium: [INFO:library_loader_hooks.cc(120)] Chromium logging enabled: level = 0, default verbosity = 0
05-04 13:23:37.641 18103 18103 I BrowserStartupController: Initializing chromium process, singleProcess=true
05-04 13:23:37.820 18103 18144 I ResourceExtractor: Extracting resource xwalk.pak
05-04 13:23:37.836 18103 18144 I ResourceExtractor: Extracting resource icudtl.dat
05-04 13:23:37.913 18103 18103 E SysUtils: ApplicationContext is null in ApplicationStatus
05-04 13:23:37.948 18103 18103 E libEGL  : validate_display:255 error 3008 (EGL_BAD_DISPLAY)
05-04 13:23:37.948 18103 18103 E libEGL  : validate_display:255 error 3008 (EGL_BAD_DISPLAY)
05-04 13:23:37.991 18103 18157 W AudioManagerAndroid: Requires BLUETOOTH permission
05-04 13:23:37.993 18103 18103 D XWalkLib: Post init xwalk core in com.example.app.MainActivity
05-04 13:23:37.993 18103 18103 D XWalkLib: Init reserved class: class org.xwalk.core.XWalkPreferences
05-04 13:23:37.993 18103 18103 D XWalkLib: Call reserved method: public static void org.xwalk.core.internal.XWalkPreferencesBridge.setValue(java.lang.String,boolean)
05-04 13:23:37.993 18103 18103 D XWalkLib: Init reserved class: class org.xwalk.core.XWalkPreferences
05-04 13:23:37.993 18103 18103 D XWalkLib: Call reserved method: public static void org.xwalk.core.internal.XWalkPreferencesBridge.setValue(java.lang.String,boolean)
05-04 13:23:37.993 18103 18103 D XWalkLib: Init reserved class: class org.xwalk.core.XWalkPreferences
05-04 13:23:37.994 18103 18103 D XWalkLib: Call reserved method: public static void org.xwalk.core.internal.XWalkPreferencesBridge.setValue(java.lang.String,boolean)
05-04 13:23:37.994 18103 18103 D XWalkLib: Init reserved object: class org.crosswalk.engine.XWalkCordovaView
05-04 13:23:38.018 18103 18103 E chromium: [ERROR:xwalk_platform_notification_service.cc(103)] Not implemented reached in virtual bool xwalk::XWalkPlatformNotificationService::GetDisplayedPersistentNotifications(content::BrowserContext*, std::set<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >*)
05-04 13:23:38.027 18103 18103 E chromium: [ERROR:xwalk_browser_context.cc(79)] Failed to read preference, error num: 0
05-04 13:23:38.091 18103 18103 W VideoCapabilities: Unrecognized profile 2130706433 for video/avc
05-04 13:23:38.114 18103 18103 I VideoCapabilities: Unsupported profile 4 for video/mp4v-es
05-04 13:23:38.149 18103 18103 D XWalkLib: Init reserved object: class org.crosswalk.engine.XWalkCordovaResourceClient
05-04 13:23:38.150 18103 18103 D XWalkLib: Call reserved method: public void org.xwalk.core.internal.XWalkViewBridge.setResourceClientSuper(org.xwalk.core.internal.XWalkResourceClientBridge)
05-04 13:23:38.150 18103 18103 D XWalkLib: Init reserved object: class org.crosswalk.engine.XWalkCordovaUiClient
05-04 13:23:38.152 18103 18103 D XWalkLib: Call reserved method: public void org.xwalk.core.internal.XWalkViewBridge.setUIClientSuper(org.xwalk.core.internal.XWalkUIClientBridge)
05-04 13:23:38.152 18103 18103 D XWalkLib: ActivateTask finished, 1
05-04 13:23:38.186 18103 18162 I chromium: [INFO:xwalk_extension_renderer_controller.cc(47)] EXTENSION PROCESS DISABLED.
05-04 13:23:38.196 18103 18103 I Choreographer: Skipped 34 frames!  The application may be doing too much work on its main thread.
05-04 13:23:38.359 18103 18103 I chromium: [INFO:CONSOLE(1)] "Uncaught TypeError: Cannot read property 'reportStatus' of undefined", source:  (1)
05-04 13:23:39.319   777   958 I ActivityManager: Killing 17075:com.google.android.apps.docs/u0a35 (adj 15): empty #17
05-04 13:23:40.407  1588  1588 I Keyboard.Facilitator: onFinishInput()
05-04 13:23:43.669   777   883 D ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 129]
05-04 13:23:45.450   777 13212 D NetlinkSocketObserver: NeighborEvent{elapsedMs=93184715, 10.10.10.1, [E05FB9B2666D], RTM_NEWNEIGH, NUD_STALE}
05-04 13:23:49.745   777   883 D ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 129]
05-04 13:23:52.089   777 13212 D NetlinkSocketObserver: NeighborEvent{elapsedMs=93191355, 10.10.10.1, [E05FB9B2666D], RTM_NEWNEIGH, NUD_REACHABLE}
05-04 13:23:55.769   777 13212 D NetlinkSocketObserver: NeighborEvent{elapsedMs=93195034, 10.10.10.1, [E05FB9B2666D], RTM_NEWNEIGH, NUD_STALE}
05-04 13:23:57.187 18103 18103 E CordovaWebViewImpl: CordovaWebView: TIMEOUT ERROR!

Here is the alert with the Application Error. I wait a bunch before pressing ok and resuming the app. This is what it writes after resuming.

05-04 13:30:52.680 18103 18103 W ScreenOrientationListener: Removing an inexistent observer!
05-04 13:30:53.920   777   883 D ConnectivityService: notifyType CAP_CHANGED for NetworkAgentInfo [WIFI () - 129]
05-04 13:30:54.391   777 10373 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.example.app/.MainActivity bnds=[804,573][1068,870] (has extras)} from uid 10019 on display 0
05-04 13:30:54.414  1825  1836 W SearchService: Abort, client detached.
05-04 13:30:54.458  1825 18993 I DeviceStateChecker: DeviceStateChecker cancelled
05-04 13:30:54.472  1825  1825 I MicroDetector: Keeping mic open: false
05-04 13:30:54.473  1825  1825 I MicrophoneInputStream: mic_close com.google.android.apps.gsa.speech.audio.ah@6b697d8
05-04 13:30:54.473  1825 18990 E AudioRecord-JNI: Error -4 during AudioRecord native read
05-04 13:30:54.508 18103 18103 V StatusBar: StatusBar: initialization
05-04 13:30:54.512 18103 18103 D XWalkActivity: Activate by XWalkActivity
05-04 13:30:54.512 18103 18103 D XWalkLib: ActivateTask started
05-04 13:30:54.518   203 18996 D audio_hw_primary: disable_audio_route: reset and update mixer path: audio-record
05-04 13:30:54.518   203 18996 D audio_hw_primary: disable_snd_device: snd_device(61: voice-rec-mic)
05-04 13:30:54.519 18103 18103 D XWalkLib: ActivateTask finished, -1
05-04 13:30:54.527  1825  7361 I MicroRecognitionRunner: Stopping hotword detection.
05-04 13:30:54.528  1825 18994 I MicroRecognitionRunner: Detection finished
05-04 13:30:54.592   777   799 I ActivityManager: Displayed com.example.app/.MainActivity: +173ms
05-04 13:30:54.598  1588  1588 I Keyboard.Facilitator: onFinishInput()
05-04 13:30:54.614 18103 18103 W BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 18103
05-04 13:30:54.852 18103 18103 D JsMessageQueue: Set native->JS mode to OnlineEventsBridgeMode
05-04 13:30:55.164 18103 18171 D CordovaNetworkManager: toLower : wifi
05-04 13:30:55.164 18103 18171 D CordovaNetworkManager: wifi : wifi
05-04 13:30:55.164 18103 18171 D CordovaNetworkManager: Connection Type: wifi
...

Содержание

  1. Ошибка приложения. Соединение с сервером не увенчалось успехом. (Файл:///android_asset/www/index.html)
  2. ОТВЕТЫ
  3. Ответ 1
  4. Ответ 2
  5. Ответ 3
  6. Ответ 4
  7. Ответ 5
  8. Ответ 6
  9. Ответ 7
  10. Ответ 8
  11. Ответ 9
  12. Ответ 10
  13. Ответ 11
  14. Ответ 12
  15. Ответ 13
  16. Ответ 14
  17. Application Error — The connection to the server was unsuccessful #3759
  18. Comments
  19. Application Error: «The connection to the server was unsuccessful. (file:///android_asset/www/index.html)» #111
  20. Comments
  21. Environment
  22. Flavor screenshot
  23. Plugins
  24. Symptoms
  25. Application Error connection to the server was unsuccessful. #9905
  26. Comments

Ошибка приложения. Соединение с сервером не увенчалось успехом. (Файл:///android_asset/www/index.html)

App Dies On Startup (подключение к серверу не увенчалось успехом)

У меня есть приложение для Android, которое я пишу, используя PhoneGap BUILD. Приложение работает нормально раньше, но теперь кажется, что я получаю эту ошибку после уточнения моего приложения (некоторые изменения пользовательского интерфейса 0nly)

1) Когда я запускаю приложение, я (обычно) получаю:

Ошибка приложения. Соединение с сервером не увенчалось успехом. (файл:///android_asset/www/index.html)

Извините, если это дублирование любого вопроса. Я видел некоторые подобные вопросы здесь, но я не мог найти идеальный ответ или решение. Как и в моем случае, он работал нормально до моих последних изменений.

ОТВЕТЫ

Ответ 1

Как вы сказали, есть много повторяющихся вопросов по одной теме. Любые объяснения вашей ситуации.

Проблема может быть решена путем добавления таймаута для вызова вашего index.html

т.е. вам нужно добавить super.setIntegerProperty(«loadUrlTimeoutValue», 70000); в файл activity.java(внутри src/com/yourProj/-/youractivity.java) над этой строкой: super.loadUrl(«file:///android_asset/www/index.html»);

Объяснение:

Это может произойти по следующим причинам.

Основная причина: проблема, вероятно, связана со скоростью эмулятора, поэтому сеть слишком медленно завершает коммуникацию своевременно.

Это может быть вызвано:

  • Ваш код/​​данные/изображение имеют слишком большой размер (я полагаю, в вашем случае вы используете некоторые изображения, так как вы сказали, что сделали некоторые изменения в пользовательском интерфейсе, может быть размер изображений высок).
  • Ваш script может иметь бесконечный или длинный цикл, так что требуется слишком много времени для загрузки.
  • Вы будете использовать слишком много скриптов (jQuery, iscroll и т.д. и т.д. больше плагинов или скриптов).

Ответ 2

В файле config.xml добавьте эту строку:

Ответ 3

Вот рабочее решение

создать новую страницу main.html

измените следующее в mainactivity.java

Теперь создайте приложение и работайте над любым медленным подключением

ПРИМЕЧАНИЕ. Это обходной путь, который я нашел в 2013 году.

Ответ 4

Удалите удаленные файлы jQuery, например: https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

Вместо этого загрузите этот файл и загрузите его из локальной папки js, создав URI:

Ответ 5

1.Назовите свой index.html на «main.html»

2.Создайте новый «index.html» и поместите в него следующий контент:

3. Создайте приложение! Больше ошибок!

Ответ 6

Удалите внешние скрипты в вашем index.html

Ответ 7

У меня было то же самое в моем проекте.

Я попробовал «super.setIntegerProperty(» loadUrlTimeoutValue «, 70000);» но безрезультатно.

Я гарантировал, что все файлы были правильно связаны [CSS, JS файлы и т.д.], проверили HTML с помощью w3c validator [http://validator.w3.org/#validate_by_upload] и очистил проект [Project → Clean]

Теперь он загружается и выполняется без такой же ошибки.

Надеюсь, что это поможет

Ответ 8

У меня была аналогичная проблема, и, основываясь на вышеприведенных предложениях, я впервые добавил «super.setIntegerProperty(» loadUrlTimeoutValue «, 70000); но это не помогло. Поэтому я попробовал Project → Clean, это сработало, и я могу запустить приложение прямо сейчас.

Ответ 9

Расширение ограничения времени ожидания загрузки не решит проблему, вызвавшую ошибку, она просто позволит системе отображать сообщение, но производительность будет затронута.

Фактическая причина. Возможно, вы связываете файлы или изображения с удаленными местами, и эти ресурсы слишком долго загружаются. (это, скорее всего, самая распространенная ошибка)

Окончательное решение: переместите все сценарии, изображения и css в некоторые локальные папки и загрузите их локально.

Производительность будет увеличена, и ошибка будет эффективно решена.

Ответ 10

В моем случае я использую ионный, и я просто закрыл диалог, отправленный в приложения в эмуляторе, и вместо этого запустил мое приложение. Это сработало. У меня появилась идея этого отсюда, поскольку это была всего лишь проблема с тайм-аутом.

Ответ 11

Проверьте файл index.html . Если вы используете внешние ресурсы, недоступные при запуске приложения, вы можете получить эту ошибку.

В моем случае я забыл удалить ссылку на отладчик script (weinre).

Итак, приложение работало над эмулятором, потому что http://192.168.0.102:8080/ был на моем локальном хосте и доступен для эмулятора.

Но когда я настраивал приложение на мобильный телефон, у меня была такая же ошибка, потому что 192.168.0.102 не был доступен из мобильной сети.

Ответ 12

Если вы используете визуальную студию. После изменения config.xml иногда вам понадобится

решение для чистой сборки перестройте свое приложение

Он работает для меня.

Ответ 13

Ответ 14

Другая причина, по которой может возникнуть эта ошибка, — это index.html в . /YourApp/www/ !

Я просто последовал за ионным руководством, и один из шагов:

Источник

Application Error — The connection to the server was unsuccessful #3759

Description:
When trying to launch emulator with Ionic 4 project, I am getting errors.
I am running command in VS Code bash command line:
ionic cordova emulate android —livereload —verbose
I am getting the following error last time —
[cordova] Command finished with error code 0: C:UsersGaryAppDataLocalAndroidSdkplatform-toolsadb.exe -s,emulator-5554,shell,am,start,-W,-a,android.intent.action.MAIN,-nio.ionic.starter/.MainActivity

Steps to Reproduce:

  1. Download My Github repo: https://github.com/gchan82/heartstoneLibApp
  2. run npm install
    +/-3. launch android studio emulator (Nexus 6, API 28 or Pixel 2, API 23)
  3. run: ionic cordova emulate android —livereload —verbose
  4. You will see errors (on Windows 8.1)

If I do not perform part 3 above, I get this constantly looping:
[cordova] Command finished with error code 1: C:UsersGaryAppDataLocalAndroidSdkplatform-toolsadb.exe -s,emulator-5584,shell,getprop,dev.bootcomplete
[cordova] Running adb shell command «getprop dev.bootcomplete» on target emulator-5584.
[cordova] Running command: C:UsersGaryAppDataLocalAndroidSdkplatform-toolsadb.exe -s emulator-5584 shell getprop dev.bootcomplete

Output:
Emulator shows: System UI isn’t responding X Close app, or Wait.
Emulator shows: Application Error — The connection to the server was unsuccessful (http://192.168.103.129:8100)
Upon clicking «OK», screen turns white.

When I ctrl+c to stop the process, I get this error:
ionic:cli-framework:utils:process error while killing process tree for 7700: < Error: Command failed: taskkill /pid 7700 /T /F
ionic:cli-framework:utils:process ERROR: The process «7700» not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process at ChildProcess.exithandler (child_process.js:275:12)
ionic:cli-framework:utils:process at emitTwo (events.js:126:13)
ionic:cli-framework:utils:process at ChildProcess.emit (events.js:214:7)
ionic:cli-framework:utils:process at maybeClose (internal/child_process.js:925:16)
ionic:cli-framework:utils:process at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
ionic:cli-framework:utils:process killed: false,
ionic:cli-framework:utils:process code: 128,
ionic:cli-framework:utils:process signal: null,
ionic:cli-framework:utils:process cmd: ‘taskkill /pid 7700 /T /F’ > +2s
ionic:cli-framework:utils:process onBeforeExit handler: error from function: < Error: Command failed: taskkill /pid 7700 /T /F
ionic:cli-framework:utils:process ERROR: The process «7700» not found.
ionic:cli-framework:utils:process
ionic:cli-framework:utils:process at ChildProcess.exithandler (child_process.js:275:12)
ionic:cli-framework:utils:process at emitTwo (events.js:126:13)
ionic:cli-framework:utils:process at ChildProcess.emit (events.js:214:7)
ionic:cli-framework:utils:process at maybeClose (internal/child_process.js:925:16)
ionic:cli-framework:utils:process at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
ionic:cli-framework:utils:process killed: false,
ionic:cli-framework:utils:process code: 128,
ionic:cli-framework:utils:process signal: null,
ionic:cli-framework:utils:process cmd: ‘taskkill /pid 7700 /T /F’ > +12ms
ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 0) +11ms

My ionic info :
ionic (Ionic CLI) : 4.3.1 (C:UsersGaryAppDataRoamingnpmnode_modulesionic)
Ionic Framework : @ionic/angular 4.0.0-beta.3
@angular-devkit/build-angular : 0.7.4
@angular-devkit/schematics : 0.7.4
@angular/cli : 6.1.4
@ionic/angular-toolkit : not installed

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, browser 5.0.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.5, (and 3 other plugins)

Android SDK Tools : 26.1.1 (C:/Users/Gary/AppData/Local/Android/sdk)
NodeJS : v8.11.4 (C:Program Filesnodejsnode.exe)
npm : 6.4.1
OS : Windows 8.1

Other Information:
I have tried updating adb.exe, & updating android studio.
I have tried:
ionic cordova platform rm android
ionic cordova platform add android
Updating to Nexus 6, API 28 (was using Pixel 2, API 23)

The text was updated successfully, but these errors were encountered:

Источник

Application Error: «The connection to the server was unsuccessful. (file:///android_asset/www/index.html)» #111

Application Error
The connection to the server was unsuccessful. (file:///android_asset/www/index.html)

I’m getting this error only the first time the app runs after being installed. Subsequent runs are fine.

on deviceready and resume .

Environment

Edit: I’ve only experienced this on Android — not on iOS.

Flavor screenshot

The text was updated successfully, but these errors were encountered:

I believe that error can indicates that the app took too long to startup. Are you already using a splash screen? If you remove the CodePush plugin, does this error go away? We try to make sure we have as little impact on app start as possible, but it’s possible that something is going on here.

Also, could you list out the Cordova plugins your app is using and their versions (via cordova plugin ls ). Thanks!

Plugins

Symptoms

  • Error occurs after 3-4 seconds
  • The app uses a splash screen
  • Error goes away when removing the plugin

I’ll try and see what happens if I don’t call sync too

Yeah that definitely sounds like an app start timeout. If you could add the plugin back and just not call sync , and see if you get the error, that would be hugely helpful. In the meantime, we’ll take a look at this and see if we can repro it with the same plugins. Thanks for reporting this!

Two other quick questions:

  1. Could you let us know the version of Cordova Android you’re using by running cordova platform ls ?
  2. Does your config.xml already contain the following element?

If so, what is the value? If you update it to a larger value (e.g. 7000, 10000), does this error go away?

  1. cordova platform ls => android 5.1.1
  2. It does not contain the delay.

Update: Some time has elapsed and I’m no longer able to reproduce the error. I’ll do some more experimentation and get back to you with more information when/if I manage to make it error again..

Supposing it is due to a timeout, is there (or will there be) a solid solution for that?

And thanks by the way for the very quick help/feedback!

If it’s a timeout issue, we will definitely make sure to find a solution for that 🙂 We haven’t seen any perf issues on startup before, so I’m assuming that it may be due to some interop with another plugin or some other issue. We’ll investigate this today and will hopefully be able to repro it. Stay tuned!

@plougsgaard Have you been able to continue reproing this issue? (I noticed your update and was just curious)

@lostintangent I haven’t been able to reproduce the issue at all, though not for lack of trying. The only change I did was set the mode to InstallMode.ON_NEXT_RESUME .

I’ll close the issue seeing as it hasn’t happened in a while. If I manage to get it failing again I’ll try to see if I can provide some more details and maybe reopen this one. Cheers!

I just managed to reproduce it again!

  1. Publish APK v1.0.0 to (beta) Play Store
  2. Publish mandatory update targeting «^1.0.0»
  3. Install the beta and run the app
  4. Publish APK v1.0.1 to (beta) Play Store
  5. Install the beta and run the app — it now breaks with the Application Error from above

I’ve included the log from my test device below or at least the parts pertaining to the process id 18103:

Here is the alert with the Application Error. I wait a bunch before pressing ok and resuming the app. This is what it writes after resuming.

Источник

Application Error connection to the server was unsuccessful. #9905

Ionic version: (check one with «x»)
[ ] 1.x
[x] 2.x

I’m submitting a . (check one with «x»)
[x ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

This is the Ionic 2 starter app — cutepuppypics, worked fine till recently. After upgrading to ionic framework Rc3 , during builds it throws an Error — when I do «ionic run android»

-Application Error
connection to the server was unsuccessful. File://android_asset/www/index.html
Tried reinstalling android platform and all.

I have tried the all the starter templates of ionic 2 and its the same result across 2 different linux machines and windows machine too.
Interestingly it works fine in the android emulator, however fails on the mobile devices.

Any help will be appreciated.

Expected behavior:

Steps to reproduce:

Related code:
chrome browser output

Hello Walkthrough Page
main.js:1949 Angular 2 is running in the development mode. Call enableProdMode() to enable the production mode.
cordova.js:1185 deviceready has not fired after 5 seconds.
main.js:25553 Native: deviceready did not fire within 2000ms. This can happen when plugins are in an inconsistent state. Try removing plugins from plugins/ and reinstalling them.
(anonymous) @ main.js:25553
t.invokeTask @ polyfills.js:3
e.runTask @ polyfills.js:3
invoke @ polyfills.js:3
main.js:25548 DEVICE READY FIRED AFTER 21651 ms

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

On Opensuse 42.2 Linux machine with nvm installed

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.48
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.1
Node Version: v6.9.0
Xcode version: Not installed

The text was updated successfully, but these errors were encountered:

Источник

App Dies On Startup (connection to the server was unsuccessful)

I have an Android application that I’m writing using PhoneGap BUILD. The app was working fine earlier, but now it seems I am getting this error after refining my app (some UI changes only)

1) When I start the app I (usually) get:

Application Error — The connection to the server was unsuccessful.
(file:///android_asset/www/index.html)

Sorry if this is duplication of any question. I have seen some similar questions here, but i couldn’t find a perfect answer or solution. As in my case it was working fine until my last changes.

1) Solution

In your config.xml file add this line:

<preference name="loadUrlTimeoutValue" value="700000" />
2) Solution

As you said, there are many duplicate questions on the same topic. Any how explaining your situation.

The problem might be solved by adding a timeout to call your index.html

ie you need to add super.setIntegerProperty("loadUrlTimeoutValue", 70000); in your activity.java file ( inside src/com/yourProj/—/youractivity.java)
above this line: super.loadUrl("file:///android_asset/www/index.html");

Explanation:

This can be happened due to the following reasons

The core reason: the problem is likely due to the speed of the emulator so the network is too slow complete the communication in a timely fashion.

This can be due to:

  1. Your code/data/image is of too much of size ( I guess in your case you are using some images ,as you said you made some UI modifications, may be the size of images are high)
  2. Your script may have a infinite or long loop, so that it takes too much of time to load.
  3. You will be using too much of scripts (jQuery, iscroll, etc etc.. more number of plugins or scripts )
3) Solution

Here is the working solution

create a new page main.html

example:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script>
     window.location='./index.html';
   </script>
  </head>
  <body>
  </body>
</html>

change the following in mainactivity.java

super.loadUrl("file:///android_asset/www/index.html");

to

super.loadUrl("file:///android_asset/www/main.html");

Now build your application and it works on any slow connection

refernce (http://www.robertkehoe.com/2013/01/fix-for-phonegap-connection-to-server-was-unsuccessful/).

NOTE: This is a workaround I found in 2013.

4) Solution

Please remove remotely linked jQuery files such as:
https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

Instead, download this file and load it from your local js folder, making the URI:

js/jquery.min.js

5) Solution

Remove the external scripts in your index.html

Change this:

<script src="http://code.highcharts.com/highcharts-more.js"></script>

to

<script src="project_folder/highcharts-more.js"></script>
6) Solution

fixing this on an ionic app, simply add

<preference name="loadUrlTimeoutValue" value="700000" />

to your config.xml file immediately after this line

<platform name="android">
7) Solution

Try this,

1.Rename your index.html to “main.html”

2.Create a new “index.html” and put the following content into it:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script>
     window.location='./main.html';
   </script>
  <body>
  </body>
</html>

3.Rebuild your app! No more errors!

8) Solution

I had a similar issue and based on above suggestions I first added «super.setIntegerProperty(«loadUrlTimeoutValue», 70000);» but that did not help.
So I tried Project -> Clean, that worked and I can launch the app now !

Avinash…

9) Solution

I had the same on my project.

I tried » super.setIntegerProperty(«loadUrlTimeoutValue», 70000); » but to no avail.

I ensured all files were linked properly [ CSS, JS files etc ], validated the HTML using w3c validator [ http://validator.w3.org/#validate_by_upload ] , and cleaned the project [ Project -> Clean ]

It now loads and executes without the same error.

Hope this helps

10) Solution

Extending loading Timeout Limit will not solve the problem which caused the error, it just will avoid the system to show the message but performance will be affected whatsoever.

Actual reason: You may be linking files or images to remote locations, and those resources are taking too long to load. (this is likely the most common error)

Definitive solution: move all the scripts, images and css needed to some local folders and load them locally …

Performance will be increased and error will be effectively solved.

11) Solution

Check you index.html file. If you use external resources, that not available when you run application then you can get this error.

In my case I forgot to delete link on debugger script (weinre).

<script src="http://192.168.0.102:8080/target/target-script-min.js#anonymous"></script>

So application worked on emulator because http://192.168.0.102:8080/ was on my localhost and available for emulator.

But when I setup application on mobile phone I had same error, because 192.168.0.102 was not available from mobile network.

12) Solution

For my case, the problem was due to losing of the internet connection in my WiFi.

13) Solution

I was facing the same issue. I noticed that in my index i had both the «on device ready» and the «document.ready» function, so removing one of them fixed my problem :)

14) Solution

If you are using visual studio. After changing config.xml sometimes you need this

clean build solution
rebuild your app

It is working for me.

15) Solution

In my case I am using ionic and I simply closed the dialog went to apps in the emulator and ran my app from there instead. This worked. I got the idea of that from here since it was just a time out issue.

16) Solution

It’s quite a niche situation but thought I’d post it here in case it saves somebody else the hours I spent going round in circles.

I reverted to [email protected] after trying out [email protected] and started getting this error when trying to run my app in dev mode.

What I had forgotten is that when I upgraded to 10.0.1 I had to remove the whitelist plugin since it’s now part of cordova-android.

Reinstating cordova-plugin-whitelist got everything working again for me!

17) Solution

Another reason this error might occur is: there is no index.html in .../YourApp/www/ !

I just followed the ionic guide (http://ionicframework.com/docs/guide/), and one of the steps is:

$ rm www/index.html

On iOS this is no problem as during the build the compiler takes some default HTML instead. However, when building for android, NO example index.html is used. Took me sometime to find out («WHY does it work on iOS, but not on android…?)

Easy solution: create a index.html, save it under .../YourApp/www, rebuild …et voila!

Comments Section

What happened in my case is that I still had a script tag pointing to a local instance of Weinre. Weinre was not running. Hence — timeouts.

I am creating app using phonegap through devgirl.org/2013/07/17/… (http://devgirl.org/2013/07/17/tutorial-implement-push-notifications-in-your-phonegap-application/) this tutorial. Could you please tell me where i have to this setIntegerproperty.

-1 «the problem is likely due to the speed of the emulator so the network is too slow» — implausible, as no network is involved! That url is to a local android asset.

Actually you just rename your index.html and create main.html with window.location = ‘./index.html’. No need to change super.loadUrl from MainActivity.java

Same effect! But your actual page will be changed to main.html. But I want my actually page to be index.html.BTW, I think your comment is wrong. You need to rename index.html to main.html and create a index.html page, then add window.location = './main.html'. in index.html page. This should work.

Yes you right! I miss typed that one :D I meant that create index.html with window.location = ‘./main.html’. :)

Why you need your actual page to be index.html?

You should describe this as well

and what should i do if i have to add some arguments like main.html?USER=xxx&SESSION=xxx ?

window.location.href=»./main.html?USER=xxx&SESSION=xxx»

For anyone wondering: It’s the amount of time in milliseconds waited while loading the page before throwing an error: cordova.apache.org/docs/en/latest/config_ref/index.html

No cordova and plugins being injected into main.html

<preference name="loadUrlTimeoutValue" value="120000" /> is better in compare with 700000, I mean if your app is not coming up in two minutes, then there is something wrong(and you should fix it by using another solution). Surly you don’t want to wait about 11 minutes to see if an app is coming up or not!(that’s why we do have timeout concept in the first place, right?:-)) According to the doc, default value is 20000 (20 seconds)

i added this in my config file,but its not working on nexus 5x

i added this in my config file,but its not working on nexus 5x –

This is so weird. I had mine set to 70000, and apps were dying after around 30 seconds of trying to load. I changed it to 120000 and now they load successfully in 3-4 seconds. That’s all I changed. Argh.

I have added this code but for approx 1 minute, a white screen is coming after splash. What should I do?

@madebydavid I answered this 4 years back. At that point, there were no reliable solutions to handle the delay caused when there are a lot of scripts to be loaded. So the app was crashing since the scripts delayed page load. This works because the main.html is light and has no scripts to load, thereby initializing the app faster, and then loading the scripts on index.html. The closing </head> was a typo, added now.

Related Topics
android
cordova

Mentions
Dirk
Avinash
Alexey Muravyov
Shahzad Barkati
Adeojo Emmanuel Imm
Deano
Chong Lip Phang
Anh Sirk Dasarp
Jorisw
Gitsitgo
Robin C Samuel
Raugaral
Jjyepez
Nithin Krishnan P
Skmbr
Fernando Z
Soufiene
Caglabaran

References
12319809/application-error-the-connection-to-the-server-was-unsuccessful-file-andr

App Dies On Startup (подключение к серверу не увенчалось успехом)

У меня есть приложение для Android, которое я пишу, используя PhoneGap BUILD. Приложение работает нормально раньше, но теперь кажется, что я получаю эту ошибку после уточнения моего приложения (некоторые изменения пользовательского интерфейса 0nly)

1) Когда я запускаю приложение, я (обычно) получаю:

Ошибка приложения. Соединение с сервером не увенчалось успехом.
(файл:///android_asset/www/index.html)

Извините, если это дублирование любого вопроса. Я видел некоторые подобные вопросы здесь, но я не мог найти идеальный ответ или решение. Как и в моем случае, он работал нормально до моих последних изменений.

4b9b3361

Ответ 1

Как вы сказали, есть много повторяющихся вопросов по одной теме. Любые объяснения вашей ситуации.

Проблема может быть решена путем добавления таймаута для вызова вашего index.html

т.е. вам нужно добавить super.setIntegerProperty("loadUrlTimeoutValue", 70000); в файл activity.java(внутри src/com/yourProj/-/youractivity.java)
над этой строкой: super.loadUrl("file:///android_asset/www/index.html");

Объяснение:

Это может произойти по следующим причинам.

Основная причина: проблема, вероятно, связана со скоростью эмулятора, поэтому сеть слишком медленно завершает коммуникацию своевременно.

Это может быть вызвано:

  • Ваш код/​​данные/изображение имеют слишком большой размер (я полагаю, в вашем случае вы используете некоторые изображения, так как вы сказали, что сделали некоторые изменения в пользовательском интерфейсе, может быть размер изображений высок).
  • Ваш script может иметь бесконечный или длинный цикл, так что требуется слишком много времени для загрузки.
  • Вы будете использовать слишком много скриптов (jQuery, iscroll и т.д. и т.д. больше плагинов или скриптов).

Ответ 2

В файле config.xml добавьте эту строку:

<preference name="loadUrlTimeoutValue" value="700000" />

Ответ 3

Вот рабочее решение

создать новую страницу main.html

пример:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script>
     window.location='./index.html';
   </script>
  </head>
  <body>
  </body>
</html>

измените следующее в mainactivity.java

super.loadUrl("file:///android_asset/www/index.html");

к

super.loadUrl("file:///android_asset/www/main.html");

Теперь создайте приложение и работайте над любым медленным подключением

refernce.

ПРИМЕЧАНИЕ. Это обходной путь, который я нашел в 2013 году.

Ответ 4

Удалите удаленные файлы jQuery, например:
https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

Вместо этого загрузите этот файл и загрузите его из локальной папки js, создав URI:

js/jquery.min.js

Ответ 5

Попробуйте это,

1.Назовите свой index.html на «main.html»

2.Создайте новый «index.html» и поместите в него следующий контент:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script>
     window.location='./main.html';
   </script>
  <body>
  </body>
</html>

3. Создайте приложение! Больше ошибок!

Ответ 6

Удалите внешние скрипты в вашем index.html

Измените это:

<script src="http://code.highcharts.com/highcharts-more.js"></script>

to

<script src="project_folder/highcharts-more.js"></script>

Ответ 7

У меня было то же самое в моем проекте.

Я попробовал «super.setIntegerProperty(» loadUrlTimeoutValue «, 70000);» но безрезультатно.

Я гарантировал, что все файлы были правильно связаны [CSS, JS файлы и т.д.], проверили HTML с помощью w3c validator [http://validator.w3.org/#validate_by_upload] и очистил проект [Project → Clean]

Теперь он загружается и выполняется без такой же ошибки.

Надеюсь, что это поможет

Ответ 8

У меня была аналогичная проблема, и, основываясь на вышеприведенных предложениях, я впервые добавил «super.setIntegerProperty(» loadUrlTimeoutValue «, 70000); но это не помогло.
Поэтому я попробовал Project → Clean, это сработало, и я могу запустить приложение прямо сейчас.

Авинаш…

Ответ 9

Расширение ограничения времени ожидания загрузки не решит проблему, вызвавшую ошибку, она просто позволит системе отображать сообщение, но производительность будет затронута.

Фактическая причина. Возможно, вы связываете файлы или изображения с удаленными местами, и эти ресурсы слишком долго загружаются. (это, скорее всего, самая распространенная ошибка)

Окончательное решение: переместите все сценарии, изображения и css в некоторые локальные папки и загрузите их локально…

Производительность будет увеличена, и ошибка будет эффективно решена.

Ответ 10

В моем случае я использую ионный, и я просто закрыл диалог, отправленный в приложения в эмуляторе, и вместо этого запустил мое приложение. Это сработало. У меня появилась идея этого отсюда, поскольку это была всего лишь проблема с тайм-аутом.

Ответ 11

Проверьте файл index.html. Если вы используете внешние ресурсы, недоступные при запуске приложения, вы можете получить эту ошибку.

В моем случае я забыл удалить ссылку на отладчик script (weinre).

<script src="http://192.168.0.102:8080/target/target-script-min.js#anonymous"></script>

Итак, приложение работало над эмулятором, потому что http://192.168.0.102:8080/ был на моем локальном хосте и доступен для эмулятора.

Но когда я настраивал приложение на мобильный телефон, у меня была такая же ошибка, потому что 192.168.0.102 не был доступен из мобильной сети.

Ответ 12

Если вы используете визуальную студию. После изменения config.xml иногда вам понадобится

решение для чистой сборки перестройте свое приложение

Он работает для меня.

Ответ 13

try this:

MainActivity.java file 
inside (MainActivity.java)
you will be show  this loadUrl(launchUrl); 
you need to  change  this 
super.loadUrl("file:///android_asset/www/index.html");
and you need to add  another file inside -> config.xml 
<preference name="loadUrlTimeoutValue" value="60000" />

Ответ 14

Другая причина, по которой может возникнуть эта ошибка, — это index.html в .../YourApp/www/!

Я просто последовал за ионным руководством, и один из шагов:

$ rm www/index.html

В iOS это не проблема, так как во время сборки компилятор вместо этого использует HTML по умолчанию. Однако при создании для android не используется пример index.html. Принял меня когда-нибудь, чтобы узнать («ПОЧЕМУ это работает на iOS, но не на андроиде…?)

Простое решение: создайте index.html, сохраните его под .../YourApp/www, rebuild… et voila!



приложение умирает при запуске (подключение к серверу не удалось)

У меня есть приложение для Android, которое я пишу с помощью PhoneGap BUILD. Раньше приложение работало нормально, но теперь, похоже, я получаю эту ошибку после уточнения моего приложения (только некоторые изменения пользовательского интерфейса)

1) Когда я запускаю приложение, я (обычно) получаем:

ошибка приложения-соединение с сервером не удалось.
(файл: / / / android_asset / www / index.html)

Извините, если это дублирование любой вопрос. Я видел некоторые подобные вопросы здесь, но я не мог найти идеальный ответ или решение. А в моем случае он работал хорошо до последнего изменения.


690  


14  

14 ответов:

Как вы сказали, есть много повторяющихся вопросов на эту же тему. Любой, как объяснить вашу ситуацию.

проблема может быть решена путем добавления тайм-аута для вызова индекса.HTML-код

т. е. нужно добавить super.setIntegerProperty("loadUrlTimeoutValue", 70000); в вашей деятельности.java-файл (внутри src/com/yourProj/— / youractivity.Ява)
над этой строкой:super.loadUrl("file:///android_asset/www/index.html");

объяснение:

Это может произойти по следующим причинам

основная причина: проблема, вероятно, из-за скорости эмулятора, поэтому сеть слишком медленно завершает связь своевременно.

Это может быть из-за:

  1. ваш код / данные / изображение имеет слишком большой размер ( я думаю, в вашем случае вы используете некоторые изображения, как вы сказали, вы сделали некоторые изменения пользовательского интерфейса, может быть, размер изображений высок)
  2. ваш скрипт может иметь бесконечный или длинный цикл, так что он занимает слишком много времени для загрузки.
  3. вы будет использовать слишком много скриптов (jQuery, iscroll и т. д.. больше плагинов или скриптов)

в свой конфиг.xml-файл добавьте эту строку:

<preference name="loadUrlTimeoutValue" value="700000" />

вот рабочее решение

создать новую главную страницу.HTML-код

пример:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script>
     window.location='./index.html';
   </script>
  </head>
  <body>
  </body>
</html>

измените следующее в mainactivity.java

super.loadUrl("file:///android_asset/www/index.html");

до

super.loadUrl("file:///android_asset/www/main.html");

Теперь создайте свое приложение и оно работает на любом медленном соединении

refernce.

Примечание: это обходной путь, который я нашел в 2013 году.

пожалуйста, удалите удаленно связанные файлы jQuery, такие как:
https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js

вместо этого загрузите этот файл и загрузите его из локальной папки js, сделав URI:

js/jquery.min.js

удалите внешние скрипты в вашем индексе.HTML-код

изменить это:

<script src="http://code.highcharts.com/highcharts-more.js"></script>

до

<script src="project_folder/highcharts-more.js"></script>

У меня была аналогичная проблема, и на основе вышеизложенных предложений я сначала добавил «супер.setIntegerProperty («loadUrlTimeoutValue», 70000); » но это не помогло.
Поэтому я попробовал Project — > Clean, это сработало, и я могу запустить приложение прямо сейчас !

Авинаш…

попробуйте это,

1.Переименуйте свой индекс.html to » main.html»

2.Создать новый индекс».html » и поместить в него следующее содержимое:

<!doctype html>
<html>
  <head>
   <title>tittle</title>
   <script>
     window.location='./main.html';
   </script>
  <body>
  </body>
</html>

3.Восстановите свое приложение! Больше никаких ошибок!

У меня было то же самое на моем проекте.

Я пробовал » супер.setIntegerProperty («loadUrlTimeoutValue», 70000); » но безрезультатно.

Я гарантировал, что все файлы были связаны правильно [ CSS, JS-файлы и т. д. ], проверил HTML с помощью валидатора w3c [ http://validator.w3.org/#validate_by_upload ], и очистил проект [ Project — > Clean]

теперь он загружается и выполняется без той же ошибки.

надеюсь, что это помогает

расширение лимита времени ожидания загрузки не решит проблему, вызвавшую ошибку, это просто позволит избежать системы, чтобы показать сообщение, но производительность будет затронута вообще.

фактическая причина: возможно, вы связываете файлы или изображения с удаленными местоположениями, и эти ресурсы слишком долго загружаются. (это, вероятно, самая распространенная ошибка)

окончательное решение: переместите все сценарии, изображения и css, необходимые для некоторых локальных папок и загрузить их локально …

производительность будет увеличена, и ошибка будет эффективно решена.

проверить вас . Если вы используете внешние ресурсы, которые недоступны при запуске приложения, то вы можете получить эту ошибку.

в моем случае я забыл удалить ссылку на скрипт отладчика (weinre).

<script src="http://192.168.0.102:8080/target/target-script-min.js#anonymous"></script>

Так что приложение работало на эмуляторе, потому что http://192.168.0.102:8080/ на мой localhost и доступен для эмулятора.

но когда я устанавливаю приложение на мобильном телефоне у меня была такая же ошибка, потому что 192.168.0.102 не был доступен из мобильной сети.

в моем случае я использую ionic и я просто закрыл диалог пошел в приложения в эмуляторе и запустил мое приложение оттуда вместо этого. Это сработало. Я получил представление об этом отсюда, так как это был просто тайм-аут.

Если вы используете visual studio. После изменения конфигурации.xml иногда вам это нужно

чистое решение для сборки
перестроить приложение

Это работает для меня.

в моем случае проблема была связана с потерей подключения к интернету в моем WiFi.

еще одна причина, по которой эта ошибка может возникнуть: нет index.html in .../YourApp/www/ !

Я просто следовал ионные руководство, и один из шагов:

$ rm www/index.html

на iOS это не проблема, так как во время сборки компилятор принимает некоторый HTML по умолчанию вместо этого. Однако, при создании для android, нет примера есть. Взял меня когда-то, чтобы узнать («почему это работает на iOS, но не на android…?)

простое решение: создать индекс.HTML, сохраните его под .../YourApp/www, восстановить …и вуаля!

My application is an offline application built using SMP Kapsel plugin and runs on Cordova. App is available for android and iOS platforms. App works fine on iOS. All the sapui5 libraries are hosted locally.

Issue is happening only with new installations. People who already have the app installed see no issues using the app. We havent released any new version since December last year.

The strangest part is that this problem suddenly happened to all my android users since past 2 weeks for no reason at all. The same build that has been working for weeks suddenly got this error on every android device who reinstalled the app.

1. Launching the app on android gives an error even before the splash screen appears. «An error occurred in sap.ui.core.js (at Line # 174). Uncaught Error: failed to load ‘sap/f/library-preload.js’ from ./resources/sap/f/library-preload.js: 0 — NetworkError: Failed to execute ‘send’ on ‘XMLHttpRequest’: Failed to load ‘file:///android_asset/www/resources/sap/f/library-preload.js’.) »

2. If you wait on this error screen for like 10-15 secs another error pops-up “Application Error: The connection to server was unsuccessful file:///android_asset/www/index.html”. See logs below.

3. We dont understand why is the app trying to fetch sap/f/library-preload.js. We are not at all using the sap/f/ components in our application. If all our libraries are hosted locally then why there is a warning for Synchronous XMLHttpRequest ![1](https://user-images.githubusercontent.com/36221744/61040744-d144c600-a3ee-11e9-9781-a97504178a95.png) in the console. See logs attached below.

4. Chrome 73 has introduced some stricter CORS/CORB policy. Could this be affecting us ? What is the solution to handle this error ? [Chrome 73] https://medium.com/aviabird/handling-cross-origin-fetches-in-chrome-extensions-for-chrome-73-98a094052b7f https://www.chromium.org/Home/chromium-security/extension-content-script-fetches

5. I uninstalled the updates to Chrome on my android device and my app started working fine. We tested this behaviour on 3 devices — Samsung, POCO F1, Nokia on chrome version 68 & 71. Both worked fine. But when I update to latest version 75 of Chrome, application doesnt load.

6. Details:

SAPUI5 version:
SAPUI5 version: 1.44.11
Chrome version : 75
Device : Android 8+
Cordova: 8+

Attachment:
1.png
2.png
sqlerror1.jpg
sqlerror2.jpg
sqlerror3.jpg
sqlerror4.jpg
device-logs.txt

Like the article?

Hello mobile apps developers! if you are developing Mobile application in Phonegap platform. You might  face a problem in sometime  ‘ Connection to the server was unsuccessful. (file ///android_asset/www/index.html)  ‘

Phonegap problem

Well, I have couple of simple solution for you guys on this note.

Solution 1:
This might happen for extended loading time. You can add some time for loading. The problem will be solved. Process of doing that is :

    Just after  super.loadUrl(«file:///android_asset/www/index.html»);

Add below line:       

super.setIntegerProperty(«loadUrlTimeoutValue», 7000);

   

Here, I’m giving 7 seconds to the system for loading the files. You can increase the time. But, users will face some kind of problem here. They will have to wait this amount of time after opening the application. For that I’ve another solution. I experimented this solution, and this worked nicely. You can give a try too.

Solution 2:
Call a simple HTML file from MainActivity.java and call your ‘ index.html ‘ file from that simple HTML file. For that:
Firstly, create a new html file naming rubel.html and paste below codes into that file:

<!doctype html>
<html>
  <head>
   <script>
     window.location=’./index.html’;
   </script>
</head>
  <body>
  </body>
</html>

Secondly, Rename the code line super.loadUrl(«file:///android_asset/www/index.html»); to super.loadUrl(«file:///android_asset/www/rubel.html»); from your MainActivity.java File. And keep the rest same!

Now, clean, refresh and build! Hope, this helps you!

Comment if you face any problem!
Subscribe for you!
Share for others!

Понравилась статья? Поделить с друзьями:
  • Application error illegalargumentexception invalid characters in hostname как исправить
  • Application error ieframe dll
  • Application error heroku
  • Application error football manager 2020
  • Application error exception erangeerror in module streammemfix asi at 00007f49 range check error