IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Android Discussion :

problème avec le manifest


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Avril 2011
    Messages
    104
    Détails du profil
    Informations forums :
    Inscription : Avril 2011
    Messages : 104
    Par défaut problème avec le manifest
    Bonjour, j'ai un bug récurrent. Mon appli plante lorsque je veux accéder au menu suivant et je ne comprend pas pourquoi.

    En cliquant sur le bouton lancement je devrais accéder à la classe menutest. L'autre bouton renvoyant à une autre classe sans que je ne vois un quelconque problème.

    Peut être ais je mal établi le manifest ...

    Voici mon code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.aviy.memory"
          android:versionCode="1"
          android:versionName="1.0">
        <application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false">
            <activity android:name=".Menudepart"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
     
            <activity android:name=".Menutest"></activity>
            <activity android:name=".Score"></activity>   
    		<activity android:name=".Jeu"></activity>
    		<activity android:name=".Jeu1"></activity>
    		<activity android:name=".Jeu2"></activity>
     
     
     
        </application>
        <uses-sdk android:minSdkVersion="2" />
     
    </manifest>
    Voila la classe de départ :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    package com.aviy.memory;
     
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuInflater;
    import android.view.MenuItem;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.Toast;
     
    public class Menudepart extends Activity implements OnClickListener {
    	Button lancement = null;
    	Button score=null;
     
    	/** Called when the activity is first created. **/
     
        @Override
        public boolean onCreateOptionsMenu(Menu menu){
        	MenuInflater inflater =getMenuInflater();
        	inflater.inflate(R.menu.monmenu, menu);
        	return true;
    	}
     
    	public boolean onMenuItemSelected(int featureId,MenuItem item){
     
        	switch (item.getItemId()){
           	case R.id.Regles:
           		Toast.makeText(this,"Sélectionnez un niveau de difficulté",Toast.LENGTH_SHORT).show();
           		return true;
     
           	case R.id.Quitter:
           		finish();
           		return true;
     
           	case R.id.Auteur:
           		Toast.makeText(this,"EcoCO2",Toast.LENGTH_SHORT).show();
     
           	}
           	return super.onMenuItemSelected(featureId, item);
     
           	}
     
     
    	public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.menudepart);
     
            lancement=(Button)findViewById(R.id.button1);
            lancement.setOnClickListener(this);
            score=(Button)findViewById(R.id.button2);
            score.setOnClickListener(this);
        }
     
    	@Override
        public void onClick(View v){
            if(v==lancement){
    	        Intent monIntent=new Intent(this,Menutest.class);
    	        startActivity(monIntent);
            }
            if(v==score){
    	        Intent monIntent=new Intent(this,Score.class);
    	        startActivity(monIntent);
            }
        }
     
    }
    et la classe qui devrait être appelé :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    package com.aviy.memory;
     
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuInflater;
    import android.view.MenuItem;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.widget.Button;
    import android.widget.Toast;
     
     
    //allez voir dans le manifest pour l'ordre d'affichage des layout
     
    //menu de base de l'application
    public class Menutest extends Activity implements OnClickListener {
     
    	Button Facile = null;
    	Button Moyen=null;
    	Button Difficile=null;
     
    	/** Called when the activity is first created. **/
     
        @Override
        public boolean onCreateOptionsMenu(Menu menu){
        	MenuInflater inflater =getMenuInflater();
        	inflater.inflate(R.menu.monmenu, menu);
        	return true;
    	}
     
    	public boolean onMenuItemSelected(int featureId,MenuItem item){
     
        	switch (item.getItemId()){
           	case R.id.Regles:
           		Toast.makeText(this,"Sélectionnez un niveau de difficulté",Toast.LENGTH_SHORT).show();
           		return true;
     
           	case R.id.Quitter:
           		finish();
           		return true;
     
           	case R.id.Auteur:
           		Toast.makeText(this,"EcoCO2",Toast.LENGTH_SHORT).show();
     
           	}
           	return super.onMenuItemSelected(featureId, item);
     
           	}
     
     
    	public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.typejeu);
     
            Facile=(Button)findViewById(R.id.button1);
            Facile.setOnClickListener(this);
            Moyen=(Button)findViewById(R.id.button2);
            Moyen.setOnClickListener(this);
            Difficile=(Button)findViewById(R.id.button3);
            Difficile.setOnClickListener(this);
        }
     
    	@Override
        public void onClick(View v){
            if(v==Facile){
    	        Intent monIntent=new Intent(this,Jeu1.class);
    	        startActivity(monIntent);
            }
            if(v==Moyen){
    	        Intent monIntent=new Intent(this,Jeu2.class);
    	        startActivity(monIntent);
            }
            if(v==Difficile){
                Intent monIntent=new Intent(this,Jeu.class);
                startActivity(monIntent);        
            }
        }
     
    }
    En sachant que si je demande à la classe menutest d'être en "launcher" je n'ai plus de bug.

  2. #2
    Expert confirmé

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Par défaut
    Bonjour,

    Merci de nous poster ton logcat contenant les erreurs générées , cela devient d'un coup plus simple pour trouver ton erreur.

  3. #3
    Membre confirmé
    Inscrit en
    Avril 2011
    Messages
    104
    Détails du profil
    Informations forums :
    Inscription : Avril 2011
    Messages : 104
    Par défaut
    Mon logcat ne me retourne aucune erreur cohérente :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    05-23 09:56:51.347: WARN/WindowManager(51): Dispatch state: {{KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to Window{438c9de0 StatusBarExpanded paused=false} @ 1306144506864 lw=Window{438c9de0 StatusBarExpanded paused=false} lb=android.view.ViewRoot$W@438c9a30 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=null}}
    05-23 09:56:51.347: INFO/WindowManager(51): focus null mToken is null at event dispatch!
    05-23 09:56:51.347: WARN/WindowManager(51): Current state:  {{KeyEvent{action=0 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to null @ 1306144611349 lw=null lb=null fin=true gfw=true ed=true tts=0 wf=false fp=false mcf=null}}
    05-23 09:56:51.347: WARN/WindowManager(51): Continuing to wait for key to be dispatched
    05-23 09:56:56.365: WARN/WindowManager(51): Key dispatching timed out sending to <null>
    05-23 09:56:56.365: WARN/WindowManager(51): Dispatch state: {{KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to Window{438c9de0 StatusBarExpanded paused=false} @ 1306144506864 lw=Window{438c9de0 StatusBarExpanded paused=false} lb=android.view.ViewRoot$W@438c9a30 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=null}}
    05-23 09:56:56.384: INFO/WindowManager(51): focus null mToken is null at event dispatch!
    05-23 09:56:56.384: WARN/WindowManager(51): Current state:  {{KeyEvent{action=0 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to null @ 1306144616388 lw=null lb=null fin=true gfw=true ed=true tts=0 wf=false fp=false mcf=null}}
    05-23 09:56:56.384: WARN/WindowManager(51): Continuing to wait for key to be dispatched
    05-23 09:57:01.442: WARN/WindowManager(51): Key dispatching timed out sending to <null>
    05-23 09:57:01.442: WARN/WindowManager(51): Dispatch state: {{KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to Window{438c9de0 StatusBarExpanded paused=false} @ 1306144506864 lw=Window{438c9de0 StatusBarExpanded paused=false} lb=android.view.ViewRoot$W@438c9a30 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=null}}
    05-23 09:57:01.442: INFO/WindowManager(51): focus null mToken is null at event dispatch!
    05-23 09:57:01.442: WARN/WindowManager(51): Current state:  {{KeyEvent{action=0 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to null @ 1306144621449 lw=null lb=null fin=true gfw=true ed=true tts=0 wf=false fp=false mcf=null}}
    05-23 09:57:01.453: WARN/WindowManager(51): Continuing to wait for key to be dispatched

  4. #4
    Membre confirmé
    Inscrit en
    Avril 2011
    Messages
    104
    Détails du profil
    Informations forums :
    Inscription : Avril 2011
    Messages : 104
    Par défaut
    ouh ptete que cela vous aidera plus en fait :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    05-23 10:35:38.286: ERROR/AndroidRuntime(220): Uncaught handler: thread main exiting due to uncaught exception
    05-23 10:35:38.316: ERROR/AndroidRuntime(220): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aviy.memory/com.aviy.memory.Menutest}: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2401)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.ActivityThread.access$2100(ActivityThread.java:116)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.os.Handler.dispatchMessage(Handler.java:99)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.os.Looper.loop(Looper.java:123)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.ActivityThread.main(ActivityThread.java:4203)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at java.lang.reflect.Method.invokeNative(Native Method)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at java.lang.reflect.Method.invoke(Method.java:521)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at dalvik.system.NativeStart.main(Native Method)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.createView(LayoutInflater.java:512)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:620)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:313)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.Activity.setContentView(Activity.java:1620)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at com.aviy.memory.Menutest.onCreate(Menutest.java:55)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2364)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     ... 11 more
    05-23 10:35:38.316: ERROR/AndroidRuntime(220): Caused by: java.lang.reflect.InvocationTargetException
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.widget.Button.<init>(Button.java:65)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at java.lang.reflect.Constructor.constructNative(Native Method)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.createView(LayoutInflater.java:499)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     ... 23 more
    05-23 10:35:38.316: ERROR/AndroidRuntime(220): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:439)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:322)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:688)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.content.res.Resources.loadDrawable(Resources.java:1710)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.View.<init>(View.java:1846)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.widget.TextView.<init>(TextView.java:326)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.widget.Button.<init>(Button.java:69)
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     ... 27 more

  5. #5
    Expert confirmé

    Avatar de Feanorin
    Profil pro
    Inscrit en
    Avril 2004
    Messages
    4 589
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2004
    Messages : 4 589
    Par défaut
    Bonjour,
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    05-23 10:35:38.316: ERROR/AndroidRuntime(220): Caused by: android.view.InflateException: Binary XML file line #6: Error inflating class java.lang.reflect.Constructor
    05-23 10:35:38.316: ERROR/AndroidRuntime(220):     at android.view.LayoutInflater.createView(LayoutInflater.java:512)
    Tu as un souci dans le onCreate de ton MenuTest

    Est ce que le fichier layout.typejeu.xml existe bien ?

  6. #6
    Membre confirmé
    Inscrit en
    Avril 2011
    Messages
    104
    Détails du profil
    Informations forums :
    Inscription : Avril 2011
    Messages : 104
    Par défaut
    Oui il existe et fonctionne. Quand je demande au menu test d’être affiché en premier je n'ai aucun problème.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 8
    Dernier message: 06/03/2015, 18h15
  2. JAR problème avec le MANIFEST.MF
    Par Sankasssss dans le forum Eclipse Java
    Réponses: 0
    Dernier message: 10/07/2008, 20h22
  3. problème avec manifest
    Par kakrocq dans le forum VC++ .NET
    Réponses: 1
    Dernier message: 06/09/2007, 13h21
  4. problèmes avec manifeste xp
    Par butch dans le forum Delphi
    Réponses: 1
    Dernier message: 15/03/2007, 11h06
  5. Problème avec la mémoire virtuelle
    Par Anonymous dans le forum CORBA
    Réponses: 13
    Dernier message: 16/04/2002, 16h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo