2017-05-23 23 views
0

你好我目前有这个消息时,我尝试我的应用程序部署到仿真器和它发生正是我附上布局的活性,即的Java,Lang.OutOfMemoryError上Xamarin的Android部署

SetContentView(Resource.Layout.Main); 

的完整的错误消息说“无法与1048576个免费字节和95,直到OOM分配6569942字节分配

这里是我的布局:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 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:id="@+id/coordLayout" 
    tools:context=".MainActivity"> 
    <LinearLayout 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 
      <ImageView 
       android:layout_marginTop="40sp" 
       android:id="@+id/logo" 
       android:layout_width="200sp" 
       android:layout_height="200sp" 
       android:src="@drawable/cpdep" 
       android:layout_gravity="center_horizontal" /> 
      <EditText 
       android:id="@+id/user" 
       android:layout_marginTop="20sp" 
       android:layout_gravity="center_horizontal" 
       android:layout_width="300sp" 
       android:layout_height="wrap_content" 
       android:hint="Username" /> 
      <EditText 
       android:id="@+id/pass" 
       android:layout_gravity="center_horizontal" 
       android:layout_width="300sp" 
       android:layout_height="wrap_content" 
       android:hint="Password" 
       android:layout_marginTop="20sp" /> 
      <Button 
       android:layout_marginTop="20sp" 
       android:layout_marginRight="40sp" 
       android:id="@+id/myButton" 
       android:layout_width="100sp" 
       android:layout_height="wrap_content" 
       android:text="Log in" 
       android:layout_gravity="right" /> 
    </LinearLayout> 
</android.support.design.widget.CoordinatorLayout> 

你有呃关于如何解决这个问题的想法?在此先感谢您的帮助

+1

你的布局是怎样的?你能否更新显示这个的原始文章? – apineda

+0

是的,当然如果这可以帮助 – Geeksan

+1

你想尝试更新所有你“sp”到“dp”除了textSize(如果有的话)?这就是说你将拥有宽度为200dp,高度为200dp的ImageView。 – apineda

回答

1

我弄清楚出了什么问题,这是因为我在布局中使用的图像的大小。它是2.89 MB,分辨率为6200x6199。我用photoshop调整大小,一切工作都正常,这要归功于@apenide