14 Replies Latest reply: May 12, 2017 12:02 PM by asett01 RSS

Xamarin Android SDK 3.x Bindings - Nougat ?

yarg Novice

One of my clients is having a problem with a Xamarin Android App on an Android 7/Nougat device. The app works fine except for https calls and I believe this was fixed in the Android SDK 2.4 and above but you only have bindings available for Android Good SDK 2.3.   Is there a work around or an ETA on when v3 of the bindings will be released?

 

ERR 16818     SocketReflectionUtils.getHostNameFromInetSocketAddress exception [java.lang.NoSuchFieldException: No field hostname in class Ljava/net/InetSocketAddress; (declaration of 'java.net.InetSocketAddress' appears in /system/framework/core-oj.jar)]
[GD] GDSocket::connect() non-IO exception Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Field.get(java.lang.Object)' on a null object reference
System.AggregateException: One or more errors occurred. ---> Java.IO.IOException: Exception of type 'Java.IO.IOException' was thrown.
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3511/501e63ce/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00085] in /Users/builder/data/lanes/3511/501e63ce/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11283
  at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x00000] in /Users/builder/data/lanes/3511/501e63ce/source/monodroid/src/Mono.Android/JNIEnv.g.cs:102
  at GDApacheHttp.AbstractHttpClient.Execute (Com.Good.GD.Apache.Http.Client.Methods.IHttpUriRequest p0) [0x0004c] in <696493b6dc2c47c3974fb5ca8c7fd509>:

 

Thanks in advance.

 

Steve

  • Re: Xamarin Android SDK 3.x Bindings - Nougat ?
    andrew_robinson Newbie

    Can I have an answer to this as well please. Our users own Samsung devices which are just about to receive the update to Android 7 rendering our apps unusable.

  • Re: Xamarin Android SDK 3.x Bindings - Nougat ?
    kmajewski BlackBerry

    Hi both,

     

    This is an issue with Xamarin parser that we reported to MS some time ago and they actually fixed it in the newest Alpha release from late December. If you move to Alpha or wait for the final Xamarin build (don't know when it's going to happen), the issue should be solved and not bother you anymore.

     

    As for the root cause - Xamarin parser had issues with too long classes names and shortened it erratically causing builds to crash/fail.

     

    Cheers,

    Chris

    • Re: Xamarin Android SDK 3.x Bindings - Nougat ?
      yarg Novice

      Sorry for the delay in responding Chris, I've only just seen this now!  OK great we'll give it a
      whirl and report back.

       

      Cheers

       

      Steve

    • Re: Re: Xamarin Android SDK 3.x Bindings - Nougat ?
      jwright1 Newbie

      Hi,

       

      I'm also having this issue with https calls on Nougat. I've updated Xamarin to latest Alpha release, but this hasn't seemed to rectify the problem.

       

      I'm very unfamilar with both Xamarin and Good due to picking this project up from an old colleague - is there anything else that I would need to do other than install the newest Xamarin release?

       

      Thanks in advance,

      Jordan

      • Re: Re: Xamarin Android SDK 3.x Bindings - Nougat ?
        asett01 BlackBerry

        Hi Jordan Wright,

        Please provide the following information if possible:

        • Curent Xamarin Version
        • App Container Log showing the stack trace
        • Re: Re: Re: Xamarin Android SDK 3.x Bindings - Nougat ?
          jwright1 Newbie

          Hi Amit Sett

           

          Thanks for the quick response!

          • Current Xamarin version = 4.5.0.341

           

          ERR 8588 SocketReflectionUtils.getHostNameFromInetSocketAddress exception [java.lang.NoSuchFieldException: No field hostname in class Ljava/net/InetSocketAddress; (declaration of 'java.net.InetSocketAddress' appears in /system/framework/core-oj.jar)]
          GDSocket::connect() non-IO exception Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Field.get(java.lang.Object)' on a null object reference
          Post - Java.IO.IOException: Exception of type 'Java.IO.IOException' was thrown.
          at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0269cee823434b0d9739514a7880cd2a>:0 
          at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <f9de182bb41a4486aae5366f80c41b08>:0 
          at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <6641d71fb68b4455af795f94a82b0b51>:0 
          at GDApacheHttp.AbstractHttpClient.Execute (Com.Good.GD.Apache.Http.Client.Methods.IHttpUriRequest p0) [0x0004c] in <696493b6dc2c47c3974fb5ca8c7fd509>:0 
          at Intouch.Droid.MqHttp+<Post>d__25.MoveNext () [0x000a3] in D:\inTOUCH Projects\inTOUCH\Intouch.Android.Gd\MqHttp.cs:101 
          --- End of managed Java.IO.IOException stack trace ---
          

           

          Thanks,

          Jordan

          • Re: Xamarin Android SDK 3.x Bindings - Nougat ?
            asett01 BlackBerry

            HiJordan Wright,

             

            Thank you for providing the stack trace showing the Exception.

            Do you have the logging showing what was going on before the Exception got thrown?

            Could you also provide more details about the https calls you are making and code snippets if possible?

             

             

            Best,
            Amit

            • Re: Re: Xamarin Android SDK 3.x Bindings - Nougat ?
              jwright1 Newbie

              Hi Amit Sett,

               

              Here's a slight extended version of the stack trace:

              INF 8647 SplitBillingManager::Impl::hideDataPlanIcon
              [0:] Delay cancelled
              INF 8604 PushConnectionEngine::isPushSocketValid Internal socket for PushConnectionEngine = 0xc8c93280 is valid. 
              INF 8604 PushConnectionEngine::isPushSocketValid Internal socket for PushConnectionEngine = 0xc8c93280 is valid. 
              INF 8612 0xe3033480        MGMT GC policy manager:onChannelOpen
              INF 8612 0xe3033480        MGMT GC policy manager:processCurrentState 3
              INF 8612 MGMT   GC PolicySocket[0xc5809de0]::init forcing re-init of socket data
              INF 8612 MGMT   GC GDEPolicySocket[0xc5809de0]: After Randomizing GC List [GOOD SERVER URL] Priority: 1
              INF 8612 MGMT   GC PolicySocket[0xc5809de0]::connecting to [GOOD SERVER URL]
              Post - http://[IP ADDRESS]/dev/ob.aspx/ob_mob-dev/alg.asp?X=L&U=622&platform=WP7&R=29-03-1709:41|QW|Android-7.1.1|34.1143&UA=[EMAIL ADDRESS]&B=30&P=0&F=.
              ERR 8588 SocketReflectionUtils.getHostNameFromInetSocketAddress exception [java.lang.NoSuchFieldException: No field hostname in class Ljava/net/InetSocketAddress; (declaration of 'java.net.InetSocketAddress' appears in /system/framework/core-oj.jar)]
              GDSocket::connect() non-IO exception Attempt to invoke virtual method 'java.lang.Object java.lang.reflect.Field.get(java.lang.Object)' on a null object reference
              Post - Java.IO.IOException: Exception of type 'Java.IO.IOException' was thrown.
              at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <0269cee823434b0d9739514a7880cd2a>:0 
              at Java.Interop.JniEnvironment+InstanceMethods.CallObjectMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00069] in <f9de182bb41a4486aae5366f80c41b08>:0 
              at Android.Runtime.JNIEnv.CallObjectMethod (System.IntPtr jobject, System.IntPtr jmethod, Android.Runtime.JValue* parms) [0x0000e] in <6641d71fb68b4455af795f94a82b0b51>:0 
              at GDApacheHttp.AbstractHttpClient.Execute (Com.Good.GD.Apache.Http.Client.Methods.IHttpUriRequest p0) [0x0004c] in <696493b6dc2c47c3974fb5ca8c7fd509>:0 
              at Intouch.Droid.MqHttp+<Post>d__25.MoveNext () [0x000a3] in [FILEPATH]\MqHttp.cs:101 
              --- End of managed Java.IO.IOException stack trace ---
              
              

               

              Post:

              private async Task<string> Post(string url, string postdata, int timeout)
                      {
                          try
                          {
                              Android.Util.Log.Info("MqHttp", $"Post - {url}?{postdata}.");
              
              
                              var client = GetClient(timeout);
                              var request = new HttpPost(url);
                              var postentity = new StringEntity(postdata);
                              postentity.SetContentType("application/x-www-form-urlencoded");
                              request.Entity = postentity;
              
              
                              DateTime postTime = DateTime.Now;
                              var response = client.Execute(request);
                              var r = await ValidateResponse(response);
                              DateTime responseTime = DateTime.Now;
              
              
                              Android.Util.Log.Info("MqHttp", $"Post - received {r.Length}.");
              
              
                              return r;
                          }
                          catch (Exception e)
                          {
                              Android.Util.Log.Error("MqHttp", $"Post - {e}");
              
              
                              LastException = e;
                              return null;
                          }
                      }
              
              
              
              
              
              
              
              
              
              
              

               

              This uses a GetClient:

              private GDHttpClient GetClient(int timeout)
                      {
               var client = new GDHttpClient();
               client.Params.SetParameter("http.socket.timeout", new Java.Lang.Integer(timeout));
               return client;
                      }
              
              
              

               

              Thanks,

              Jordan

      • Re: Re: Xamarin Android SDK 3.x Bindings - Nougat ?
        therder BlackBerry Employee

        Hi Jordan,

         

        Can you provide more details about the https calls you are making (perhaps provide a code snippet)? I've tested the ApacheHTTP sample app in the Xamarin/Blackberry Dynamics bindings package for Android on Nougat (API 24) and it makes an https call successfully.

         

        As mentioned above, app container logs showing the stack trace will also be helpful.

         

        Let me know if you have any questions.

         

        Thanks,

         

        Turhan