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 :

Installer AdMob sur mon application


Sujet :

Android

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    504
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 504
    Par défaut Installer AdMob sur mon application
    bonsoir,

    j'essaye d'installer admob dans mon application mais j'ai les erreurs suivantes :
    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
    10-29 18:54:17.564: I/dalvikvm(640): Failed resolving Lcom/source/frame/implementation/AndroidGame; interface 439 'Lcom/google/ads/AdListener;'
    10-29 18:54:17.584: W/dalvikvm(640): Link of class 'Lcom/source/frame/implementation/AndroidGame;' failed
    10-29 18:54:17.584: W/dalvikvm(640): Unable to resolve superclass of Lcom/source/yellowvalleygame/yellowValleyJeu; (462)
    10-29 18:54:17.584: W/dalvikvm(640): Link of class 'Lcom/source/yellowvalleygame/yellowValleyJeu;' failed
    10-29 18:54:17.677: D/AndroidRuntime(640): Shutting down VM
    10-29 18:54:17.677: W/dalvikvm(640): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
    10-29 18:54:17.864: E/AndroidRuntime(640): FATAL EXCEPTION: main
    10-29 18:54:17.864: E/AndroidRuntime(640): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.source.yellowvalleygame/com.source.yellowvalleygame.yellowValleyJeu}: java.lang.ClassNotFoundException: com.source.yellowvalleygame.yellowValleyJeu
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.ActivityThread.access$600(ActivityThread.java:130)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.os.Handler.dispatchMessage(Handler.java:99)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.os.Looper.loop(Looper.java:137)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.ActivityThread.main(ActivityThread.java:4745)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at java.lang.reflect.Method.invokeNative(Native Method)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at java.lang.reflect.Method.invoke(Method.java:511)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at dalvik.system.NativeStart.main(Native Method)
    10-29 18:54:17.864: E/AndroidRuntime(640): Caused by: java.lang.ClassNotFoundException: com.source.yellowvalleygame.yellowValleyJeu
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
    10-29 18:54:17.864: E/AndroidRuntime(640): 	... 11 more
    j'ai suivi un tutoriel pour installer abmob car j'utilise un surfaceWiew
    http://rx-games.com/admob-adverts-on...-xml-tutorial/
    voici le code source principale :
    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
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    package com.source.frame.implementation;
    import com.source.frame.*;
    import com.source.yellowvalleygame.yellowValleyJeu;
     
    import android.app.Activity;
    import android.content.Context;
    import android.content.Intent;
    import android.content.res.Configuration;
    import android.graphics.Bitmap;
    import android.graphics.Bitmap.Config;
    import android.os.Bundle;
    import android.os.PowerManager;
    import android.os.PowerManager.WakeLock;
    import android.view.View;
    import android.view.Window;
    import android.view.WindowManager;
    import android.view.animation.AccelerateInterpolator;
    import android.view.animation.AlphaAnimation;
    import android.widget.RelativeLayout;
     
    import com.google.ads.*;
    import com.google.ads.AdRequest.ErrorCode;
     
     
     
     
    public abstract class AndroidGame extends Activity implements Game , AdListener {
        AndroidFastRenderView renderView;
        Graphics graphics;
        Audio audio;
        Input input;
        FileIO fileIO;
        Screen screen;
        WakeLock wakeLock;
        AdView _adv;
     
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
     
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            getWindow().setWindowAnimations(android.R.style.Animation_Toast);
     
            boolean isLandscape = getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
            int frameBufferWidth = isLandscape ? 800 : 480;
            int frameBufferHeight = isLandscape ? 480 : 800;
            Bitmap frameBuffer = Bitmap.createBitmap(frameBufferWidth,
                    frameBufferHeight, Config.RGB_565);
     
            @SuppressWarnings("deprecation")
    		float scaleX = (float) frameBufferWidth
                    / getWindowManager().getDefaultDisplay().getWidth();
            @SuppressWarnings("deprecation")
    		float scaleY = (float) frameBufferHeight
                    / getWindowManager().getDefaultDisplay().getHeight();
     
            renderView = new AndroidFastRenderView(this, frameBuffer);
            graphics = new AndroidGraphics(getAssets(), frameBuffer);
            fileIO = new AndroidFileIO(getAssets());
            audio = new AndroidAudio(this);
            input = new AndroidInput(this, renderView, scaleX, scaleY);
            screen = new yellowValleyJeu().getStartScreen();
     
     
            PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
            wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, "GLGame");
     
     
            Intent i = getIntent();
            Bundle levelBundle = i.getExtras();
            StartVersusPanel(levelBundle);
     
            ShowAd();
     
     
     
        }
     
        @Override
    	public void onDismissScreen(Ad arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void onLeaveApplication(Ad arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void onPresentScreen(Ad arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
    	@Override
    	public void onReceiveAd(Ad arg0) {
    		// TODO Auto-generated method stub
     
    	}
     
     
     
        public void onNewIntent(Intent newIntent)
        {
        super.onNewIntent(newIntent);
     
        setIntent(newIntent);
        Intent nextStageIntent = getIntent();
        Bundle levelBundle = nextStageIntent.getExtras();
     
        StartVersusPanel(levelBundle);
        }
     
     
     
        public void StartVersusPanel(Bundle levelBundle)
        {
        /* Admob advert on Android done programmatically! */
        _adv = new AdView(this, AdSize.BANNER,"axxxxxxxxxxxxxx");
     
     
     
     
        RelativeLayout rl = new RelativeLayout(this);
        rl.addView(renderView);
        rl.addView(_adv);
     
        setContentView(rl);
     
        }
     
     
        private void ShowAd()
        {
        _adv.setVisibility(View.VISIBLE);
        // The ad will fade in over 0.4 seconds.
        AlphaAnimation animation = new AlphaAnimation( 0.0f, 1.0f );
        animation.setDuration( 400 );
        animation.setFillAfter( true );
        animation.setInterpolator( new AccelerateInterpolator() );
        _adv.startAnimation( animation );
        }
     
     
     
    	@Override
        public void onResume() {
            super.onResume();
            wakeLock.acquire();
            screen.resume();
            renderView.resume();
        }
     
        @Override
        public void onPause() {
            super.onPause();
            wakeLock.release();
            renderView.pause();
            screen.pause();
     
            if (isFinishing())
                screen.dispose();
        }
     
        @Override
        public Input getInput() {
            return input;
        }
     
        @Override
        public FileIO getFileIO() {
            return fileIO;
        }
     
        @Override
        public Graphics getGraphics() {
            return graphics;
        }
     
        @Override
        public Audio getAudio() {
            return audio;
        }
     
        @Override
        public void setScreen(Screen screen) {
            if (screen == null)
                throw new IllegalArgumentException("Screen must not be null");
     
            this.screen.pause();
            this.screen.dispose();
            screen.resume();
            screen.update(0);
            this.screen = screen;
        }
     
        public Screen getCurrentScreen() {
            return screen;
        }
    }
    le code de yellowvalley "le lancement du jeu"

    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
    package com.source.yellowvalleygame;
     
     
     
    import com.source.frame.Screen;
    import com.source.frame.implementation.AndroidGame;
     
    public class yellowValleyJeu extends AndroidGame{
     
     
    	public yellowValleyJeu(){}
     
    	public Screen getStartScreen(){
     
    		return new chargementEcran(this);
    	}
     
     
     
    }
    le manifest :
    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
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.source.yellowvalleygame"
        android:versionCode="1"
        android:versionName="1.0" >
     
        <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" />
     
        <application
            android:icon="@drawable/ic_launcher" android:debuggable="false"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
     
     
     
            <activity           
                android:name=".yellowValleyJeu"
                android:configChanges="keyboard|keyboardHidden|orientation"
                android:label="Yellow Valley" 
            	android:screenOrientation="landscape">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
     
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
     
     
             <activity android:name="com.google.ads.AdActivity"
    				android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
        </application>
    <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>  
        <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 
    </manifest>
    merci !

  2. #2
    Rédacteur
    Avatar de MrDuChnok
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2002
    Messages
    2 112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juin 2002
    Messages : 2 112
    Par défaut
    Salut,

    Tu as bien rajouter la librairie admod dans ton projet et dans ton classpath ?

    Sinon, cela fonctionnait quand tu n'avais pas essayer de mettre ta pub ?

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    504
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 504
    Par défaut
    salut,

    oui le programme fonctionne bien sans admob .
    et j'ai bien mis la librairie de admob dans l'ajout des librairies dans la propriété de mon projet.

  4. #4
    Membre expérimenté
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    117
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 38
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 117
    Par défaut
    Salut,
    Pour que celui-ci soit pris en charge par le "compilateur" android, il me semble qu'il faut que ton dossier de librairie :
    - soit à la racine de ton projet (au meme niveau que src)
    - qu'il s'apelle exactement libs

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    504
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 504
    Par défaut
    salut,

    merci pour vos réponses !

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

Discussions similaires

  1. Reprendre le flux de Google Earth sur mon application
    Par bip98 dans le forum API, COM et SDKs
    Réponses: 0
    Dernier message: 19/03/2008, 19h09
  2. Réponses: 2
    Dernier message: 07/01/2008, 11h46
  3. installer linux sur mon pc
    Par fxandrieu dans le forum Administration système
    Réponses: 3
    Dernier message: 19/12/2007, 12h44
  4. Installer windows sur mon disque dur externe
    Par anas.eh dans le forum Windows XP
    Réponses: 13
    Dernier message: 31/08/2007, 13h59
  5. Skin sur mon application
    Par Freud44 dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 28/08/2007, 15h50

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