2014-06-13 1 views
0

J'ai créé une application qui fonctionne bien sur ma tablette mais s'arrête sur mon Samsung Galaxy Ace. Lorsque je lance LogCat, je reçois le journal suivant.VFY: code mort 0x001b-001c getDisplayWidth et android.view.InflateException

Je vais recevoir de l'aide.

 
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} 

Je ne comprends pas pourquoi cela fonctionne sur ma tablette, mais il ne le fait pas sur mon téléphone Samsung Galaxy ACE. J'ai mis en évidence ce que je comprends en lisant d'autres liens relatifs. Le journal indique que la ligne # 69 sur mon XML provoque une exception inflateException. Je montre ce fichier ensuite. Il semble que le problème est l'inflatation de la classe Visor, qui est un SurfaceView. Je reçois également un VFY: code mort 0x001b-001c et je ne sais pas quelle est l'erreur principale. VFY: deadcode ou 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"); 

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

} 

et enfin,

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); 
     } 
    } 

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

} 

Merci beaucoup d'avance.

+0

Où est-ce que getDisplayWidth()? –

+0

Qu'est-ce que 'getHolder()'? –

+0

getDisplayWidth est dans la classe ActivityJuego, à l'intérieur de la méthode onCreate. – user3739361

Répondre

1

L'exception se produit lorsque la mise en page est gonflée, pendant le constructeur pour Visor. À partir du code affiché, l'explication la plus probable est que getHolder() renvoie null là.