2015-10-15 117 views
1

我試圖讓Android網站上的入門應用程序在Android Studio中運行。我不知道爲什麼我會擁有「應用程序可能在其主線程上做了太多工作」。這樣一個簡單的應用程序錯誤。簡單應用程序的主線程錯誤Android Studio

  1. 沒有添加到代碼除了最新的教程
  2. 改變了堆大小爲128
  3. 改變了拉姆768米
  4. 的Nexus 4 API 23
  5. 文本框和按鈕別t出現。但我沒有得到任何其他錯誤。

看起來好像有些東西丟失了,但我不知道是什麼。

10-15 08:10:12.213 2304-2304/com.example.mike.nutrition I/art: Not late-enabling -Xcheck:jni (already on) 
10-15 08:10:12.213 2304-2304/com.example.mike.nutrition I/art: Late-enabling JIT 
10-15 08:10:12.216 2304-2304/com.example.mike.nutrition I/art: JIT created with code_cache_capacity=2MB compile_threshold=1000 
10-15 08:10:12.286 2304-2304/com.example.mike.nutrition W/System: ClassLoader referenced unknown path: /data/app/com.example.mike.nutrition-1/lib/x86 
10-15 08:10:12.595 2304-2322/com.example.mike.nutrition D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 
10-15 08:10:12.607 2304-2304/com.example.mike.nutrition D/: HostConnection::get() New Host Connection established 0xaba3db60, tid 2304 
10-15 08:10:13.012 2304-2322/com.example.mike.nutrition I/OpenGLRenderer: Initialized EGL, version 1.4 
10-15 08:10:13.092 2304-2322/com.example.mike.nutrition W/EGL_emulation: eglSurfaceAttrib not implemented 
10-15 08:10:13.092 2304-2322/com.example.mike.nutrition W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xab944fe0, error=EGL_SUCCESS 
10-15 08:10:13.140 2304-2304/com.example.mike.nutrition I/Choreographer: Skipped 30 frames! The application may be doing too much work on its main thread. 
10-15 08:10:13.667 2304-2304/com.example.mike.nutrition I/Choreographer: Skipped 31 frames! The application may be doing too much work on its main thread. 
10-15 08:12:06.378 2304-2311/com.example.mike.nutrition W/art: Suspending all threads took: 5.010ms 
10-15 08:12:10.380 2304-2311/com.example.mike.nutrition W/art: Suspending all threads took: 7.298ms 



<?xml version="1.0" encoding="utf-8"?> 
     <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="horizontal"> 
      <EditText android:id="@+id/edit_message" 
       android:layout_weight="1" 
       android:layout_width="0dp" 
       android:layout_height="wrap_content" 
       android:hint="@string/edit_message" /> 
      <Button 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/button_send" /> 
     </LinearLayout> 

編輯: 我收到此錯誤:

10-15 11:45:28.829 1563-1563/com.android.launcher3 E/AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Wrong state class, expecting View State but received class android.appwidget.AppWidgetHostView$ParcelableSparseArray instead. This usually happens when two views of different type have the same id in the same hierarchy. This view's id is id/0x4. Make sure other views do not use the same id. 
+0

嘗試將模擬器的快照切換到主機GPU – Kay

+0

您能否發佈代碼? – peresisUser

回答

0

好像你沒有指定足夠的內存來你的AVD。嘗試將其升至2056.

+0

我增加了Ram和Hexm,並沒有幫助。 – mike628

+0

2056是一個奇數,應該是2048? –

+1

@TimCastelijns:不,這是偶數。只是在開玩笑! –