Base solution for your next web application
Open Closed

Android app won't start, iOS app works fine.. (Xamarin) #5766


User avatar
0
blueoceandev created

I am starting work on the mobile portion of our solution.. I have the iOS app starting up and authenticating (literally all I have done was point is update the ApiUrlConfig.DefaultHostUrl to point at our Development instance of our API in Azure). However, on android the app fails to load completely, the splash screen comes up, the application stalls, and then it crashs.. I have attached the android device logger, and get the following exception.

Time Device Name Type PID Tag Message 10-12 19:35:23.544 my_device Error 7061 AndroidRuntime android.runtime.JavaProxyThrowable: Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: . Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonTextReader.Read () [0x0004c] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonReader.ReadAndMoveToContent () [0x00000] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonSerializer.Deserialize[T] (Newtonsoft.Json.JsonReader reader) [0x00000] in <d32db49e5e3440729da31845c03ddc3a>:0 at Flurl.Http.Configuration.NewtonsoftJsonSerializer.Deserialize[T] (System.IO.Stream stream) [0x00019] in <aff0d88ab8b34cebbe8ed43b0927d65c>:0 at Flurl.Http.FlurlHttpException+<GetResponseJsonAsync>d__81[T].MoveNext () [0x000ef] in <aff0d88ab8b34cebbe8ed43b0927d65c>:0 `

Again, all I have done to the code that is downloaded from the template is update ApiUrlConfig.DefaultHostUrl to point to our dev API instance in azure, and the code works fine on the iOS emulator.

Is there a specific Android SDK I should be building to ( I have tried, P & 8.1)

Thanks Josh


10 Answer(s)
  • User Avatar
    0
    alper created
    Support Team

    looks like it doesn't retrieve some Json response from server. try to install the application on a real device and make sure you can navigate to the WebApi address from your internal browser of the mobile.

  • User Avatar
    0
    blueoceandev created

    The Android Emulator can hit the service just fine.. I triple checked all the networking... I tried to use fiddler as a proxy to get some data on the actual request but that failed.. I am not sure if it failed for the same reasons since we have SSL on..

    I haven't tried a physical device yet, but there are no signs as to why this would fail in the emulator.

  • User Avatar
    0
    alper created
    Support Team

    HTTPS can be the issue! See this

    It replaces localhost but HTTPS remains.

    private const string DefaultHostUrl = "http://localhost:22742/"; //TODO: Replace with PROD url.
    
  • User Avatar
    0
    blueoceandev created

    That is the first thing I changed, in fact its the ONLY thing I changed in the codebase (see first comment). I am pointing at a deployed development URL that is in Azure and feeds our dev release of our Web UI and works with the iOS build of the exact same soursecode.

    Yah just tested on my S9 and it failed the same way.. Here are all the log entries under "MonoDroid"

    Are these tickets private? If so, I can send you the URL to our Dev azure deployment.

    Time Device Name Type PID Tag Message 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Android.App.SyncContext+<>c__DisplayClass2_0.<Post>b__0 () [0x00000] in <4d996bab56b14864b2a1299fea73b3fe>:0 at Java.Lang.Thread+RunnableImplementor.Run () [0x00008] in <4d996bab56b14864b2a1299fea73b3fe>:0 at Java.Lang.IRunnableInvoker.n_Run (System.IntPtr jnienv, System.IntPtr native__this) [0x00009] in <4d996bab56b14864b2a1299fea73b3fe>:0 at (wrapper dynamic-method) System.Object.18(intptr,intptr) 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Activities.SplashActivity+<OnResume>d__0.MoveNext () [0x0007b] in <81689b0bde434743ba2272f98376898d>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Activities.SplashActivity+<CheckInternetAndStartApplication>d__2.MoveNext () [0x0009e] in <81689b0bde434743ba2272f98376898d>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Activities.SplashActivity+<StartApplication>d__3.MoveNext () [0x00063] in <81689b0bde434743ba2272f98376898d>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.ViewModels.Base.UserConfigurationManager+<GetIfNeedsAsync>d__3.MoveNext () [0x0007d] in <be352c513f15486dad9f33a372f370ea>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.ViewModels.Base.UserConfigurationManager+<GetAsync>d__4.MoveNext () [0x000e9] in <be352c513f15486dad9f33a372f370ea>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Core.Threading.WebRequestExecuter+<Execute>d__01[TResult].MoveNext () [0x0042d] in <be352c513f15486dad9f33a372f370ea>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Core.Threading.WebRequestExecuter+<HandleException>d__21[TResult].MoveNext () [0x00263] in <be352c513f15486dad9f33a372f370ea>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Core.Threading.WebRequestExecuter+<HandleFlurlHttpException>d__81[TResult].MoveNext () [0x0009c] in <be352c513f15486dad9f33a372f370ea>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <43dbbdc147f2482093d8409abb04c233>:0 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in <43dbbdc147f2482093d8409abb04c233>:0 at Syngin.RTS.Core.Threading.AbpExceptionHandler+<HandleIfAbpResponseAsync>d__0.MoveNext () [0x0006c] in <be352c513f15486dad9f33a372f370ea>:0 10-15 10:03:40.196 Samsung SM-G960U Info 15785 MonoDroid Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: . Path '', line 0, position 0. at Newtonsoft.Json.JsonTextReader.ParseValue () [0x002b3] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonTextReader.Read () [0x0004c] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonReader.ReadAndMoveToContent () [0x00000] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonReader.ReadForType (Newtonsoft.Json.Serialization.JsonContract contract, System.Boolean hasConverter) [0x0004a] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType, System.Boolean checkAdditionalContent) [0x000db] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonSerializer.DeserializeInternal (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00054] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonSerializer.Deserialize (Newtonsoft.Json.JsonReader reader, System.Type objectType) [0x00000] in <d32db49e5e3440729da31845c03ddc3a>:0 at Newtonsoft.Json.JsonSerializer.Deserialize[T] (Newtonsoft.Json.JsonReader reader) [0x00000] in <d32db49e5e3440729da31845c03ddc3a>:0 at Flurl.Http.Configuration.NewtonsoftJsonSerializer.Deserialize[T] (System.IO.Stream stream) [0x00019] in <aff0d88ab8b34cebbe8ed43b0927d65c>:0 at Flurl.Http.FlurlHttpException+<GetResponseJsonAsync>d__81[T].MoveNext () [0x000ef] in <aff0d88ab8b34cebbe8ed43b0927d65c>:0

    Thanks Josh

  • User Avatar
    0
    blueoceandev created

    Confirmed it fails on http as well as https so its not https :(...

    Again this is a website that can be hit by anyone on the planet including the mobile device.

  • User Avatar
    0
    alper created
    Support Team

    hi, tickets are public. send your url to [email protected] with the question number.

  • User Avatar
    0
    blueoceandev created

    Info sent.. Thanks

    Josh

  • User Avatar
    0
    blueoceandev created

    Here is a build log if this is useful.. There are a couple of assembly conflicts that things are building despite of, I am not sure I am used to seeing those on most of my other work so maybe they are related? anyway... Let me know what else might be worth looking into.

    1>------ Build started: Project: Syngin.RTS.Application.Client, Configuration: Debug Any CPU ------ 1>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Application.Client\Syngin.RTS.Application.Client.csproj : warning NU1701: Package 'modernhttpclient 2.4.2' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. 1>Syngin.RTS.Application.Client -> C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Application.Client\bin\Debug\netstandard2.0\Syngin.RTS.Application.Client.dll 1>Done building project "Syngin.RTS.Application.Client.csproj". 2>------ Build started: Project: Syngin.RTS.Mobile.Shared, Configuration: Debug Any CPU ------ 2>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Shared\Syngin.RTS.Mobile.Shared.csproj : warning NU1701: Package 'Microsoft.Bcl 1.1.6' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. 2>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Shared\Syngin.RTS.Mobile.Shared.csproj : warning NU1701: Package 'Microsoft.Bcl.Async 1.0.165' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. 2>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Shared\Syngin.RTS.Mobile.Shared.csproj : warning NU1701: Package 'modernhttpclient 2.4.2' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. 2>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Shared\Syngin.RTS.Mobile.Shared.csproj : warning NU1701: Package 'PCLStorage 1.0.2' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. 2>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Shared\Syngin.RTS.Mobile.Shared.csproj : warning NU1701: Package 'Xam.FormsPlugin.Iconize 1.0.10' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project. 2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "ImageCircle.Forms.Plugin.Abstractions". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. 2>Controls\HideableToolbarItem.cs(10,60,10,172): warning CS0618: 'BindableProperty.Create<TDeclarer, TPropertyType>(Expression<Func<TDeclarer, TPropertyType>>, TPropertyType, BindingMode, BindableProperty.ValidateValueDelegate<TPropertyType>, BindableProperty.BindingPropertyChangedDelegate<TPropertyType>, BindableProperty.BindingPropertyChangingDelegate<TPropertyType>, BindableProperty.CoerceValueDelegate<TPropertyType>, BindableProperty.CreateDefaultValueDelegate<TDeclarer, TPropertyType>)' is obsolete: 'Create<> (generic) is obsolete as of version 2.1.0 and is no longer supported.' 2>Controls\CardView.cs(14,17,14,29): warning CS0618: 'Frame.OutlineColor' is obsolete: 'OutlineColor is obsolete as of version 3.0.0. Please use BorderColor instead.' 2>Syngin.RTS.Mobile.Shared -> C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Shared\bin\Debug\netstandard2.0\Syngin.RTS.Mobile.Shared.dll 2>Done building project "Syngin.RTS.Mobile.Shared.csproj". 3>------ Build started: Project: Syngin.RTS.Mobile.Droid, Configuration: Debug Any CPU ------ 3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(2110,5): warning MSB3277: Found conflicts between different versions of "Microsoft.CSharp" that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. 3>C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Droid\Renderer\CropViewRenderer.cs(12,5,128,6): warning CS0618: 'PageRenderer.PageRenderer()' is obsolete: 'This constructor is obsolete as of version 2.5. Please use PageRenderer(Context) instead.' 3> Syngin.RTS.Mobile.Droid -> C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Droid\bin\Debug\Syngin.RTS.Xamarin.Android.dll 3> ** No way to resolve conflict between "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" and "mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e". Choosing "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" arbitrarily.**

    4>Starting deployment to Samsung SM-G960U ... 4>Deploying to Samsung SM-G960U ... 4>Build started. 4>Project "Syngin.RTS.Mobile.Droid.csproj" (Install target(s)): 4>C:\Program Files\Java\jdk1.8.0_172\bin\keytool.exe -list -alias androiddebugkey -storepass android -keypass android -keystore "C:\Users\joshh\AppData\Local\Xamarin\Mono for Android\debug.keystore" 4>C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\zipalign.exe 4 "C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Droid\obj\Debug\MonoAndroid90\android\bin\com.Syngin.RTS.Mobile.apk" "bin\Debug\com.Syngin.RTS.Mobile-Signed.apk" 4>C:\Program Files\Java\jdk1.8.0_172\bin\java.exe -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\lib\apksigner.jar" sign --ks "C:\Users\joshh\AppData\Local\Xamarin\Mono for Android\debug.keystore" --ks-pass pass:android --ks-key-alias androiddebugkey --key-pass pass:android --min-sdk-version 15 --max-sdk-version 28 C:\repos\Syngin\RTS\aspnet-core\src\Syngin.RTS.Mobile.Droid\bin\Debug\com.Syngin.RTS.Mobile-Signed.apk 4>Done building project "Syngin.RTS.Mobile.Droid.csproj". 4>Build succeeded. 4>Deployment was successful to Samsung SM-G960U. ========== Build: 3 succeeded, 0 failed, 2 up-to-date, 0 skipped ========== ========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

  • User Avatar
    0
    alper created
    Support Team

    Hey! Solved your problem.

    I've done the below changes in my sample project, to get things done with connecting your WebAPI endpoint, .

    ApiUrlConfig.DefaultHostUrl =  "https://xxxxx.azurewebsites.net/";  //you do not need this change.
    AbpZeroTemplateConsts.LocalizationSourceName = "RTS"; //you do not need this change.
    

    The crucial change is disabling Accept-Encoding header in AbpApiClient.

    AbpApiClient.cs#L399

    Why do you need to disable this line?

    Because Azure is sending responses in Gzip format. So the client has to decompress it. No problem until now. The problem is the library used in AspNet Zero Xamarin application (ModernHttpClient) requires to disable the Accept-Encoding request header for Android. You can read the related issue on their GitHub repo.

    So the final code must be like below;

    private void AddHeaders(string accessToken)
            {
                _client.HttpClient.DefaultRequestHeaders.Clear();
    
                _client.WithHeader("Accept", "application/json");
                _client.WithHeader("User-Agent", UserAgent);
                // _client.WithHeader("Accept-Encoding", "gzip,deflate");
    
                if (_applicationContext.CurrentLanguage != null)
                {
                    _client.WithHeader(".AspNetCore.Culture", "c=" + _applicationContext.CurrentLanguage.Name + "|uic=" + _applicationContext.CurrentLanguage.Name);
                }
    
                if (_applicationContext.CurrentTenant != null)
                {
                    _client.WithHeader(MultiTenancyConsts.TenantIdResolveKey, _applicationContext.CurrentTenant.TenantId);
                }
    
                if (accessToken != null)
                {
                    _client.WithOAuthBearerToken(accessToken);
                }
    }
    

    Note: The owner of the library says it works as expected in IOS but for Android they use OkHttp client which doesn't like Accept-Encoding header. So I commented out the line.

    Test the change with IOS & Android and get me back with the results.

    Click here for the GitHub issue on AspNet-Zero-Core Repository.

  • User Avatar
    0
    blueoceandev created

    Wow, what a find! That fixed it for me... Thanks!.