Skip to content

Java.lang.NoSuchFieldError: no “I” field “value” in class “Ljava/lang/Integer;” or its superclasses - Android 10 #5199

@singhal2

Description

@singhal2

I understand that the following might not be enough to debug the problem. I am trying to get ideas so as to find a workaround to this problem. Therefore, please do not hesitate to ask for more information. Any help is appreciated.

I have a .so android library which I am integrating into a Xamarin Forms project. The library helps the app connect to an IoT device. As the library methods are of the following signature, I decided to write a java wrapper to simplify the parameters and create an aar file. Afterwards, I natively bind the aar and use it as a dll in my project. I DO NOT have the library source code available, therefore I am unable to debug it further. It is important to note that the problem in Xamarin only occurs when the Compile Target is > 10. Otherwise, it works fine. My guess is that the latest Updates to non-SDK interfaces broke the application.

Method signature:
public static native int ReadParams(String token, StringBuilder serial, StringBuilder ssid, StringBuilder password, StringBuilder sensor, Integer keepAlive);

Call from Java wrapper

StringBuilder strSerial = new StringBuilder();
StringBuilder strssid = new StringBuilder();
StringBuilder strpassword = new StringBuilder();
StringBuilder strsensor = new StringBuilder();
Integer keepAlive = new Integer(0);
//Crash on below line
int response = EPM002Lib.ReadParams(token, strSerial, strssid, strpassword, strsensor, keepAlive);

Stacktrace:

--- End of managed Java.Lang.IncompatibleClassChangeError stack trace ---
java.lang.NoSuchFieldError: no "I" field "value" in class "Ljava/lang/Integer;" or its superclasses
at com.esong.lib.EPM002Lib.ReadParams(Native Method)
at com.sensorwa.config.configdemo.SquareSdkhelper.ReadParams(SquareSdkhelper.java:32)
at crc643f46942d9dd1fff9.ButtonRenderer_ButtonClickListener.n_onClick(Native Method)
at crc643f46942d9dd1fff9.ButtonRenderer_ButtonClickListener.onClick(ButtonRenderer_ButtonClickListener.java:30)
at android.view.View.performClick(View.java:7201)
at android.view.View.performClickInternal(View.java:7170)
at android.view.View.access$3500(View.java:806)
at android.view.View$PerformClick.run(View.java:27582)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7710)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Steps to Reproduce

The error occurs when the above method is called as shown above. I am unsure as to what exactly is the issue here and what's causing it. However, the same aar library works well in a native Android application. Which makes me believe that the issue is in Xamarin Forms.

  • Version with issue: 4.8.0.1534
  • Last known good version: Android 9 and below
  • Platform Target Frameworks:
    • Android: 10
  • Affected Devices: Android

Reproduction Link

I cannot provide a sample to reproduce the problem as the error occurs when the connection to the IoT device is made.

Thank you very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    need-infoIssues that need more information from the author.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions