Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am new to android and I am trying to run this app on android emulator but it shows "the app has stopped unexpectedly.please try again":

Java
package your.packabge.namespace;

import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.ui.activity.SimpleBaseGameActivity;


public class AndEngineTutorialActivity extends SimpleBaseGameActivity
{

    private Camera           camera;
    private static final int CAMERA_WIDTH  = 720;
    private static final int CAMERA_HEIGHT = 480;


    @Override
    public EngineOptions onCreateEngineOptions()
    {
        camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
        EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
                new FillResolutionPolicy(), camera);
        return engineOptions;
    }


    @Override
    protected void onCreateResources()
    {

    }


    @Override
    protected Scene onCreateScene()
    {
        Scene scene = new Scene();
        scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
        return scene;
    }
}

xml code is:

HTML
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android">
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <textview>
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />

    </textview>
</linearlayout>


what is the reason? it is a very simple code! i tried on android 2.2 and 4.3.
thank you
Posted
Updated 1-Jul-15 21:35pm
v2
Comments
Sudhakar Shinde 2-Jul-15 3:34am    
Which IDE you are using for android development? Can you please provide error details from log console in the IDE you are using?
Member 11807654 2-Jul-15 3:42am    
i used eclipse indigo.here is the logcat:
07-02 07:40:50.746: DEBUG/AndroidRuntime(304): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
07-02 07:40:50.746: DEBUG/AndroidRuntime(304): CheckJNI is ON
07-02 07:40:50.855: DEBUG/AndroidRuntime(304): --- registering native functions ---
07-02 07:40:51.305: DEBUG/AndroidRuntime(304): Shutting down VM
07-02 07:40:51.305: DEBUG/dalvikvm(304): Debugger has detached; object registry had 1 entries
07-02 07:40:51.335: INFO/dalvikvm(304): JNI: AttachCurrentThread (from ???.???)
07-02 07:40:51.335: INFO/AndroidRuntime(304): NOTE: attach of thread 'Binder Thread #3' failed
07-02 07:40:51.665: DEBUG/AndroidRuntime(312): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
07-02 07:40:51.665: DEBUG/AndroidRuntime(312): CheckJNI is ON
07-02 07:40:51.775: DEBUG/AndroidRuntime(312): --- registering native functions ---
07-02 07:40:52.224: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=your.packabge.namespace/.AndEngineTutorialActivity }
07-02 07:40:52.265: INFO/ActivityManager(59): Start proc your.packabge.namespace for activity your.packabge.namespace/.AndEngineTutorialActivity: pid=318 uid=10058 gids={}
07-02 07:40:52.295: DEBUG/AndroidRuntime(312): Shutting down VM
07-02 07:40:52.295: DEBUG/dalvikvm(312): Debugger has detached; object registry had 1 entries
07-02 07:40:52.335: INFO/AndroidRuntime(312): NOTE: attach of thread 'Binder Thread #3' failed
07-02 07:40:52.735: INFO/ARMAssembler(59): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x3693d8:0x3694e4] in 343409 ns
07-02 07:40:52.795: DEBUG/AndEngine(318): AndEngineTutorialActivity.onCreate @(Thread: 'main')
07-02 07:40:52.925: INFO/dalvikvm(318): Could not find method android.opengl.GLES20.glVertexAttribPointer, referenced from method org.andengine.opengl.vbo.attribute.VertexBufferObjectAttribute.glVertexAttribPointer
07-02 07:40:52.925: WARN/dalvikvm(318): VFY: unable to resolve static method 211: Landroid/opengl/GLES20;.glVertexAttribPointer (IIIZII)V
07-02 07:40:52.925: DEBUG/dalvikvm(318): VFY: replacing opcode 0x77 at 0x000b
07-02 07:40:52.935: DEBUG/dalvikvm(318): VFY: dead code 0x000e-000e in Lorg/andengine/opengl/vbo/attribute/VertexBufferObjectAttribute;.glVertexAttribPointer (I)V
07-02 07:40:52.949: DEBUG/dalvikvm(318): Trying to load lib /data/data/your.packabge.namespace/lib/libandengine.so 0x44edeb30
07-02 07:40:52.955: DEBUG/dalvikvm(318): Added shared lib /data/data/your.packabge.namespace/lib/libandengine.so 0x44edeb30
07-02 07:40:52.955: DEBUG/dalvikvm(318): No JNI_OnLoad found in /data/data/your.packabge.namespace/lib/libandengine.so 0x44edeb30, skipping init
07-02 07:40:53.005: DEBUG/dalvikvm(318): GC_EXTERNAL_ALLOC freed 1171 objects / 85848 bytes in 48ms
07-02 07:40:53.015: INFO/WindowManager(59): Setting rotation to 1, animFlags=1
07-02 07:40:53.025: INFO/ActivityManager(59): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=4}
07-02 07:40:53.084: INFO/UsageStats(59): Unexpected resume of your.packabge.namespace while already resumed in your.packabge.namespace
07-02 07:40:53.134: DEBUG/AndEngine(318): AndEngineTutorialActivity.onResume @(Thread: 'main')
07-02 07:40:53.174: DEBUG/AndEngine(318): AndEngineTutorialActivity.onPause @(Thread: 'main')
07-02 07:40:53.174: DEBUG/AndEngine(318): AndEngineTutorialActivity.onDestroy @(Thread: 'main')
07-02 07:40:53.204: DEBUG/AndEngine(318): UpdateThread interrupted. Don't worry - this EngineDestroyedException is most likely expected!
07-02 07:40:53.204: DEBUG/AndEngine(318): org.andengine.engine.Engine$EngineDestroyedException
07-02 07:40:53.204: DEBUG/AndEngine(318): at org.andengine.engine.Engine.throwOnDestroyed(Engine.java:574)
07-02 07:40:53.204: DEBUG/AndEngine(318): at org.andengine.engine.Eng
Richard MacCutchan 2-Jul-15 3:40am    
That does not look like a complete application. Where is the main activity that starts it all?

I suggest you post this question on the site where you found the tutorial. It obviously relies on some third party library.
Member 11807654 2-Jul-15 3:48am    
thanks a lot.i will do that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900