"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='showCollectUI'

How to resolve this issue? AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='showCollectUI'

 

AndroidManifest.xml

<activity             android:name=".augmentedreality.UnityPlayerActivity"             android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density"             android:label="@string/app_name"             android:launchMode="singleTask"             android:screenOrientation="portrait"             android:theme="@style/SplashScreenTheme">

<meta-data                 android:name="unityplayer.UnityActivity"                 android:value="true" />

</activity>

UnityPlayerActivity.java:

public class UnityPlayerActivity1 extends BaseActivity {     protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code

   @Override protected void onCreate(Bundle savedInstanceState)

    {

         UnityPlayer.currentActivity = this;

        mUnityPlayer = new UnityPlayer(this);         //setContentView(mUnityPlayer);         setContentView(com.zukaz.client.R.layout.activity_unity_player);

     unityPlayerLayout.addView(mUnityPlayer.getView());

        mUnityPlayer.requestFocus();

}

 

/**      * Called from Unity script file      */     public void showCollectUI(UnityPlayerActivity1 context){         showBottomSheet();     }

}

 

 

C# script:

private void sendMessageToAndroid()     {         AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");         AndroidJavaClass activityContext = new AndroidJavaClass("com.company.client.augmentedreality.UnityPlayerActivity1");

        AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");         currentActivity.Call("showCollectUI", activityContext);     }

Issue:

AndroidJavaException: java.lang.NoSuchMethodError: no non-static method with name='showCollectUI' signature='(Ljava/lang/Class;)V' in class Ljava.lang.Object;                                                             java.lang.NoSuchMethodError: no non-static method with name='showCollectUI' signature='(Ljava/lang/Class;)V' in class Ljava.lang.Object;                                                                 at com.unity3d.player.ReflectionHelper.getMethodID(Unknown Source)                                                                 at com.unity3d.player.UnityPlayer.nativeRender(Native Method)                                                                 at com.unity3d.player.UnityPlayer.c(Unknown Source)                                                                 at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source)                                                                 at android.os.Handler.dispatchMessage(Handler.java:98)                                                                 at android.os.Looper.loop(Looper.java:135)                                                                 at com.unity3d.player.UnityPlayer$c.run(Unknown Source)                                                               at UnityEngine.AndroidJNISafe.CheckException () [0x00000] in <filename unknown>:0                                                               at UnityEngine.AndroidJNISafe.CallStaticObjectMethod (IntPtr clazz, IntPtr methodID, UnityEngine.jvalue[] args) [0x00000] in <filename unknown>:0                                                               at UnityEngine.AndroidReflection.GetMethodMember (IntPtr jclass, System