UnsatisfiedLinkError using Box2d libgdx for android - android

I am trying to use the libGDX box2d wrapper, but I do not want to use the the full libGDX game engine, because I already have my game implemented and now I want to add some physics.
So, I downloaded the libGDX libraries and put them in build path.
I see the following error:
UnsatisfiedLinkError at com.badlogic.gdx.physics.box2d.World.newWorld(Native Method)
at com.badlogic.gdx.physics.box2d.World.<init>(World.java:101)
at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<init>(PhysicsWorld.java:61)
at org.anddev.andengine.extension.physics.box2d.PhysicsWorld.<init>(PhysicsWorld.java:57)
What can I do?

I use this code from google discussion and it's working fine at my side.
import com.badlogic.gdx.utils.GdxNativesLoader;
GdxNativesLoader.load();
Use this before you do anything. make sure you have gdx.jar and gdx-natives.jar in your project.

This error will happen if you assign an instance during a World property declaration, keeping an empty declaration and assigning the new instance on the App create() method should fix it.

Related

Game does not exist in the namespace Unity.FPS - Building for android

I'm trying to build my game in unity for android and run it to my phone. But for some reason i'm getting some compile erros (that does not exists inside visual studio 2022) on some files (83) and i don't know what is going on wrong.
Part of my log:
There is a problem with the scripts you've attached to game objects, which are making your enemy work.
Scripts: EnemyController, EnemyManager, EnemyMobile, EnemyTurret, and FollowPlayer seem to be missing a game object or a namespace entry, at the very beginning of the script, right after the entries like using.System and so on.
My first guess is you may have written a game object name wrong in those scripts. As you know, C# is case-sensitive. If you wrote game referring to a game object or a namespace, instead of Game, it can cause this problem. My suggestion is to confirm all game object and scene names are referred to correctly in those scripts.
Another, but less likely problem could be that if you were using Rider or a similar kind of coding IDE where the ReSharper extension was installed, and later you copied the code without the namespace entries or to an IDE without ReSharper this may have happened.
The problem is most likely due to a reference mishap in the scripts. So I hope the first step works. Good luck!

Integrating two Unity projects in an Android application

I'm developing an Android app and I need to integrate Unity games/screens in it. I've already exported and added one Unity scene/project to my android app but I cannot figure out how to add two.
I found two main approaches to this:
Create two separate projects: If I do this they clash either in the manifest or in the libraries/assets folder and unity ends up calling just one scene.
For reference:
How to correctly import multiple unity module in single android app avoiding name conflict between different unity module in android studio?
I also tried creating one Unity project with multiple scenes and use messages to call the required scene from Android. For me, Android still calls the same scene regardless of which button is pressed.
Reference:
https://stackoverflow.com/a/43224821/2617578
Does anyone have a solution for this? Either one of the solutions mentioned above would be okay for me.
I'm experienced in Android but a beginner in Unity so I think I might be doing something wrong in the unity code.
I have the unity projects and Android apps I created for the second approach in the following git repository.
https://github.com/hadi-mehmood/AndroidUnityIntegrationSample
Here is one solution to your problem:
First, All things happen inside unity are in one activity.
Combine two unity projects and make different scenes for each of them
create a empty loading scene that starts first (using unity BuildSettings) and does not do anything
on the loading scene, write a SceneLoader script to wait for a command to load a minigame scene.
you can pass the scene name using this method UnityPlayer. UnitySendMessage("Gameobject Name","Method","Message")
right after running Unity Activity call the method above and it should do the work.
Sample SceneLoader:
public class MySceneLoader : MonoBehaviour
{
private void LoadScene(string sceneName)
{
SceneManager.LoadScene(sceneName);
}
}

Millennial media not initializing on unity

WHen i try to initialize milennial media it show error. screen shot attached.
MMSDK.Inititalize(context); inside activity onCreate();
In order to avoid the VerifyError, you must compile all your classes using the same version of Java. Also, once you make a change to a class, then make sure that you re-compile your project from scratch. Finally, if your application makes use of external libraries, verify that you use the appropriate version of every library and of course, consult the corresponding javadocs, in order to be sure that everything is correct.
Was using latest MMSDK version 5 when i used MMSDK version 3 its working fine.

libgdx and TWL: Android app force closes on any TWL menu, works fine on Desktop

I am implementing menus using TWL (http://twl.l33tlabs.org/) in an app written using Libgdx. The app runs fine if I don't start any menus, but as soon as I go to a menu screen it immediately force-closes. Menu screens work fine on the desktop version.
In which build path should TWL-android.jar be included (right now it behaves the same in main, android, and both)? And how will the program know to use the libraries from this .jar instead of the default gdx-twl.jar? Will I have to manually implement something in code to use one or the other depending on platform?
There does not seem to be any documentation or sample code of anyone using TWL on android, only mentioning that it can be done.
Running debugger attached to phone gives the following logcat error:
Could not find class 'com.badlogic.gdt.twl.Layout' referenced from method com.Nanners.OptionsScreen.<init>
I think that TWL-android.jar should be added to android project's build path too. Location of .jar is not relevant.
When you add TWL-android.jar. As that is Android specific you can't use it on the core project, so the classes you are importing are the ones from gdx-twl. To make it simpler to explain I will divide it in different escenarios.
You add TWL-android to your Android buildpath. But you use Gdx-twl in your core project. Which isn't added. Thus getting a:
Could not find class 'com.badlogic.gdx.twl.Layout'
You add both TWL-android AND Gdx-twl to your build path. Thus getting duplicated classes and:
Conversion to Dalvik format failed with error 1
Solution
If you use TWL-android classes, you can only do it inside the Android project:
Merge Core, Desktop and Android project. Or
Use Interfacing with Platform Specific
If you use Gdx-twl:
Don't do it.
Actually the best solution is to get rid of all twl stuff and use Scene2d.Ui instead. Its crossplatform and much easier to use.

Adding Chartdroid library to an Android project

How do I add the Chartdroid library to my android project? I have gone on their website to download the source code but every way I try to add the file to my project it just shows up as gibberish and gives me an error message.
If possible could you give an extremely basic/simple explanation on how to do this because I am very new to both programming and android platforms.
Try to get the example app working and understand how it works. Then create your own application on the level of a HelloWorld appliction which makes a simple chart from a static array of data. That should get you pointed in the right direction.

Categories

Resources