我在一年前使用Titanium SDK 3.X制作了一款应用。 iOS和Android都很好。现在,我正在尝试添加新功能。我安装了SDK 5.我在Appcelerator Studio中打开了应用程序,该应用程序在iOS中正常运行。但是,它在Android中不起作用。我调查了问题是由从集合实例中提取引起的。当我删除了抓取$.books.fetch()
时,应用程序没有崩溃。但如果我没有,它会崩溃应用程序,然后应用程序重新启动。遗憾的是,电话或控制台(在Appcelerator Studio中)没有任何错误日志。
观点:
<Alloy>
<Collection src="books" instance="true" id="books" />
<Window id="winFilterByName" title="Find By Name" >
<TableView id="allBookList" dataCollection="$.books" dataTransform="transformFunction" dataFilter="filterFunction" zIndex="0" filterAttribute="rowFilter" top="0" >
...
</TableView>
</Window>
</Alloy>
控制器:
/* Fetch the Collections
* ********************************************************* */
Alloy.Collections.bookmarks.fetch();
$.books.fetch(); //<-- This caused the problem...
在alloy.js
中,我执行下面的代码行。因此,在应用启动时,fetch()
可以访问它。
Alloy.Collections.bookmarks = Alloy.createCollection('bookmarks');
我找不到任何资源如何解决这个问题。我可以通过Google找到的资源仍然来自SDK 3.X,我已经做到了。但它在应用程序中崩溃了。
手机上的Android版本是5.1.1。
更新
这是控制台中反复出现的错误:
[ERROR] : art: Throwing OutOfMemoryError "Failed to allocate a 36 byte allocation with 32 free bytes and 32B until OOM"
然后最终会出现这个错误块
[ERROR] : art: "main" prio=5 tid=1 Runnable
[ERROR] : art: | group="main" sCount=0 dsCount=0 obj=0x76818e48 self=0xb873f410
[ERROR] : art: | sysTid=7647 nice=0 cgrp=default sched=0/0 handle=0xb6efcbec
[ERROR] : art: | state=R schedstat=( 3091837554 376855300 3730 ) utm=266 stm=43 core=0 HZ=100
[ERROR] : art: | stack=0xbe523000-0xbe525000 stackSize=8MB
[ERROR] : art: | held mutexes= "mutator lock"(shared held)
[ERROR] : art: at android.util.PathParser$PathDataNode.nodesToPath(PathParser.java:283)
[ERROR] : art: at android.graphics.drawable.VectorDrawable$VPath.toPath(VectorDrawable.java:1262)
[ERROR] : art: at android.graphics.drawable.VectorDrawable$VPathRenderer.drawPath(VectorDrawable.java:947)
[ERROR] : art: at android.graphics.drawable.VectorDrawable$VPathRenderer.drawGroupTree(VectorDrawable.java:928)
[ERROR] : art: at android.graphics.drawable.VectorDrawable$VPathRenderer.drawGroupTree(VectorDrawable.java:924)
[ERROR] : art: at android.graphics.drawable.VectorDrawable$VPathRenderer.draw(VectorDrawable.java:935)
[ERROR] : art: at android.graphics.drawable.VectorDrawable.draw(VectorDrawable.java:271)
[ERROR] : art: at android.graphics.drawable.AnimatedVectorDrawable.draw(AnimatedVectorDrawable.java:178)
[ERROR] : art: at android.widget.ProgressBar.drawTrack(ProgressBar.java:1677)
[ERROR] : art: at android.widget.ProgressBar.onDraw(ProgressBar.java:1644)
[ERROR] : art: at android.view.View.draw(View.java:15292)
[ERROR] : art: at android.view.View.updateDisplayListIfDirty(View.java:14219)
[ERROR] : art: at android.view.View.getDisplayList(View.java:14241)
[ERROR] : art: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3392)
[ERROR] : art: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3371)
[ERROR] : art: at android.view.View.updateDisplayListIfDirty(View.java:14179)
[ERROR] : art: at android.view.View.getDisplayList(View.java:14241)
[ERROR] : art: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3392)
[ERROR] : art: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3371)
[ERROR] : art: at android.view.View.updateDisplayListIfDirty(View.java:14179)
[ERROR] : art: at android.view.View.getDisplayList(View.java:14241)
[ERROR] : art: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3392)
[ERROR] : art: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3371)
[ERROR] : art: at android.view.View.updateDisplayListIfDirty(View.java:14179)
[ERROR] : art: at android.view.View.getDisplayList(View.java:14241)
[ERROR] : art: at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:3392)
[ERROR] : art: at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3371)
...