在最近的一个新项目中,即使是新项目,我的Android Studio IDE也会在编码时意外冻结。我不记得做任何更新或任何事情,但在我变得过于偏执并刷新我的电脑之前,我想我应该先问这里:
我已按照https://developer.android.com/studio/report-bugs.html中的步骤进行操作 完整的转储文件太长了,但这里有一个片段:
Attaching to remote server pid, please wait...
2017-09-17 23:08:44
Full thread dump OpenJDK 64-Bit Server VM (25.112-b06 mixed mode):
"Layoutlib Render Thread" #80 daemon prio=4 os_prio=-1 tid=0x000000001f82c000 nid=0x2d20 runnable [0x0000000032923000]
java.lang.Thread.State: RUNNABLE
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Throwable.java:783)
- locked <0x00000000b42caee8> (a java.lang.NumberFormatException)
at java.lang.Throwable.<init>(Throwable.java:265)
at java.lang.Exception.<init>(Exception.java:66)
at java.lang.RuntimeException.<init>(RuntimeException.java:62)
at java.lang.IllegalArgumentException.<init>(IllegalArgumentException.java:52)
at java.lang.NumberFormatException.<init>(NumberFormatException.java:55)
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at android.content.res.BridgeTypedArray.getDimension(BridgeTypedArray.java:477)
at android.content.res.BridgeTypedArray.getDimensionPixelSize(BridgeTypedArray.java:416)
at android.view.View.<init>(View.java:4178)
at android.widget.TextView.<init>(TextView.java:710)
at android.widget.TextView.<init>(TextView.java:704)
at android.widget.TextView.<init>(TextView.java:700)
at sun.reflect.GeneratedConstructorAccessor129.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at android.view.LayoutInflater.createView(LayoutInflater.java:645)
at android.view.BridgeInflater.onCreateView(BridgeInflater.java:163)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:717)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:785)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:222)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:727)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:858)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:861)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:834)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:821)
at ...
唯一的出路是终止工作室。
注意:问题开始发生在我的两台PC上,两台都运行Windows 10,一台是带有16GB内存的Core i7,另一台是带有32GB内存的另一台Core i7,所有程序文件,项目文件和SDK在nvme SSD上。冻结极不可能与性能有关。
答案 0 :(得分:0)
经过一些进一步的调试后,我发现这是因为xml工具属性有问题,多个Recycler视图导致渲染冻结,代码错误的引用列表项自身
<!-- Layout file detail_content.xml -->
<!-- Recipe Ingredient List -->
<android.support.v7.widget.RecyclerView
android:id="@+id/ingredient_list_rv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layoutManager="LinearLayoutManager"
tools:context="com.sample.app.StepListActivity"
tools:listitem="@layout/detail_content" <-- listItem references itself, casuing infinite loop />
<!-- Recipe Steps List -->
<android.support.v7.widget.RecyclerView
android:id="@+id/step_list_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="LinearLayoutManager"
tools:context="com.sample.app.StepListActivity"
tools:listitem="@layout/detail_content" <-- listItem references itself, casuing infinite loop/>