Search Unity

Passing a char value to Android Java from Unity3D C# causes a warning

Discussion in 'Android' started by jiyongman, Dec 10, 2018.

  1. jiyongman

    jiyongman

    Joined:
    Dec 10, 2018
    Posts:
    29
    Whenever I pass a char value to Android Java, or get a char value from Android Java in a Unity3D app, I get this warning message in my Logcat.

    ! parseType; C is not known!

    I tested on multiple environments which include Samsung Galaxy Note2, S7 Edge and Genymotion HTC One 4.3 emulator.

    It seems all the values passed to and got from the Android Java side have no problem. But I can't just ignore this warning because this may cause some issue in certain situations in the future. And also I really don't like to have a bunch of log messages like this whenever calling this kind of methods.

    If I'm writing my own jar library, I can workaround this in some ways and actually did several times. But problem is when I use libraries written by other developers.


    Currently I'm testing with very simple test code below:

    Java
    Code (JavaScript):
    1. class CharTest {
    2.    public static void passChar(char c) {
    3.    }
    4.  
    5.    public static char getChar() {
    6.        return 'A';
    7.    }
    8. }
    Unity3D C#
    Code (CSharp):
    1. var ajc = new AndroidJavaClass("com.test.project.CharTest");
    2.  
    3. ajc.CallStatic("passChar", 'A');  // This causes a warning message.
    4. Debug.Log(ajc.CallStatic<char>("getChar"));  // This also causes the exact same warning.
    1. Why am I getting such log message with this?

    2. Will this cause any error or misbehavior with some devices?
     
    Last edited: Feb 9, 2019
  2. jiyongman

    jiyongman

    Joined:
    Dec 10, 2018
    Posts:
    29
    I guess this was a Unity's bug. I tried it again with a newer version and this issue disappeared :p