タイトルの通りですが、
▼やりたいこと
xml定義されたViewを4000個ScrollViewにaddViewしたいです。
4000回inflateするViewの構成は以下の通りです。
- LinearLayout 6個
- TextView 2個
- ImageView 2個
▼エラー
text
106-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] JNI ERROR (app bug): weak global reference table overflow (max=51200) 206-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] weak global reference table dump: 306-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] Last 10 entries (of 51200): 406-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51199: 0x17d1b178 android.view.RenderNode 506-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51198: 0x17d1b160 android.view.RenderNode 606-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51197: 0x17d1b148 android.view.RenderNode 706-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51196: 0x17d1b088 android.view.RenderNode 806-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51195: 0x17d10f58 android.view.RenderNode 906-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51194: 0x17d10e98 android.view.RenderNode 1006-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51193: 0x17d10df0 android.view.RenderNode 1106-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51192: 0x17d10dd8 android.view.RenderNode 1206-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51191: 0x17d10dc0 android.view.RenderNode 1306-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51190: 0x17d10da8 android.view.RenderNode 1406-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] Summary: 1506-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of com.google.android.gms.dynamite.zzg 1606-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of ad 1706-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of java.lang.Thread 1806-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 3 of byte[] (576 elements) (3 unique instances) 1906-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 3 of byte[] (2200 elements) (3 unique instances) 2006-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (3072 elements) 2106-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 5 of byte[] (4096 elements) (5 unique instances) 2206-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 4 of byte[] (4480 elements) (4 unique instances) 2306-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (7680 elements) 2406-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 9 of byte[] (9216 elements) (9 unique instances) 2506-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 27 of byte[] (11664 elements) (27 unique instances) 2606-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 2 of byte[] (15376 elements) (2 unique instances) 2706-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 2 of byte[] (15488 elements) (2 unique instances) 2806-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 14 of byte[] (16384 elements) (14 unique instances) 2906-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 3 of byte[] (20736 elements) (3 unique instances) 3006-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 2 of byte[] (21120 elements) (2 unique instances) 3106-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 3 of byte[] (35328 elements) (3 unique instances) 3206-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 3 of byte[] (36864 elements) (3 unique instances) 3306-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 2 of byte[] (46080 elements) (2 unique instances) 3406-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 4 of byte[] (49600 elements) (4 unique instances) 3506-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (80400 elements) 3606-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (112896 elements) 3706-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 5 of byte[] (119716 elements) (5 unique instances) 3806-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 6 of byte[] (123904 elements) (6 unique instances) 3906-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (144400 elements) 4006-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (160000 elements) 4106-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (232320 elements) 4206-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (246016 elements) 4306-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (278784 elements) 4406-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (291600 elements) 4506-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (404496 elements) 4606-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (409600 elements) 4706-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (440896 elements) 4806-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (553344 elements) 4906-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 2 of byte[] (577600 elements) (2 unique instances) 5006-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (719680 elements) 5106-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (1725440 elements) 5206-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (2919456 elements) 5306-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (3456000 elements) 5406-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 1 of byte[] (8640000 elements) 5506-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 2 of byte[] (13307904 elements) (2 unique instances) 5606-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 7 of dalvik.system.PathClassLoader (4 unique instances) 5706-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 60 of java.lang.DexCache (60 unique instances) 5806-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 51010 of android.view.RenderNode (51010 unique instances) 5906-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 6006-19 13:45:52.757 17071-17071/xx.xx.xxxxxx.xxxx A/art: art/runtime/runtime.cc:427] 6106-19 13:45:52.821 17071-17071/xx.xx.xxxxxx.xxxx A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 17071 (.xx.xxxx.xxxx) 62 63 [ 06-19 13:45:52.845 438: 438 W/ ] 64 debuggerd: handling request: pid=17071 uid=10349 gid=10349 tid=17071 65
▼やってみたと
メモリ不足だと思ってappのbuild.gradleに以下を追加しましたが変わりませんでした。
text
1 dexOptions { 2 javaMaxHeapSize "4g" 3 }
▼環境
android studio 2.3.3
min sdk 21
target sdk 25
compile sdk 25