0

I made a simple android app that contains only some image buttons in a GridLayout, while running it on eclipse it runs without any problems or errors but when coming to the emulator it gives me nothing and when run it in my tablet it crashes,

Hint: it's not something in the emulator or the adb as the other projects run perfectly and when changing this code this project runs perfectly too, so it's something with the code.

Update: i found that the problem is in the Gridlayout as when i changed it to LinearLayout it worked, but for sure i want it to be a Grid one as the Linear Layout doesn't serve my work.

this is my .xml file :

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".Main" >

    <GridLayout
        android:id="@+id/grid1"
        android:layout_width="fill_parent"
        android:layout_height="500dp"
        android:layout_centerInParent="true"
        android:background="@android:color/darker_gray"
        android:columnCount="1"
        android:orientation="vertical" >

        <ImageButton
            android:id="@+id/imageButton1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/homeview" />

        <ImageButton
            android:id="@+id/imageButton3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_gravity="right|top"
            android:layout_row="0"
            android:src="@drawable/profiles" />

        <ImageButton
            android:id="@+id/imageButton2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_gravity="center"
            android:layout_row="0"
            android:src="@drawable/ac" />

        <ImageButton
            android:id="@+id/imageButton5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_gravity="center"
            android:layout_row="1"
            android:src="@drawable/appliances" />

        <ImageButton
            android:id="@+id/imageButton6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_gravity="right|center_vertical"
            android:layout_row="1"
            android:src="@drawable/movies" />

        <ImageButton
            android:id="@+id/imageButton4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_column="0"
            android:layout_gravity="left|center_vertical"
            android:layout_row="1"
            android:src="@drawable/lightning" />

    </GridLayout>

 </RelativeLayout>
MRefaat
  • 515
  • 2
  • 8
  • 22
  • Please post the error log – Ken Wolf Nov 24 '13 at 11:07
  • @KenWolf I posted the console error – MRefaat Nov 24 '13 at 11:12
  • The app didn't even install on the emulator. Hard to say what the exact problem is but it's not your code at this stage. More your emulator launch/setup. Have a look at some of these solutions: https://www.google.co.uk/search?q=Failed+to+install+Main.apk+on+device+'emulator-5554 – Ken Wolf Nov 24 '13 at 11:14
  • i'm already ran tons of projects using the emulator and they ran normally and till now the other projects ran normally on the emulator and on the tablet – MRefaat Nov 24 '13 at 11:33

1 Answers1

0

Reset adb in DDMS Tab. If it doesn't work, type the following commands in Command prompt

c:\...\...\Sdk\platform-tools>adb kill-server
c:\....\...\sdk\platform-tools>adb start-server
Surya
  • 21
  • 1
  • 3
  • it's not something in the emulator or the adb as the other projects run perfectly and when changing this code this project runs perfectly too, so it's something with the code. – MRefaat Nov 24 '13 at 12:19