2013-02-06 102 views
0

我看過很多類似的問題,這個貼在SO上但似乎沒有回答我的問題。很簡單,每次我嘗試在仿真器上運行我的應用程序時,它都會退回到主菜單並顯示一個對話框,指出「Unfortunatley,Scribble Runner已停止」。這是我的BaseActivity類和我的AndroidManifest.xml文件。不幸的是<appname>已停止

BaseActivity:

import java.io.IOException; 
import java.io.InputStream; 

import org.andengine.engine.camera.Camera; 
import org.andengine.engine.options.EngineOptions; 
import org.andengine.engine.options.ScreenOrientation; 
import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy; 
import org.andengine.entity.scene.Scene; 
import org.andengine.entity.sprite.Sprite; 
import org.andengine.entity.util.FPSLogger; 
import org.andengine.opengl.font.Font; 
import org.andengine.opengl.font.FontFactory; 
import org.andengine.opengl.texture.ITexture; 
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas; 
import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory; 
import org.andengine.opengl.texture.bitmap.BitmapTexture; 
import org.andengine.opengl.texture.region.ITextureRegion; 
import org.andengine.opengl.texture.region.TextureRegion; 
import org.andengine.opengl.texture.region.TextureRegionFactory; 
import org.andengine.ui.activity.SimpleBaseGameActivity; 
import org.andengine.util.adt.io.in.IInputStreamOpener; 
import org.andengine.util.debug.Debug; 

import android.util.Log; 


public class BaseActivity extends SimpleBaseGameActivity { 

    //CONSTANTS AND FIELDS 
    public static int CAMERA_WIDTH = 720; 
    public static int CAMERA_HEIGHT = 480; 

    public Font mFont; 
    public Camera mCamera; 
    private ITextureRegion mBackgroundTextureRegion, mEnemyTextureRegion; 
    private BitmapTextureAtlas mAutoParallaxBackgroundTexture; 
    private TextureRegion mParallaxLayerFront; 
    private TextureRegion mParallaxLayerMid; 
    private TextureRegion mParallaxLayerBack; 


    public Scene mCurrentScene; 
    public static BaseActivity instance; 


    @Override 
    public EngineOptions onCreateEngineOptions() { 
     instance = this; 
     mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT); 
     System.out.println("Engine Created"); 
     return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new 
       RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera); 

    } 


    @Override 
    protected void onCreateResources() { 

     BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/"); 
     try{ 
     this.mAutoParallaxBackgroundTexture = new BitmapTextureAtlas(this.getTextureManager(), 1024, 1024); 
     this.mParallaxLayerFront = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mAutoParallaxBackgroundTexture, this, "parallax_background_layer_front.png", 0, 0); 
     this.mParallaxLayerBack = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mAutoParallaxBackgroundTexture, this, "parallax_background_layer_back.png", 0, 188); 
     this.mParallaxLayerMid = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mAutoParallaxBackgroundTexture, this, "parallax_background_layer_mid.png", 0, 669); 
     this.mAutoParallaxBackgroundTexture.load(); 
     System.out.println("Resources Created"); 
     }catch(Exception e){ 
      Debug.e(e); 
     } 
    } 

    @Override 
    protected Scene onCreateScene() { 
     mEngine.registerUpdateHandler(new FPSLogger()); 
     mCurrentScene = new Scene(); 
     Sprite backgroundSprite1 = new Sprite(0, 0, this.mParallaxLayerBack, getVertexBufferObjectManager()); 
     Sprite backgroundSprite2 = new Sprite(0, 0, this.mParallaxLayerMid, getVertexBufferObjectManager()); 
     Sprite backgroundSprite3 = new Sprite(0, 0, this.mParallaxLayerFront, getVertexBufferObjectManager()); 
     mCurrentScene.attachChild(backgroundSprite1); 
     mCurrentScene.attachChild(backgroundSprite2); 
     mCurrentScene.attachChild(backgroundSprite3); 
     System.out.println("Scene Created"); 
     return mCurrentScene; 
    } 

    public static BaseActivity getSharedInstance(){ 
     return instance; 
    } 

    //change the current main scene 
    public void setCurrentScene(Scene scene){ 
     mCurrentScene = scene; 
     getEngine().setScene(mCurrentScene); 
    } 

} 

清單:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.provisionalsolutions.scribblerunner" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="8" 
    android:targetSdkVersion="17" /> 

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.provisionalsolutions.scribblerunner.BaseActivity" 
     android:label="@string/app_name" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 
      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

這裏是logcat的:

02-06 13:41:21.664: W/ActivityManager(275): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found 
02-06 13:41:21.674: W/Trace(589): Unexpected value from nativeGetEnabledTags: 0 
02-06 13:41:21.697: E/ActivityThread(589): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]f2458 that was originally bound here 
02-06 13:41:21.697: E/ActivityThread(589): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]f2458 that was originally bound here 
02-06 13:41:21.697: E/ActivityThread(589): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
02-06 13:41:21.697: E/ActivityThread(589): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
02-06 13:41:21.697: E/ActivityThread(589): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
02-06 13:41:21.697: E/ActivityThread(589): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
02-06 13:41:21.697: E/ActivityThread(589): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
02-06 13:41:21.697: E/ActivityThread(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
02-06 13:41:21.697: E/ActivityThread(589): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
02-06 13:41:21.697: E/ActivityThread(589): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
02-06 13:41:21.697: E/ActivityThread(589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
02-06 13:41:21.697: E/ActivityThread(589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
02-06 13:41:21.697: E/ActivityThread(589): at java.lang.Thread.run(Thread.java:856) 
02-06 13:41:21.714: E/StrictMode(589): null 
02-06 13:41:21.714: E/StrictMode(589): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]f2458 that was originally bound here 
02-06 13:41:21.714: E/StrictMode(589): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
02-06 13:41:21.714: E/StrictMode(589): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
02-06 13:41:21.714: E/StrictMode(589): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
02-06 13:41:21.714: E/StrictMode(589): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
02-06 13:41:21.714: E/StrictMode(589): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.emailcommon.service.AccountServiceProxy.getDeviceId(AccountServiceProxy.java:116) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.exchange.ExchangeService.getDeviceId(ExchangeService.java:1249) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1856) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
02-06 13:41:21.714: E/StrictMode(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
02-06 13:41:21.714: E/StrictMode(589): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
02-06 13:41:21.714: E/StrictMode(589): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
02-06 13:41:21.714: E/StrictMode(589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
02-06 13:41:21.714: E/StrictMode(589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
02-06 13:41:21.714: E/StrictMode(589): at java.lang.Thread.run(Thread.java:856) 
02-06 13:41:21.714: W/ActivityManager(275): Unbind failed: could not find connection for [email protected] 
02-06 13:41:21.724: E/ActivityThread(589): Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]19e88 that was originally bound here 
02-06 13:41:21.724: E/ActivityThread(589): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]19e88 that was originally bound here 
02-06 13:41:21.724: E/ActivityThread(589): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
02-06 13:41:21.724: E/ActivityThread(589): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
02-06 13:41:21.724: E/ActivityThread(589): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
02-06 13:41:21.724: E/ActivityThread(589): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
02-06 13:41:21.724: E/ActivityThread(589): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
02-06 13:41:21.724: E/ActivityThread(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
02-06 13:41:21.724: E/ActivityThread(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
02-06 13:41:21.724: E/ActivityThread(589): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 
02-06 13:41:21.724: E/ActivityThread(589): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 
02-06 13:41:21.724: E/ActivityThread(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
02-06 13:41:21.724: E/ActivityThread(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
02-06 13:41:21.724: E/ActivityThread(589): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
02-06 13:41:21.724: E/ActivityThread(589): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
02-06 13:41:21.724: E/ActivityThread(589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
02-06 13:41:21.724: E/ActivityThread(589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
02-06 13:41:21.724: E/ActivityThread(589): at java.lang.Thread.run(Thread.java:856) 
02-06 13:41:21.734: E/StrictMode(589): null 
02-06 13:41:21.734: E/StrictMode(589): android.app.ServiceConnectionLeaked: Service com.android.exchange.ExchangeService has leaked ServiceConnection [email protected]19e88 that was originally bound here 
02-06 13:41:21.734: E/StrictMode(589): at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969) 
02-06 13:41:21.734: E/StrictMode(589): at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863) 
02-06 13:41:21.734: E/StrictMode(589): at android.app.ContextImpl.bindService(ContextImpl.java:1418) 
02-06 13:41:21.734: E/StrictMode(589): at android.app.ContextImpl.bindService(ContextImpl.java:1407) 
02-06 13:41:21.734: E/StrictMode(589): at android.content.ContextWrapper.bindService(ContextWrapper.java:473) 
02-06 13:41:21.734: E/StrictMode(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157) 
02-06 13:41:21.734: E/StrictMode(589): at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145) 
02-06 13:41:21.734: E/StrictMode(589): at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191) 
02-06 13:41:21.734: E/StrictMode(589): at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850) 
02-06 13:41:21.734: E/StrictMode(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551) 
02-06 13:41:21.734: E/StrictMode(589): at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549) 
02-06 13:41:21.734: E/StrictMode(589): at android.os.AsyncTask$2.call(AsyncTask.java:287) 
02-06 13:41:21.734: E/StrictMode(589): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 
02-06 13:41:21.734: E/StrictMode(589): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 
02-06 13:41:21.734: E/StrictMode(589): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 
02-06 13:41:21.734: E/StrictMode(589): at java.lang.Thread.run(Thread.java:856) 

下面是該堆棧跟蹤的另一部分ERR ORS:

02-06 13:45:37.300: E/AndroidRuntime(815): FATAL EXCEPTION: main 
02-06 13:45:37.300: E/AndroidRuntime(815): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.provisionalsolutions.scribblerunner/com.provisionalsolutions.scribblerunner.BaseActivity}: java.lang.ClassNotFoundException: Didn't find class "com.provisionalsolutions.scribblerunner.BaseActivity" on path: /data/app/com.provisionalsolutions.scribblerunner-2.apk 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.ActivityThread.access$600(ActivityThread.java:141) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.os.Handler.dispatchMessage(Handler.java:99) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.os.Looper.loop(Looper.java:137) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.ActivityThread.main(ActivityThread.java:5039) 
02-06 13:45:37.300: E/AndroidRuntime(815): at java.lang.reflect.Method.invokeNative(Native Method) 
02-06 13:45:37.300: E/AndroidRuntime(815): at java.lang.reflect.Method.invoke(Method.java:511) 
02-06 13:45:37.300: E/AndroidRuntime(815): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
02-06 13:45:37.300: E/AndroidRuntime(815): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 
02-06 13:45:37.300: E/AndroidRuntime(815): at dalvik.system.NativeStart.main(Native Method) 
02-06 13:45:37.300: E/AndroidRuntime(815): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.provisionalsolutions.scribblerunner.BaseActivity" on path: /data/app/com.provisionalsolutions.scribblerunner-2.apk 
02-06 13:45:37.300: E/AndroidRuntime(815): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65) 
02-06 13:45:37.300: E/AndroidRuntime(815): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 
02-06 13:45:37.300: E/AndroidRuntime(815): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.Instrumentation.newActivity(Instrumentation.java:1054) 
02-06 13:45:37.300: E/AndroidRuntime(815): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097) 
02-06 13:45:37.300: E/AndroidRuntime(815): ... 11 more 
+1

我可能會遺漏一些東西,但是我不能以任何方式看到顯示的代碼與顯示的堆棧跟蹤有關。 –

+0

我發佈了顯示錯誤的堆棧跟蹤部分......其他大部分跟蹤都是垃圾,但如果需要,我可以發佈它們。 –

+0

您是否有任何涉及您顯示的代碼的堆棧跟蹤(即,包含對'BaseActivity'中至少一個函數的引用?) –

回答

0
02-06 13:41:21.664: W/ActivityManager(275): Unable to start service Intent { act=com.android.email.ACCOUNT_INTENT } U=0: not found 
02-06 13:41:21.674: W/Trace(589): Unexpected value from nativeGetEnabledTags: 0 

這告訴你,你有意向的問題......在你的代碼的發佈是無意的,所以我認爲這個問題屬於程序^^

的另一部分
+0

我已經發布了堆棧跟蹤中的更多錯誤,我認爲它們更相關...... –

+0

新的錯誤日誌告訴您,您的程序在您給程序的路徑中不可用...或者是發生小費錯誤,或類是其他任何地方,tahn它應該是。'{com.provisionalsolutions.scribblerunner/com.provisionalsolutions.scribblerunner.BaseActivity}:java.lang.ClassNotFoundException:沒有找到類'顯示這個 – Ekonion

+0

你有什麼想法如何解決這個問題?我不知道第一個問題是如何引起的 –