Daddoon / BlazorMobile

Create full C# driven hybrid-apps for iOS, Android, UWP & Desktop with Blazor!
MIT License
413 stars 55 forks source link

How can I debug my android device? App opens but page is blank after splash screen #217

Closed arivera12 closed 4 years ago

arivera12 commented 4 years ago

I tried watching the output console but don't see any error.

Daddoon commented 4 years ago

Was your app working before ? Do you have a blank page when doing remote debugging ?

Otherwise for Android, when you want to debug directly the device browser, you may use Firefox 69 on your PC and use the WebIDE debugger in order to see what happens internally.

WebIDE is deprecated on newer version of Firefox and GeckoView but this part is not yet updated. That’s why you may need Firefox 69. See WebIDE documentation for more information.

See this related also: https://github.com/Daddoon/BlazorMobile/issues/194

Daddoon commented 4 years ago

Also do you have changed something recently in your app ?

arivera12 commented 4 years ago

Was your app working before ? Yes Do you have a blank page when doing remote debugging ? Haven't done remote debugging yet need to try what you commented on the other post

Otherwise for Android, when you want to debug directly the device browser, you may use Firefox 69 on your PC and use the WebIDE debugger in order to see what happens internally.

WebIDE is deprecated on newer version of Firefox and GeckoView but this part is not yet updated. That’s why you may need Firefox 69. See WebIDE documentation for more information.

Let me give it a try. See this related also: #194

Daddoon commented 4 years ago

If your app does not work on your computer even with or without remote debugging available when launching your regular Blazor app, the problem is likely in your Blazor app.

In this case the best is to open your web browser console and see what happen.

Also check that there is no 404 error. Recently I have seen some regression with Visual Studio failing to load Razor Class Library file even if all seems correct.

arivera12 commented 4 years ago

My app works properly on browser. It just doesn't work on android device. I was unavailable to setup the remote debugging. I not sure if ports aren't configured properly or what else could be.

Daddoon commented 4 years ago

Ok !

What have you changed recently ? I don’t see any reason why it wouldn’t work anymore without any change.

If you have a blank page , this mean that things didn’t boot or loaded. Remote debugging not working at this point is not anormal in my opinion.

You should try to see what you changed, if any, and debug through WebIDE and / or use adb logcat in order to see what happen. Check that there is no Xamarin exception too.

arivera12 commented 4 years ago

Can I send you a demo which reproduces this error?

Daddoon commented 4 years ago

I’ m on vacation and will be back only in 3 days. I will not be able to take a look before next Wednesday.

arivera12 commented 4 years ago

ok. I will keep trying to look around if not I will attach it on thursday or friday for you. Enjoy your vacations! =D

Daddoon commented 4 years ago

Did you have solved your issue ?

arivera12 commented 4 years ago

I could not resolve.

Daddoon commented 4 years ago

If you have a repro project I will look when I have some time

arivera12 commented 4 years ago

Ok let me delete bin stuff and shrink it.

arivera12 commented 4 years ago

OneLineDemo.zip

Daddoon commented 4 years ago

Sorry i cannot test your app, something is missing somehow. There is errors, but mainly, it seems that HttpBaseUsersService class is missing.

arivera12 commented 4 years ago

Sorry i cannot test your app, something is missing somehow. There is errors, but mainly, it seems that HttpBaseUsersService class is missing.

Let me revise it.

arivera12 commented 4 years ago

OneLineDemo.zip

arivera12 commented 4 years ago

Any news?

Daddoon commented 4 years ago

I'm not available theses day yet.

Daddoon commented 4 years ago

Still not available but be sure i will take a look in few days.

arivera12 commented 4 years ago

Ok, once you help me get this up a running I will give feedback for this https://github.com/Daddoon/BlazorMobile/issues/220#issuecomment-671055377

arivera12 commented 4 years ago

@Daddoon I am having a demo in 2 weeks can you help me get this up and running? After this I need to contact you to show you and share as a reward for this? It's one interesting tool I talked to you some months ago.

Daddoon commented 4 years ago

I have done some tests on your project.

In my opinion the error is not even related to BlazorMobile, there is different errors that need to be test and fixed on your side. I have updated NuGet package versions for Blazor / BlazorMobile

While trying on the Blazor web project my first issue was:

System.MissingMethodException: Method not found: Microsoft.Extensions.Configuration.IConfigurationBuilder Microsoft.AspNetCore.Components.WebAssembly.Hosting.WebAssemblyHostBuilder.get_Configuration() blazor.webassembly.js:1:38061
  at OneLineDemo.Blazor.Program.Main (System.String[] args) <0x2a6e9d8 + 0x000be> in <filename unknown>:0 blazor.webassembly.js:1:38061
  at Microsoft.AspNetCore.Components.WebAssembly.Hosting.EntrypointInvoker.InvokeEntrypoint (System.String assemblyName, System.String[] args) <0x2a18c80 + 0x0011a> in <filename unknown>:0 

By adding some "logs", Console.WriteLine that you will see in Program.cs, i can see that the first exception is in the builder.AddEnvironmentConfiguration call. By reaching the "source" of this reference, it seem that this is an extension you have written yourself, i think something is wrong in it, or maybe it's referencing a different or outdated API version, or maybe you are doing reflections but the method does not exist on what you were expecting, i don't have the code on my eyes (neither want to debug it myself).

By commenting this call, we go further, still have a white page that prevent loading, but by looking on the exception, it seem that an exception is occuring in your BlazorWebStorage plugin, and depending how you have implemented your code, you may have missed how to fallback on a regular page in case of exception ?

There is also BlazorMobile exception occuring because there was no Device connection while starting during my test, but this seem normal in my opinion, as it was expected.

I think you should look at your code on theses 2 primary point.

I will not do any modification on BlazorMobile soon on this particular case. I highly recommand you that you create an other service implementation of storage, that go instead on native for writing and reading values and datas.

For more informations about the data clearance implementations for each platform browser, if you want to take a look, search on ClearWebViewData in the source code, but it may be cumbersome and you will have to recompile your own version of the plugin in this case...Or maybe not if you inherit some WebView class's and do the right override, but this is out of scope of all of this.

Here is your project with my tests and changes:

OneLineDemo.zip

arivera12 commented 4 years ago

Thanks for your valuable time. Did you got this up a running? I will try the attached project!

Daddoon commented 4 years ago

No, i mean, there is an exception between a rendering process and your BlazorWebStorage. But i think that if you change some code you should be able to at least see the starting page of your app.

arivera12 commented 4 years ago

can you share the exception being thrown on BlazorWebStorage?

arivera12 commented 4 years ago

It seems I need to do some migrations under the hood. There are few things that were not available on older blazor versions and they have implementations I haven't migrated yet.

arivera12 commented 4 years ago

I got my app up and running partially. Thanks for giving me a starting point to debug this I was going crazy trying to fix this. I had a few of broken api's everywhere and still migrating some of them. Thank you so much. Let me get this up and running with some rigorous test and I will get in touch with you. Thank you again!

Daddoon commented 4 years ago

Good luck in your fixing ! Keep me updated !