0

我的應用程序使用Ti.Contacts.getAllPeople()讀出手機上的聯繫人。在iOS上一切正常,在Android上正常工作,直到聯繫人數量在400左右。如果你開始與超過500個聯繫人的應用程序,它具有以下錯誤崩潰:編譯時出現Appcelerator Android Ti.Contacts.getAllPeople()jni錯誤本地參考表溢出

[INFO] : art: art/runtime/indirect_reference_table.cc:98] JNI ERROR (app bug): local reference table overflow (max=512) 
[INFO] : art: art/runtime/indirect_reference_table.cc:98] local reference table dump: 
[INFO] : art: art/runtime/indirect_reference_table.cc:98] Last 10 entries (of 510): 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  509: 0x23182b80 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  508: 0x23182b20 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  507: 0x23182ac0 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  506: 0x23182a60 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  505: 0x23182a00 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  504: 0x231829a0 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  503: 0x23182940 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  502: 0x231828e0 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  501: 0x23182880 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  500: 0x23182820 ti.modules.titanium.contacts.PersonProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98] Summary: 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]   1 of ti.modules.titanium.ui.WindowProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]  508 of ti.modules.titanium.contacts.PersonProxy (508 unique instances) 
[INFO] : art: art/runtime/indirect_reference_table.cc:98]   1 of org.appcelerator.titanium.proxy.ActivityProxy 
[INFO] : art: art/runtime/indirect_reference_table.cc:98] 
[INFO] : art: art/runtime/runtime.cc:289] Runtime aborting... 
[INFO] : art: art/runtime/runtime.cc:289] Aborting thread: 
[INFO] : art: art/runtime/runtime.cc:289] "KrollRuntimeThread" prio=5 tid=15 Runnable 
[INFO] : art: art/runtime/runtime.cc:289] | group="" sCount=0 dsCount=0 obj=0x22c07460 self=0xf3fa0400 
[INFO] : art: art/runtime/runtime.cc:289] | sysTid=2001 nice=0 cgrp=default sched=0/0 handle=0xf3c56580 
[INFO] : art: art/runtime/runtime.cc:289] | state=R schedstat=(370171847 41934738 232) utm=26 stm=10 core=1 HZ=100 
[INFO] : art: art/runtime/runtime.cc:289] | stack=0xe27ac000-0xe27ae000 stackSize=1052KB 
[INFO] : art: art/runtime/runtime.cc:289] | held mutexes= "abort lock" "mutator lock"(shared held) 
[INFO] : art: art/runtime/runtime.cc:289] native: #00 pc 00005d03 /system/lib/libbacktrace_libc++.so (UnwindCurrent::Unwind(unsigned int, ucontext*)+83) 
[INFO] : art: art/runtime/runtime.cc:289] native: #01 pc 00003051 /system/lib/libbacktrace_libc++.so (Backtrace::Unwind(unsigned int, ucontext*)+33) 
[INFO] : art: art/runtime/runtime.cc:289] native: #02 pc 003c9b97 /system/lib/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, char const*, art::mirror::ArtMethod*)+135) 
[INFO] : art: art/runtime/runtime.cc:289] native: #03 pc 00392f52 /system/lib/libart.so (art::Thread::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) const+306) 
[INFO] : art: art/runtime/runtime.cc:289] native: #04 pc 00377674 /system/lib/libart.so (art::AbortState::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)+644) 
[INFO] : art: art/runtime/runtime.cc:289] native: #0 
[INFO] : art: art/runtime/runtime.cc:289] native: #06 pc 000ec704 /system/lib/libart.so (art::LogMessage::~LogMessage()+1876) 
[INFO] : art: art/runtime/runtime.cc:289] native: #07 pc 00224429 /system/lib/libart.so (art::IndirectReferenceTable::Add(unsigned int, art::mirror::Object*)+1065) 
[INFO] : art: art/runtime/runtime.cc:289] native: #08 pc 002cb4e8 /system/lib/libart.so (art::JNI::NewString(_JNIEnv*, unsigned short const*, int)+392) 
[INFO] : art: art/runtime/runtime.cc:289] native: #09 pc 00087517 /data/app/co.rittler.invitepro-1/lib/x86/libkroll-v8.so (titanium::TypeConverter::jsValueToJavaString(_JNIEnv*, v8::Handle<v8::Value>)+103) 
[INFO] : art: art/runtime/runtime.cc:289] native: #10 pc 0011c323 /data/app/co.rittler.invitepro-1/lib/x86/libkroll-v8.so (titanium::app::PropertiesModule::hasProperty(v8::Arguments const&)+691) 
[INFO] : art: art/runtime/runtime.cc:289] native: #11 pc 000a93d2 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #12 pc 0004ea24 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #13 pc 000b5fea (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #14 pc 000b102e (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #15 pc 00003b40 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #16 pc 0001eafc (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #17 pc 0001f163 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #18 pc 00003b40 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #19 pc 00017bf1 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #20 pc 00008c29 (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #21 pc 002a5b70 /data/app/co.rittler.invitepro-1/lib/x86/libkroll-v8.so (???) 
[INFO] : art: art/runtime/runtime.cc:289] native: #22 pc 68ffffff ??? 
[INFO] : art: art/runtime/runtime.cc:289] at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native method) 
[INFO] : art: art/runtime/runtime.cc:289] at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62) 
[INFO] : art: art/runtime/runtime.cc:289] at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollProxy.java:908) 
[INFO] : art: art/runtime/runtime.cc:289] at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131) 
[INFO] : art: art/runtime/runtime.cc:289] at org.appcelerator.titaniu 
[INFO] : art: art/runtime/runtime.cc:289] at android.os.Handler.dispatchMessage(Handler.java:98) 
[INFO] : art: art/runtime/runtime.cc:289] at android.os.Looper.loop(Looper.java:135) 
[INFO] : art: art/runtime/runtime.cc:289] at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112) 
[INFO] : art: art/runtime/runtime.cc:289] Dumping all threads without appropriate locks held: thread list lock 

錯誤與5.1.2GA,但我也試過5.1.0GA和5.0.1GA。

任何人都可以幫忙嗎?是否有解決方法來正確讀取聯繫人?

感謝, 基督教

回答

0

鈦Appcelerator的世界,當你啓動應用程序,在本機代碼中創建一個JavaScript的執行環境,和你的應用程序源代碼進行評估。注入應用程序的JavaScript運行時環境就是我們所說的「代理」對象 - 基本上是一個JavaScript對象,它具有本機代碼中的配對對象。通俗地說,我們經常會在Titanium應用程序中提到「JavaScript土地」和「本地土地」,因爲它們是彼此平行的宇宙。代理對象既存在於JavaScript土地上,也存在於本土土地上,並作爲兩者之間的「橋樑」。現在看下面的代碼樣本。

for(i = 0; i<$.tableSection.rowCount; i++){ 
    $.tableSection.rows[i].children[1].image = "/myimage.png"; 
    $.tableSection.rows[i].children[0].color = '#fff'; 
    $.tableSection.rows[i].backgroundColor = '#000'; 
} 

而且

var rows = $.tableSection.rows; 
for(i = 0; i<$.tableSection.rowCount; i++){ 
    rows[i].children[1].image = "/myimage.png"; 
    rows[i].children[0].color = '#fff'; 
    rows[i].backgroundColor = '#000'; 
} 

現在,在第一個像上面跨橋分配屬性值。它在本土創造了一些參考,不會在本土自動銷燬。所以本地拋出錯誤。參考表溢出的類似示例在Android : JNI ERROR (app bug): local reference table overflow (max=512)中。第二個代碼減少了原生地的參考數量。所以推薦就是這樣。欲瞭解更多這裏是全球化志願服務青年http://jaljale.com/blog/titanium-appcelerator-crossing-the-bridge-dalvikvm-jni-error-app-bug-local-reference-table-overflow-max-512/

+0

是的,我發現這篇文章,但我的問題是,Ti.Contacts.getAllPeople()是Appcelerator的功能,這樣我就可以如果它跨過橋樑不會產生影響,不是嗎? –

+0

我會告訴你在https://jira.appcelerator.org/上創建一個JIRA票據,因爲這是一個錯誤,但已經有一個關於這個問題的公開票證https://jira.appcelerator.org/browse/TIMOB -15765關注任何更新的故障單。 –

相關問題