2015-02-07 1 views
0

У меня возникла огромная проблема с попыткой добавить объявления в мое приложение в libgdx. Я искал решение повсюду, но мне не повезло. Я не знаю, был ли мой эмулятор или мое приложение. Я по-прежнему новичок в кодировании, поэтому я, возможно, сделал какую-то глупую ошибку! Заранее спасибо!Не удалось добавить объявления в мое приложение

Edit: изменил мой эмулятор genymotion и я получаю другую ошибку сейчас, Logcat является:

02-08 01:55:50.994: D/dalvikvm(1332): GC_CONCURRENT freed 369K, 5% free 8800K/9200K, paused 2ms+0ms, total 8ms 
02-08 01:55:51.002: I/dalvikvm(1332): Could not find method android.webkit.WebView.evaluateJavascript, referenced from method com.google.android.gms.internal.gu.evaluateJavascript 
02-08 01:55:51.002: W/dalvikvm(1332): VFY: unable to resolve virtual method 1096: Landroid/webkit/WebView;.evaluateJavascript (Ljava/lang/String;Landroid/webkit/ValueCallback;)V 
02-08 01:55:51.002: D/dalvikvm(1332): VFY: replacing opcode 0x6f at 0x0016 
02-08 01:55:51.174: I/dalvikvm(1332): Failed resolving Lcom/simplegames/TweenAccessors/SpriteAccessor; interface 252 'Laurelienribon/tweenengine/TweenAccessor;' 
02-08 01:55:51.174: W/dalvikvm(1332): Link of class 'Lcom/simplegames/TweenAccessors/SpriteAccessor;' failed 
02-08 01:55:51.174: E/dalvikvm(1332): Could not find class 'com.simplegames.TweenAccessors.SpriteAccessor', referenced from method com.simplegames.screens.SplashScreen.setupTween 
02-08 01:55:51.174: W/dalvikvm(1332): VFY: unable to resolve new-instance 4737 (Lcom/simplegames/TweenAccessors/SpriteAccessor;) in Lcom/simplegames/screens/SplashScreen; 
02-08 01:55:51.174: D/dalvikvm(1332): VFY: replacing opcode 0x22 at 0x0003 
02-08 01:55:51.174: I/dalvikvm(1332): Could not find method aurelienribon.tweenengine.TweenManager.update, referenced from method com.simplegames.screens.SplashScreen.render 
02-08 01:55:51.174: W/dalvikvm(1332): VFY: unable to resolve virtual method 1215: Laurelienribon/tweenengine/TweenManager;.update (F)V 
02-08 01:55:51.174: D/dalvikvm(1332): VFY: replacing opcode 0x6e at 0x0004 
02-08 01:55:51.174: I/dalvikvm(1332): Failed resolving Lcom/simplegames/TweenAccessors/SpriteAccessor; interface 252 'Laurelienribon/tweenengine/TweenAccessor;' 
02-08 01:55:51.174: W/dalvikvm(1332): Link of class 'Lcom/simplegames/TweenAccessors/SpriteAccessor;' failed 
02-08 01:55:51.174: D/dalvikvm(1332): DexOpt: unable to opt direct call 0x8ef0 at 0x05 in Lcom/simplegames/screens/SplashScreen;.setupTween 
02-08 01:55:51.174: D/dalvikvm(1332): DexOpt: unable to opt direct call 0x04be at 0x0d in Lcom/simplegames/screens/SplashScreen;.setupTween 
02-08 01:55:51.174: I/dalvikvm(1332): Failed resolving Lcom/simplegames/screens/SplashScreen$1; interface 253 'Laurelienribon/tweenengine/TweenCallback;' 
02-08 01:55:51.174: W/dalvikvm(1332): Link of class 'Lcom/simplegames/screens/SplashScreen$1;' failed 
02-08 01:55:51.174: D/dalvikvm(1332): DexOpt: unable to opt direct call 0x8fa6 at 0x14 in Lcom/simplegames/screens/SplashScreen;.setupTween 
02-08 01:55:51.174: I/dalvikvm(1332): DexOpt: unable to optimize static field ref 0x0061 at 0x26 in Lcom/simplegames/screens/SplashScreen;.setupTween 
02-08 01:55:51.178: D/dalvikvm(1332): GC_CONCURRENT freed 327K, 4% free 8861K/9216K, paused 2ms+0ms, total 5ms 
02-08 01:55:51.182: W/dalvikvm(1332): threadid=10: thread exiting with uncaught exception (group=0xa6190908) 
02-08 01:55:51.182: E/AndroidRuntime(1332): FATAL EXCEPTION: GLThread 107 
02-08 01:55:51.182: E/AndroidRuntime(1332): java.lang.NoClassDefFoundError: com.simplegames.TweenAccessors.SpriteAccessor 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at com.simplegames.screens.SplashScreen.setupTween(SplashScreen.java:47) 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at com.simplegames.screens.SplashScreen.show(SplashScreen.java:42) 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at com.badlogic.gdx.Game.setScreen(Game.java:61) 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at com.simplegames.dinobird.DBGame.create(DBGame.java:12) 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:241) 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1505) 
02-08 01:55:51.182: E/AndroidRuntime(1332):  at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240) 
02-08 01:55:51.250: I/AndroidInput(1332): sensor listener tear down 
02-08 01:55:51.250: I/AndroidGraphics(1332): Managed meshes/app: { } 
02-08 01:55:51.250: I/AndroidGraphics(1332): Managed textures/app: { } 
02-08 01:55:51.250: I/AndroidGraphics(1332): Managed cubemap/app: { } 
02-08 01:55:51.250: I/AndroidGraphics(1332): Managed shaders/app: { } 
02-08 01:55:51.250: I/AndroidGraphics(1332): Managed buffers/app: { } 

И мой Manifest:

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.simplegames.dinobird.android" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="21" /> 
    <uses-permission android:name="android.permission.INTERNET"/> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/GdxTheme" > 
     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> 
     <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/> 
     <activity 
      android:name="com.simplegames.dinobird.android.AndroidLauncher" 
      android:label="@string/app_name" 
      android:screenOrientation="portrait" 
      android:configChanges="keyboard|keyboardHidden|orientation|screenSize"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 
    </application> 

</manifest> 

И, наконец, моя AndroidLauncher:

package com.simplegames.dinobird.android; 

import android.app.Dialog; 
import android.content.Intent; 
import android.graphics.Color; 
import android.net.Uri; 
import android.os.Bundle; 
import android.view.View; 
import android.view.View.OnClickListener; 
import android.view.Window; 
import android.view.WindowManager; 
import android.widget.Button; 
import android.widget.LinearLayout; 
import android.widget.RelativeLayout; 
import android.widget.RelativeLayout.LayoutParams; 

import com.badlogic.gdx.backends.android.AndroidApplication; 
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; 
import com.google.android.gms.ads.AdRequest; 
import com.google.android.gms.ads.AdSize; 
import com.google.android.gms.ads.AdView; 
import com.simplegames.dinobird.DBGame; 

public class AndroidLauncher extends AndroidApplication { 

    private static final String GOOGLE_PLAY_URL = "https://play.google.com/store/apps/developer?id=SimpleGames1.0"; 
     protected AdView adView; 
     protected View gameView; 

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

     AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration(); 
     cfg.useAccelerometer = false; 
     cfg.useCompass = false; 

     // Do the stuff that initialize() would do for you 
     requestWindowFeature(Window.FEATURE_NO_TITLE); 
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
     getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); 

     RelativeLayout layout = new RelativeLayout(this); 
     RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT); 
     layout.setLayoutParams(params); 

     AdView admobView = createAdView(); 
     layout.addView(admobView); 
     View gameView = createGameView(cfg); 
     layout.addView(gameView); 

     setContentView(layout); 
     startAdvertising(admobView); 
     } 

     private AdView createAdView() { 
     adView = new AdView(this); 
     adView.setAdSize(AdSize.SMART_BANNER); 
     adView.setAdUnitId("@sting/banner_ad_unit_id"); 
     adView.setId(12345); // this is an arbitrary id, allows for relative positioning in createGameView() 
     RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 
     params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); 
     params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); 
     adView.setLayoutParams(params); 
     adView.setBackgroundColor(Color.BLACK); 
     return adView; 
     } 

     private View createGameView(AndroidApplicationConfiguration cfg) { 
     gameView = initializeForView(new DBGame(), cfg); 
     RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); 
     params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); 
     params.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE); 
     params.addRule(RelativeLayout.BELOW, adView.getId()); 
     gameView.setLayoutParams(params); 
     return gameView; 
     } 

     private void startAdvertising(AdView adView) { 
     AdRequest adRequest = new AdRequest.Builder().build(); 
     adView.loadAd(adRequest); 
     } 

     @Override 
     public void onResume() { 
     super.onResume(); 
     if (adView != null) adView.resume(); 
     } 

     @Override 
     public void onPause() { 
     if (adView != null) adView.pause(); 
     super.onPause(); 
     } 

     @Override 
     public void onDestroy() { 
     if (adView != null) adView.destroy(); 
     super.onDestroy(); 
     } 

     @Override 
     public void onBackPressed() { 
     final Dialog dialog = new Dialog(this); 
     dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 

     LinearLayout ll = new LinearLayout(this); 
     ll.setOrientation(LinearLayout.VERTICAL); 

     Button b1 = new Button(this); 
     b1.setText("Quit"); 
     b1.setOnClickListener(new OnClickListener() { 
      public void onClick(View v) { 
      finish(); 
      } 
     }); 
     ll.addView(b1); 

     Button b2 = new Button(this); 
     b2.setText("TheInvader360"); 
     b2.setOnClickListener(new OnClickListener() { 
      public void onClick(View v) { 
      startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(GOOGLE_PLAY_URL))); 
      dialog.dismiss(); 
      } 
     }); 
     ll.addView(b2); 

     dialog.setContentView(ll); 
     dialog.show(); 
     } 
    } 

ответ

0

Просто фиксированы, щелкнув правой кнопкой мыши мой андроид проект, зависший над андроид инструментов, и нажав свойства затруднительное проекта.

0

Я думаю, что проблема здесь: «com.simplegames.TweenAccess ors.SpriteAccessor " Попробуйте изменить расположение файла.

Lok здесь более подробная информация: NoClassDefFoundError - Eclipse and Android

+0

Вот что я не понял, он говорил мне, что не может найти «com.simplegames.TweenAccessors.SpriteAccessor», но он был в том же месте, что и он. Спасибо за помощь! –

+0

Я, должно быть, случайно что-то испортил в пути сборки, пытаясь исправить еще одну ошибку. –

+0

По-прежнему с трудом пытаюсь найти объявления, чтобы показать, хотя –