Use LibGdx inside native android project

Use LibGdx inside native android project

Postby Chami » Tue Feb 14, 2017 10:26 am

Hi,
I want to implement a 3D model inside my android application. So I downloaded libgdx-nightly-latest.zip from http://libgdx.badlogicgames.com/nightlies/ and place gdx.jar, gdx-backend-android.jar, gdx-natives.jar, armeabi and armeabi-v7a folders in the libs folder. Then I added them as libraries.

My Gradle dependencies:
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile files('libs/gdx-backend-android.jar')
compile files('libs/gdx.jar')
compile files('libs/x86.jar')
compile files('libs/gdx-natives.jar')
}

MainActivity class
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btnPlay = (Button) findViewById(R.id.button);


btnPlay.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(), GameActivity.class);
startActivity(intent);
}
});
}

GameActivity class

public class GameActivity extends AndroidApplication {

GdxGame gdxGame;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
gdxGame = new GdxGame();
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
initializeForView(gdxGame, config);
}
}

GdxGame is my ApplicationListener class.

When I run this code the app crashes with this error :

java.lang.ExceptionInInitializerError
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1606)
at android.app.Instrumentation.newActivity(Instrumentation.java:1066)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
at android.app.ActivityThread.access$800(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load shared library 'gdx' for target: Linux, 32-bit
at com.badlogic.gdx.utils.SharedLibraryLoader.load(SharedLibraryLoader.java:124)
at com.badlogic.gdx.utils.GdxNativesLoader.load(GdxNativesLoader.java:33)
at com.badlogic.gdx.backends.android.AndroidApplication.<clinit>(AndroidApplication.java:63)
at java.lang.reflect.Constructor.newInstance(Native Method) 
at java.lang.Class.newInstance(Class.java:1606) 
at android.app.Instrumentation.newActivity(Instrumentation.java:1066) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2226) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 
at android.app.ActivityThread.access$800(ActivityThread.java:151) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:135) 
at android.app.ActivityThread.main(ActivityThread.java:5254) 
at java.lang.reflect.Method.invoke(Native Method) 
at java.lang.reflect.Method.invoke(Method.java:372) 


Can anyone help with this issue? Am i missing something?
Thank you.
Chami
 
Posts: 2
Joined: Tue Feb 14, 2017 9:33 am

Re: Use LibGdx inside native android project

Postby Chami » Fri Feb 24, 2017 10:30 am

finally i found the mistake i have done.,
Refer the below question and the answer.
http://stackoverflow.com/questions/4229 ... id-project
Chami
 
Posts: 2
Joined: Tue Feb 14, 2017 9:33 am

Re: Use LibGdx inside native android project

Postby thomasbuckley » Mon Oct 02, 2017 11:59 am

My inquiry is, I might want to have the amusement as a feature of the by and large application. I might want to know whether it is even conceivable to add a libgdx diversion to an android local application. I had a go at adding the fitting records to my application, yet this caused an order mistake,
thomasbuckley
 
Posts: 1
Joined: Mon Oct 02, 2017 11:51 am
Location: London

Re: Use LibGdx inside native android project

Postby Christinajohn » Fri Nov 03, 2017 11:40 am

I'm building up an android application which incorporate a little 3D amusement inside it. Here i'm utilizing Libgdx structure (utilized gdx-setup.jar) for building up my 3D demonstrate Who will Do my Assignment for me Since it utilizes local android highlights I have to utilize libgdx as a library inside the android application.
Christinajohn
 
Posts: 1
Joined: Fri Nov 03, 2017 11:35 am


Return to Newton

Who is online

Users browsing this forum: No registered users and 2 guests