[Android-development] JNI problem with nested classes
Denis Kormalev
kormalev.denis at gmail.com
Mon Dec 2 08:19:07 CET 2013
Hi all,
I'm looking now at camera at android and found crash there when I try to set
custom focus area. Small research showed me that it crashes with message
dvmFindClassByName rejecting 'android/hardware/Camera$Area'
It occures in static function areaToRect() in jcamera.cpp. What is more
interesting - there is another JNI call, but to normal class, not nested one
(android.graphics.Rect) which is before call to android.hardware.Camera.Area.
I've tried to do next stuff:
1. Add class resolving to initJNI() method and use jclass instead of string
2. Get jclass instance just before this call in areaToRect() function and pass
it instead of string
Both solutions worked, but I'm sure they are not correct ones (they looks more
like workaround than like robust solutions).
As I understand - problem is in getCachedClass() function in qjni.cpp which
uses classLoader instead of FindClass() jni function (I believe it was done
for special purpose but looks like it can be a cause for this problem).
Any ideas or comments? Or I just do something wrong?
--
Regards,
Denis Kormalev
More information about the Android-development
mailing list