mgks / Android-SmartWebView

A simple use webview integrated w/ native features to help create most advanced hybrid applications.
https://mgks.dev/smart-webview
MIT License
561 stars 278 forks source link

It keeps showing the offline.html page #261

Closed daweblegend closed 1 year ago

daweblegend commented 1 year ago

Hello everyone, thank you for this amazing solution! However, I followed every single instruction, but the app still keeps showing the offline.html page, even though the ASWV_URL_ONLINE is not empty. Please help!

Thank you.

mgks commented 1 year ago

Hello, Just checked, the issue was with the get_cookies function in the MainActivity. We need to check whether the cookies variable holds any value or not, it simply solves the case. I'm adding the update in the beta branch for you to test, let me know if there's any other bug meanwhile.

daweblegend commented 1 year ago

Hi! Thank you for the update. I've tested it and I'm still facing the same issue. Also, I have this error when I tried running it:

set_cookie("APP_ID=" + BuildConfig.APPLICATION_ID); ^ symbol: variable APPLICATION_ID location: class BuildConfig

I removed these two lines but still got the offline page after successfully building: set_cookie("APP_ID=" + BuildConfig.APPLICATION_ID); error set_cookie("APP_VER=" + BuildConfig.VERSION_CODE + "/" + BuildConfig.VERSION_NAME);

daweblegend commented 1 year ago

Sorry I closed the thread mistakenly.

mgks commented 1 year ago

I have just updated the beta repo, try now. there are some other bugs now but the app should work.

daweblegend commented 1 year ago

No errors this time. But the app keeps crashing on Splash Screen.

mgks commented 1 year ago

there must be some log during crash, can you share that?

daweblegend commented 1 year ago

Here:

2023-01-19 17:27:20.453 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.454 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.766 808-2529/? E/IPCThreadState: binder thread pool (4 threads) starved for 291 ms 2023-01-19 17:27:20.822 3195-3211/? E/octvm_power: mode idle do not have any actions, empty group! 2023-01-19 17:27:20.841 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.842 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.844 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.844 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.856 1771-2319/? E/WifiClientModeImpl: getWifiLinkLayerStats called without an interface 2023-01-19 17:27:20.894 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:20.894 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.005 3141-26891/? E/NetworkScheduler: Too many tasks scheduled for this package. Not scheduling: com.google.android.gms/.trustagent.trustlet.InactivityTaskService{u=0 tag="Coffee-InactivityTaskService" trigger=window{start=14400s,end=14700s,earliest=14399s,latest=14699s} requirements=[NET_ANY] attributes=[] scheduled=0s last_run=N/A exec_window_multiplier=1.0000 jid=N/A status=UNKNOWN retries=0 client_lib=GMS_TASK_SCHEDULER-225014000} [CONTEXT service_id=218 ] 2023-01-19 17:27:21.022 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.032 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.034 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.045 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.062 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.116 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.119 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.119 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.178 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.178 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.198 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:21.250 5484-5484/? E/SUI_svcsock: svc_sock_send_message(suisvc): invalid remote socket suitch 2023-01-19 17:27:21.251 5484-5484/? E/SUI_svcsock: svc_sock_send_message(suisvc): invalid remote socket suilst 2023-01-19 17:27:21.300 777-22998/? E/AudioPolicyManagerCustom: stopInput for app appname=-com.google.android.googlequicksearchbox 2023-01-19 17:27:21.312 13836-13836/? E/MiuiNearbyService: onDestroy 2023-01-19 17:27:21.332 5191-6708/? E/A: (REDACTED) FASE: %b, SHwR: %b, ACR: %b, HR: %b, ACbSS: %b, ACbHE: %b, SO:%b, ARS: %b 2023-01-19 17:27:21.563 1771-2319/? E/WifiNative: Could not get Iface object for interface null 2023-01-19 17:27:21.903 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:23.597 608-27344/? E/ResolverController: No valid NAT64 prefix (100, /0) 2023-01-19 17:27:23.676 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:24.550 3141-3159/? E/GmsTaskScheduler: sendWakeUpEvent called on SchedulerClientBroadcastStrategy 2023-01-19 17:27:27.684 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:30.884 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:30.911 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:30.941 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:31.692 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:32.341 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:32.356 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1 2023-01-19 17:27:33.028 2387-2387/? E/DeviceLevelUtils: isLowGpuDevice:1

mgks commented 1 year ago

There's nothing much in this log, can you please check for either Run or Logcat logs the moment app crashed (or try filter with package name), we'll need something useful to understand the issue here. Also can you please share the device/emulator specifications?

daweblegend commented 1 year ago

The device being used is a Redmi Note 8. And I've attached the detailed log from Logcat. swv_new_logcat_log.txt

daweblegend commented 1 year ago

More logs swv_new_logcat_log.txt

mgks commented 1 year ago

Thanks for the logs. I suppose it was due to checking for empty cookies without checking their null value first, try /beta repo now.

daweblegend commented 1 year ago

Okay, I'm testing right away! Thank you

daweblegend commented 1 year ago

Hi! Thank you so much for your help so far. So it's working now, but the challenge I'm facing now is with "camera upload". I'm able to access the camera, I take the picture, but it doesn't feed it back to the input form. This feature is a really important feature for the app I'm building. Please help.

mgks commented 1 year ago

cool. we got it up again, let's work on the camera now. I'm closing this issue now and moved the camera bug to #266

daweblegend commented 1 year ago

Sorry to open this again. I'm not sure were to post it.

I'm unable to get location (lat & long). It says "UNABLE TO GET LOCATION, CHECK PERMISSIONS".

mgks commented 1 year ago

We're going to keep this issue closed as I believe we've fixed the problem mentioned here of forced offline.html URI, now we will move to other issues and solve them one by one, next is camera fixing issue #266 and then we'll work on location and other bugs. this repo was actually under slow development till now causing the program to break, so we have to update what's broken now.