Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7984227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:12:06+00:00 2026-06-04T11:12:06+00:00

I wants to send data from Unity to java for my android plugin. Here’s

  • 0

I wants to send data from Unity to java for my android plugin.

Here’s my Unity Code:

AndroidJNI.AttachCurrentThread();
IntPtr cls_Activity = AndroidJNI.FindClass("com/unity3d/player/UnityPlayer");
    IntPtr fid_Activity = AndroidJNI.GetStaticFieldID(cls_Activity, "currentActivity", "Landroid/app/Activity;");
    IntPtr obj_Activity = AndroidJNI.GetStaticObjectField(cls_Activity, fid_Activity);                  
    Debug.Log("Setup Objects Complete");        

    IntPtr cls_OurAppNameActivityClass = AndroidJNI.FindClass("org/plugin/test/AdmobTestActivity"); 

    IntPtr startAdsMethod = AndroidJNI.GetMethodID(cls_OurAppNameActivityClass, "EnableAds", "(J)V");
    Debug.Log("before If Loop");        

    if (AndroidJNI.IsInstanceOf(obj_Activity, cls_OurAppNameActivityClass) != false)
    {
        //Debug.Log("Activity IS a OurAppNameActivity");
        jvalue[] myArray = new jvalue[1];
            myArray[0] = new jvalue();
            myArray[0].i = 12;
            AndroidJNI.CallVoidMethod(obj_Activity, startAdsMethod, myArray);                    

            Debug.Log("Activity Leaving a OurAppNameActivity");
    }

Here’s My Java Code:

public void EnableAds(int qwe)
{       
    Log.i(APP_TAG, "Value" + qwe);
}

ERRORS:

05-16 13:11:30.906: W/dalvikvm(12315): threadid=8: thread exiting with uncaught exception (group=0x40018578)
05-16 13:11:30.921: E/AndroidRuntime(12315): FATAL EXCEPTION: GLThread 9
05-16 13:11:30.921: E/AndroidRuntime(12315): java.lang.NoSuchMethodError: EnableAds
05-16 13:11:30.921: E/AndroidRuntime(12315):    at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
05-16 13:11:30.921: E/AndroidRuntime(12315):    at com.unity3d.player.UnityPlayer.onDrawFrame(Unknown Source)
05-16 13:11:30.921: E/AndroidRuntime(12315):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1368)
05-16 13:11:30.921: E/AndroidRuntime(12315):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1123)

AND FORCE CLOSE..

This Applications is working fine if i removed int argument from EnableAdv(int qwe) in my java code..

Can anyone tell me, what thing i m missing in this code.?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:12:08+00:00Added an answer on June 4, 2026 at 11:12 am

    I found the answer..

    I want using “(J)V” as my argument type.. but instead of this i shud to use “(I)V”.

    For example, the Java method:

    long f (int n, String s, int[] arr);
    has the following type signature:

    “(ILjava/lang/String;[I)V

    Refer this for further reading

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to send data from android application to server (.NET) but it doesn't
I want to send data through URL.I've tried the below code: Intent browserIntent =
In my code I want to send two parameters in my data. Name is
I need to send data from an IIS web server A to an Apache
I want to send data from my Windows form to client wep page(.aspx).Pls help
I want to send data from a c# application to a c++ application through
in other words, suppose I want to send data, like text, programmatically from a
I have Tabview and I want do send data from one to another. Eatch
Is it possible to send data from app engine server to another,external server with
I want to send data within a WLAN as fast as possible to another

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.