0

I created an app which works fine on my tablet but stops on my samsung galaxy ace. When I run LogCat I get the next log.

I'll apreciate any help.

I/DefContainer( 6430): Copied /mnt/sdcard/apps/ketekambioFull.apk to /mnt/asec/smdl2tmp1/pkg.apk
D/MountService( 1492):  :::: renameSecureContainer :: path = /mnt/sdcard, oldId = smdl2tmp1, newId = com.mydom.mypackage-1
D/VoldCmdListener( 1319): asec rename smdl2tmp1 com.mydom.mypackage-1
D/MountService( 1492):  :::: isSecureContainerMounted :: path = /mnt/sdcard, id = com.mydom.mypackage-1
W/PackageManager( 1492): Mounting container com.mydom.mypackage-1
D/MountService( 1492):  :::: mountSecureContainer :: path = /mnt/sdcard, id = com.mydom.mypackage-1, ownerUid = 1000
D/VoldCmdListener( 1319): asec mount com.mydom.mypackage-1 {} 1000
D/Vold    ( 1319): Fat::doMount mount(/dev/block/dm-2, /mnt/asec/com.mydom.mypackage-1,vfat,0x00200087,utf8,uid=1000,gid=0,fmask=222,dmask=222,shortname=mixed)
I/PackageManager( 1492): Succesfully renamed smdl2tmp1 to com.mydom.mypackage-1 at new path: /mnt/asec/com.mydom.mypackage-1
D/MountService( 1492):  :::: getSecureContainerPath :: path = /mnt/sdcard, id = com.mydom.mypackage-1
D/VoldCmdListener( 1319): asec path com.mydom.mypackage-1
D/MountService( 1492):  :::: isSecureContainerMounted :: path = /mnt/sdcard, id = com.mydom.mypackage-1
I/Z7BroadcastReceiver( 4649): onReceive() start, intent: Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.mydom.mypackage flg=0x10000000 cmp=com.seven.Z7/.service.Z7BroadcastReceiver (has extras) }
D/Launcher.SWidgetPkgMgr( 1585): addPackage=com.mydom.mypackage
V/PackageIntentReceiver( 4603): onReceive() intent:Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.mydom.mypackage flg=0x10000000 cmp=com.sec.android.app.controlpanel/.PackageIntentReceiver (has extras) } pkg:com.mydom.mypackage action:android.intent.action.PACKAGE_ADDED
I/ActivityManager( 1492): Start proc com.mydom.mypackage for activity com.mydom.mypackage/.SplashScreenActivity: pid=6501 uid=10080 gids={}
W/ActivityManager( 1492): Trying to launch com.mydom.mypackage/.ActivityJuego
D/dalvikvm( 6501): VFY: dead code 0x001b-001c in Lcom/corral/keteKambio/ActivityJuego;.getDisplayWidth (Landroid/content/Context;)I
D/dalvikvm( 6501): VFY: dead code 0x002e-0034 in Lcom/corral/keteKambio/Visor;. (Landroid/content/Context;)V
D/dalvikvm( 6501): VFY: dead code 0x002e-0034 in Lcom/corral/keteKambio/Visor;. (Landroid/content/Context;Landroid/util/AttributeSet;)V
D/dalvikvm( 6501): VFY: dead code 0x002e-0034 in Lcom/corral/keteKambio/Visor;. (Landroid/content/Context;Landroid/util/AttributeSet;I)V
E/AndroidRuntime( 6501): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mydom.mypackage/com.mydom.mypackage.ActivityJuego}: android.view.InflateException: Binary XML file line #69: Error inflating class com.mydom.mypackage.Visor
E/AndroidRuntime( 6501): Caused by: android.view.InflateException: Binary XML file line #69: Error inflating class com.mydom.mypackage.Visor
E/AndroidRuntime( 6501):    at com.mydom.mypackage.ActivityJuego.onCreate(ActivityJuego.java:101)
E/AndroidRuntime( 6501):    at com.mydom.mypackage.Visor.(Visor.java:87)
W/ActivityManager( 1492):   Force finishing activity com.mydom.mypackage/.ActivityJuego
W/ActivityManager( 1492): Activity pause timeout for HistoryRecord{40849d30 com.mydom.mypackage/.ActivityJuego}
D/VoldCmdListener( 1319): CommandListener::AsecCmd::runCommand -> com.mydom.mypackage-1 
E/InputDispatcher( 1492): channel '407a6fa8 com.mydom.mypackage/com.mydom.mypackage.SplashScreenActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
E/InputDispatcher( 1492): channel '407a6fa8 com.mydom.mypackage/com.mydom.mypackage.SplashScreenActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowManager( 1492): WIN DEATH: Window{407a6fa8 com.mydom.mypackage/com.mydom.mypackage.SplashScreenActivity paused=true}
W/ActivityManager( 1492): Activity destroy timeout for HistoryRecord{40ab1d68 com.mydom.mypackage/.SplashScreenActivity}
W/ActivityManager( 1492): Activity destroy timeout for HistoryRecord{40849d30 com.mydom.mypackage/.ActivityJuego}

I don't understand why it works on my tablet but it doesn't on my phone samsung galaxy ace. I have highlighted what I understand reading other relative links.

The log indicates that line #69 on my XML provokes an inflateException. I show this file next. It seems that the problem is inflatting the class Visor, which is a SurfaceView. I also get a VFY: dead code 0x001b-001c and I don't know which is the main error. VFY: deadcode or InflateException?.

ActivityJuego.xml:

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/TableLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:stretchColumns="3"
tools:context=".MainActivity" >

...
...
...
...

    <LinearLayout
        android:id="@+id/LinearLayoutVistaCliente"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1"
        android:background="@drawable/borde"
        android:padding="1dp"
        android:paddingLeft="1dp"
        android:paddingTop="1dp"
        android:paddingRight="1dp"
        android:paddingBottom="1dp">

        <com.mydom.mypackage.Visor
            android:id="@+id/visorCliente"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1.0" />

    </LinearLayout>

...
...
...
...

</TableLayout>

ActivityJuego.java

package com.mydom.mypackage;


public class ActivityJuego extends Activity {

    public static int nivel = 1;
    private Visor visorCliente;
    private Visor visorCaja;
    private static Typeface myTypeface;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        if (getDisplayWidth(this) <= 720) {
            smallScreen = true;
            requestWindowFeature(Window.FEATURE_NO_TITLE);
        }

        setContentView(R.layout.activity_juego);

        visorCliente = (Visor) findViewById(R.id.visorCliente);
        visorCaja = (Visor) findViewById(R.id.visorCaja);
        myTypeface = Typeface.createFromAsset(this.getAssets(), "LCD.ttf");

    }
...
...
...
...

}

and finally,

Visor.java

package com.mydom.mypackage;

public class Visor extends SurfaceView implements SurfaceHolder.Callback {

    BitmapFactory.Options opts = new BitmapFactory.Options();

...
...
...

    public Visor(Context context) {
        super(context);
        getHolder().addCallback(this);
        opts.inMutable=true;
    }

    public Visor(Context context, AttributeSet attrs) {
        super(context, attrs);
        getHolder().addCallback(this);
        opts.inMutable=true;
   }

    public Visor(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        getHolder().addCallback(this);
        opts.inMutable=true;
    }

    @Override
    protected void onDraw(Canvas canvas) {
        canvas.drawColor(Color.WHITE);
        if (caja != null) {
            draw(caja, canvas);
        }
    }

...
...
...
...

}

Many thanks in advance.

matiash
  • 54,791
  • 16
  • 125
  • 154
user3739361
  • 1
  • 1
  • 1

1 Answers1

1

The exception occurs when the layout is inflated, during the constructor for Visor.

From the posted code, the most likely explanation is that getHolder() returns null there.

matiash
  • 54,791
  • 16
  • 125
  • 154