hushaojie04 / libgdx

Automatically exported from code.google.com/p/libgdx
0 stars 0 forks source link

FORCELY CLOSE APPLICATION #772

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When we use a latest nighties .
libgdx-nightly-latest.zip
......
and My Android Sdk version:- mean testing version is 2.3
and Jdk 1.6.31 use
OS:- Window 7,64 bit

But why give a message forcely close?
I use whole instructions after that give this problem pls resolve it.
I send a code.............
///////////////////////////////////////

package com.phy;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.test.Test;

import android.os.Bundle;

public class Physics1Activity extends AndroidApplication{
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initialize(new Test(), false);     
    }
}
///////////////////////////
package com.test;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.math.Rectangle;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;

import com.badlogic.gdx.physics.box2d.Box2DDebugRenderer;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.PolygonShape;
import com.badlogic.gdx.physics.box2d.World;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;

public class Test implements ApplicationListener
{

    private int WIDTH=80;
    private int HEIGHT=60;
    //private Rectangle                       glViewport;

   World world ;    // Box2D world  
    Body b1;    
    //create a camera operation 

    //OrthographicCamera camera;
    //Box2DDebugRenderer renderer;

    @Override
    public void create()
    {
        //opengl operation here

        //camera = new OrthographicCamera(WIDTH, HEIGHT);            
        //camera.position.set(WIDTH / 2, HEIGHT / 2, 0);

        //glViewport = new Rectangle(0, 0, WIDTH, HEIGHT);

        //render
        // renderer=new Box2DDebugRenderer();
        // World with no gravity

        if(world==null)
          world = new World(new Vector2(0, -10.0f), true);
        world.setContinuousPhysics(true);

        BodyDef bodyDef = new BodyDef();
        bodyDef.type = BodyType.DynamicBody;
        bodyDef.position.x = WIDTH/2;
        bodyDef.position.y = HEIGHT/2;

        PolygonShape shapex=new PolygonShape();
        shapex.setAsBox(1, 1);

        FixtureDef fixtureDef = new FixtureDef();
        fixtureDef.shape = shapex;
        fixtureDef.density = 0.05f;
        fixtureDef.friction = 0.3f;

        /* Create the first body */
        b1 = world.createBody(bodyDef);
        b1.createFixture(fixtureDef);

        shapex.dispose();

    }

    @Override
    public void dispose() {
        // TODO Auto-generated method stub
        //renderer.dispose();
        //world.dispose();
        //renderer=null;
    //  world=null;
    }

    @Override
    public void pause() {
        // TODO Auto-generated method stub

    }

    @Override
    public void render() 
    {
        GL10 gl = Gdx.app.getGraphics().getGL10();
        //camera
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
         //gl.glViewport((int) glViewport.x, (int) glViewport.y,
           //      (int) glViewport.width, (int) glViewport.height);
        //camera.update();
        //camera.apply(gl);

        world.step(Gdx.graphics.getDeltaTime(), 3, 3);      
        System.out.println("b1 is at ("+b1.getPosition().x+","+b1.getPosition().y+")");

        // render the world using the debug renderer
        //renderer.render(world,camera.combined);
    }

    @Override
    public void resize(int arg0, int arg1) {
        // TODO Auto-generated method stub

    }

    @Override
    public void resume() {
        // TODO Auto-generated method stub

    }

}

Original issue reported on code.google.com by mkbluesk...@gmail.com on 30 Mar 2012 at 7:05

GoogleCodeExporter commented 9 years ago
This code in desktop version runing,
but in android why not?
Pls solve my problem....
Thanks

Original comment by mkbluesk...@gmail.com on 30 Mar 2012 at 7:06

GoogleCodeExporter commented 9 years ago
ERROR:-
////////////////////

03-31 00:38:11.337: W/dalvikvm(606): Exception Ljava/lang/UnsatisfiedLinkError; 
thrown while initializing Lcom/badlogic/gdx/backends/android/AndroidApplication;
03-31 00:38:11.337: W/dalvikvm(606): Class init failed in newInstance call 
(Lcom/phy/Physics1Activity;)
03-31 00:38:11.367: D/AndroidRuntime(606): Shutting down VM
03-31 00:38:11.367: W/dalvikvm(606): threadid=1: thread exiting with uncaught 
exception (group=0x40015560)
03-31 00:38:11.426: E/AndroidRuntime(606): FATAL EXCEPTION: main
03-31 00:38:11.426: E/AndroidRuntime(606): java.lang.ExceptionInInitializerError
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
java.lang.Class.newInstanceImpl(Native Method)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
java.lang.Class.newInstance(Class.java:1409)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.os.Handler.dispatchMessage(Handler.java:99)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.os.Looper.loop(Looper.java:123)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
android.app.ActivityThread.main(ActivityThread.java:3683)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
java.lang.reflect.Method.invokeNative(Native Method)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
java.lang.reflect.Method.invoke(Method.java:507)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
dalvik.system.NativeStart.main(Native Method)
03-31 00:38:11.426: E/AndroidRuntime(606): Caused by: 
java.lang.UnsatisfiedLinkError: Couldn't load gdx: findLibrary returned null
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
java.lang.Runtime.loadLibrary(Runtime.java:429)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
java.lang.System.loadLibrary(System.java:554)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:116)
03-31 00:38:11.426: E/AndroidRuntime(606):  at 
com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication
.java:59)
03-31 00:38:11.426: E/AndroidRuntime(606):  ... 15 more

Original comment by mkbluesk...@gmail.com on 30 Mar 2012 at 7:12

GoogleCodeExporter commented 9 years ago
You are most likely missing the armeabi/ and armabi-v7a/ folders in your 
Android project's libs/ folder.

Original comment by badlogicgames on 31 Mar 2012 at 9:51

GoogleCodeExporter commented 9 years ago
I include them, but why not catch the property ...
and the api for higher version not applicable why?
if you have a small successful demo of simple sample.
than send me pls.

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:21

GoogleCodeExporter commented 9 years ago
We add them,but anything missing than say me..pls

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:23

GoogleCodeExporter commented 9 years ago
Are you running this on a x86 build of Android? That's the only reason for this 
error to pop up if you added the arm folders. 

You can find a lot of working demo games and examples in the SVN repository, 
see the front page here for instructions on how to import and run them.

Original comment by badlogicgames on 31 Mar 2012 at 11:29

GoogleCodeExporter commented 9 years ago
yes

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:32

GoogleCodeExporter commented 9 years ago
When we run on x86 than how we solve it?

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:33

GoogleCodeExporter commented 9 years ago
You can't. We don't support x86 Android i'm afraid.

Original comment by badlogicgames on 31 Mar 2012 at 11:47

GoogleCodeExporter commented 9 years ago
[2012-03-31 17:21:09 - Dex Loader] Unable to execute dex: Java heap space
[2012-03-31 17:21:09 - gdx-helloworld-android] Conversion to Dalvik format 
failed: Unable to execute dex: Java heap space

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:52

GoogleCodeExporter commented 9 years ago
mean i change the os...coming to 32 bit

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:52

GoogleCodeExporter commented 9 years ago
It has nothing to do with 32-bit or 64-bit. Android currently supports 3 CPU 
architectures, arm6, arm7 and x86 32-bit. To the best of my knowledge, x86 
Android is only used for Google TV as well as the x86 system image you can use 
with your emulator, available in the latest ADT. Libgdx can't be run on Google 
TV nor the x86 system image.

Original comment by badlogicgames on 31 Mar 2012 at 11:55

GoogleCodeExporter commented 9 years ago
Hey thanks a lot , I solve the problem........
I don't know but it supports higher version ......

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 11:59

GoogleCodeExporter commented 9 years ago
It's working on SDK 1.5
,Can i develop a high mission games on android version 1.5
because i am a game develop on unity also, and also interesting work on java.

Original comment by mkbluesk...@gmail.com on 31 Mar 2012 at 12:00

GoogleCodeExporter commented 9 years ago
I have no idea what you are doing, but if you got it working, more power to you 
:)

I don't know what a high mission game is i'm afraid. Libgdx supports Android 
1.5 to 4 out of the box. Please direct any further questions to the forums at 
http://www.badlogicgames.com/forum.

Original comment by badlogicgames on 31 Mar 2012 at 12:06

GoogleCodeExporter commented 9 years ago
If it doesn't work on the device, try this:
android-project -> properties -> java Build Path -> Order and Export
Click the project you've linked to (your plain java-project or desktop-project) 
and click the "Up"-button until it is at the very top. Make sure it's ticked 
[V].
I did that with the jars too, just in case, and now it runs on my device. I 
still get that same error on my x86 VM, because libgdx does not support x86 
Android devices

Original comment by ultro...@gmail.com on 12 Oct 2012 at 1:43