Posts: 5
Joined: Jul 2013
Reputation:
0
2013-07-11, 06:26
Im a fresh developer. Thx to read this:
In XBMC for android, I add My own code(Java) ,it's package is org.xbmc.xbmc.Util
How C++ can invoke Util's function.
I try this In XBMCApp.cpp:
JNIEnv *env = NULL;
AttachCurrentThread(&env);
jclass UtilClass = NULL;
UtilClass = env->FindClass("org/xbmc/xbmc/Util");
CLog::Log(LOGDEBUG, "UtilClass is %d",UtilClass);
Unfortunately UtilClass is 0,so I can't callMethod in Util.
Any one has an idea? Thank you ~
Posts: 11,582
Joined: Feb 2008
Reputation:
84
davilla
Retired-Team-XBMC Developer
Posts: 11,582
2013-07-11, 06:58
(This post was last modified: 2013-07-11, 06:59 by davilla.)
Please don't use org.xbmc.xbmc signature for your own packages. org.xbmc.xbmc.xxx is reserved for our usage.
Your code usage is stale
JNIEnv* env = xbmc_jnienv();
jclass UtilClass = env->FindClass("org/<your sig here>");
Posts: 5
Joined: Jul 2013
Reputation:
0
Thx for your reply.
But it's still not working as what you said, I change my java class to com.star.Util
jclass stringClass = env->FindClass("java/lang/String");
CLog::Log(LOGDEBUG, "stringClass is %d",stringClass);
jclass UtilClass = env->FindClass("com/star/Util");
CLog::Log(LOGDEBUG, "bbbb UtilClass %d",UtilClass);
stringClass is OK, but UtilClass is 0, I also add Util java file in packing Makefile , Waiting for your opinion.
Posts: 16,946
Joined: Feb 2011
Reputation:
256
JNIEnv* env = xbmc_jnienv(); <- you definitly did that?
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much:
click here
HowTo setup NFS for Kodi:
NFS (wiki)
HowTo configure avahi (zeroconf):
Avahi_Zeroconf (wiki)
READ THE IOS FAQ!:
iOS FAQ (wiki)
Posts: 11,582
Joined: Feb 2008
Reputation:
84
davilla
Retired-Team-XBMC Developer
Posts: 11,582
We are well past frodo in mainline. jni handling has been completely re-factored.
Perhaps you should push up to github the work you are doing so we can see all the code. Seeing two lines out of many lines of code will not give much help. Also perhaps you should pastebin the logcat of xbmc launching and trying to run your code. There could be lots of important messages there that we cannot see.
Posts: 5
Joined: Jul 2013
Reputation:
0
OK,thank you, I'll try XBMC 13~ I'll back here next week.