在我的Android应用程序中,我广泛使用了返回一些数据的本机方法。
然而,在多次通话后,我获得了一次撞车。
本机调用方法是:
static jbyteArray JNIGetIcon(JNIEnv* e, jclass clazz)
{
ByteBuffer buff;
buff.Write(*icon, 48, 32, r66Api::IBitmap::TEncoding::EEnc_Rgba8888);
jbyteArray result = GetEnv()->NewByteArray(buff.Size());
GetEnv()->SetByteArrayRegion(result, 0, buff.Size(), (jbyte*) buff.GetData());
return result;
}
有人能指出我做错了吗?
崩溃日志是:
02-10 18:33:32.075 W/dalvikvm(10644*10644): ReferenceTable overflow (max=1024)
02-10 18:33:32.075 W/dalvikvm(10644*10644): Last 10 entries in JNI pinned array reference table:
02-10 18:33:32.075 W/dalvikvm(10644*10644): 1014: 0x2fc77de0 cls=[C (28 bytes)
02-10 18:33:32.075 W/dalvikvm(10644*10644): 1015: 0x2fc79b88 cls=[C (28 bytes)
02-10 18:33:32.075 W/dalvikvm(10644*10644): 1016: 0x2fc79c38 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1017: 0x2fc79ef8 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1018: 0x2fc79fa8 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1019: 0x2fc7a050 cls=[C (28 bytes)
02-10 18:33:32.085 W/dalvikvm(10644*10644): 1020: 0x2fc7a0f0 cls=[C (28 bytes)
02-10 18:33:32.105 W/dalvikvm(10644*10644): 1021: 0x2fc7a190 cls=[C (28 bytes)
02-10 18:33:32.105 W/dalvikvm(10644*10644): 1022: 0x2fc7a240 cls=[C (28 bytes)
02-10 18:33:32.105 W/dalvikvm(10644*10644): 1023: 0x2fc7a2e8 cls=[C (28 bytes)
02-10 18:33:32.115 W/dalvikvm(10644*10644): JNI pinned array reference table summary (1024 entries):
02-10 18:33:32.115 W/dalvikvm(10644*10644): 6 of [C 20B (5 unique)
02-10 18:33:32.115 W/dalvikvm(10644*10644): 1013 of [C 28B (237 unique)
02-10 18:33:32.125 W/dalvikvm(10644*10644): 2 of [C 36B (2 unique)
02-10 18:33:32.125 W/dalvikvm(10644*10644): 1 of [C 52B
02-10 18:33:32.125 W/dalvikvm(10644*10644): 1 of [C 68B
02-10 18:33:32.125 W/dalvikvm(10644*10644): 1 of [C 92B
02-10 18:33:32.125 W/dalvikvm(10644*10644): Memory held directly by native code is 7020 bytes
02-10 18:33:32.135 E/dalvikvm(10644*10644): Failed adding to JNI pinned array ref table (1024 entries)
02-10 18:33:32.135 I/dalvikvm(10644*10644): "main" prio=5 tid=3 RUNNABLE
02-10 18:33:32.135 I/dalvikvm(10644*10644): | group="main" sCount=0 dsCount=0 s=N obj=0x2aaca308 self=0xbe08
02-10 18:33:32.135 I/dalvikvm(10644*10644): | sysTid=10644 nice=0 sched=0/0 cgrp=unknown handle=1877224116
02-10 18:33:32.135 I/dalvikvm(10644*10644): at android.graphics.Canvas.drawText(Native Method)
02-10 18:33:32.145 I/dalvikvm(10644*10644): at android.text.BoringLayout.draw(BoringLayout.java:363)
02-10 18:33:32.145 I/dalvikvm(10644*10644): at android.widget.TextView.onDraw(TextView.java:4052)
02-10 18:33:32.155 I/dalvikvm(10644*10644): at android.view.View.draw(View.java:6535)
02-10 18:33:32.155 I/dalvikvm(10644*10644): at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
02-10 18:33:32.155 I/dalvikvm(10644*10644): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.View.draw(View.java:6538)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.View.buildDrawingCache(View.java:6297)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.View.getDrawingCache(View.java:6086)
02-10 18:33:32.165 I/dalvikvm(10644*10644): at android.view.ViewGroup.drawChild(ViewGroup.java:1456)
02-10 18:33:32.175 I/dalvikvm(10644*10644): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
答案 0 :(得分:6)
我认为你正在看错了功能。根据日志消息,你有一大堆固定字符数组(“[C”)。确切地说,其中1013个。
查找没有匹配版本的GetStringChars或GetStringCritical调用。