libgdx liquidfun integration runtime error - android-studio

I'm new to this. I generated a new project using libgdx project generator, all worked fine. Then I tried to add liquidfun extension to the library using the following tutorial: https://github.com/finnstr/gdx-liquidfun-extension/wiki/Setup.
It compiles all the dependencies are seen in the editor but at runtime I get this error.
java.lang.NoClassDefFoundError: Failed resolution of:
Lcom/badlogic/gdx/physics/box2d/World; 10-09 10:29:50.698
12790-12895/com.mygdx.game.android E/AndroidRuntime: at
com.mygdx.game.MyGdxGame.createBox2DWorld(MyGdxGame.java:87)
Caused
by: java.lang.ClassNotFoundException: Didn't find class
"com.badlogic.gdx.physics.box2d.World" on path: DexPathList[[zip file
"/data/app/com.mygdx.game.android-1/base.apk"],nativeLibraryDirectories=[/data/app/com.mygdx.game.android-1/lib/arm,
/vendor/lib, /system/lib]]
I am concered of this part of the tutorial which is made for eclipse. I don't know how to configure this in Android Studio.
To do so you should right click on android project and select
Properties -> Java Build Path -> Add external Jar and pick
core/libs/gdx-liquidfun.jar. Last step is to check this library in
Order and export.
Note: I also tried to load the native libraries and they throw no error.
static {
System.loadLibrary("gdx-liquidfun");
System.loadLibrary("gdx-box2d");
}

I figured it out. I had to right click the jar and Add As Library. I had to copy the jar to android/libs. The one from core/libs didn't have the option to Add as Library

Related

Android Studio Library Module to AAR file for Dynamic Loading

I have an Android Studio project that has two modules:
app (dependencies on common.jar and ext)
ext (dependecies on common.jar)
common.jar has most of the model logic of my app.
Right now the app uses reflection to find and instantiate the extension service. Since the class is in the APK the nornal classloaded finds it.
Now I want to sever the app's dependency on the ext module and use DexClassLoader to find the service class from an AAR file.
I have used java and the AndroidSDK dx tool to create a simple JAR file to verify I have the dynamic loading working ... I can find, instantiate, and execute methods from the test JAR file.
I just can't figure out how to make Android Studio generate the AAR file for my library module.
I found an answer burried in:
Create aar file in Android Studio
I saw this before ... but missed the key missing information ...
Using Gradle menu ... I have never used or noticed this before.

Android studio - Unable to add library from outside folder

I am trying to develop an android library and an app using Android Studio. For this, I need to use the library directly in my app project, so I can modify both the library sources and app sources easily.
I am using versions: Android Studio 3.1.2 and Gradle 4.4
First of all, I have tried both methods described in the documentation, but both methods duplicate the library.
Second, I tried to add the library from outside folder as described here, but I get the error:
Unable to find module with Gradle path ':mytestlibrary3-release' (needed by module 'app'.)
My test structure is like this:
In "Workspace" folder I have the app folder "MyApplication4" and library folder "MyTestLib3" containing the library module "mytestlibrary3" (I attached screens)
The application settings.gradle:
include ':app'
include ':mytestlibrary3-release'
project(':mytestlibrary3-release').projectDir = new File(settingsDir, '../MyTestLib3/mytestlibrary3')
and the application build.gradle:
...
dependencies {
...
implementation project(':mytestlibrary3-release')
}
What am I doing wrong here? My purpose is to use the code directly (similar to Eclipse "Add Project to Build Path" or link src folder to source) or to build and use the library as simple and elegant as possible.

Rendering Android Studio

I'm a absolute beginner in programming but I'd love to create my own Apps to make my (and someone else's) everyday life a little easier. I just downloaded the latest version of Android Studio and installed it with all tools.
I wanted to create a "Hello World" App as shown in many tutorials on YouTube. I followed them step by step but there is always this Rendering Problem directly after I finished creating a blank activity.
Rendering Problems
The following classes could not be instantiated:
-android.support.design.widget.FloatingActionButton (Open Class, Show Exception, Clear Cache)
Tip: Use View.isInEditMode() in your custom views to skip code or show sample data when shown in the IDE
Exception Details
android.content.res.Resources$NotFoundException: Unable to find resource ID #0x1080029 at ....
I have no clue what the problem could be and how I solve it and all the answers on google and here on stackoverflow.com to a already existing Rendering Problem couldn't help me.
It's a bug in the Android Studio and Android Design Support Library (ver 23.2.0) that is solved in Dev/Canary channel.
For now, if you use the Stable update channel, you have to edit by hand the build.gradle file.
Under Project tool window -> Gradle Scripts open and edit the file build.gradle (Module: app).
Search for dependencies and make sure the com.android.support.design line looks like this:
compile 'com.android.support:design:23.1.1'
Save
Tools -> Android -> Sync Project with Gradle Files
Build -> Rebuild

How to make a Call in Android Studio using Twilio android sdk?

I am trying to integrate twilio android SDK in android Studio for implementing the outgoing call.Its Working fine in Eclipse but after I added the TwilioClientService in manifest.xml file, App is crashing in Android Studio so that i could not able to connect the call.Could you please any one tell the solution for this.
This is the Error I got,
STACK_TRACE=java.lang.UnsatisfiedLinkError:
dalvik.system.PathClassLoader[DexPathList[[zip file
"/data/app/com.iw.infowave-1/base.apk"],nativeLibraryDirectories=[/vendor/lib64,
/system/lib64]]] couldn't find "libtwilio-native.so" at
java.lang.Runtime.loadLibrary(Runtime.java:366) at
java.lang.System.loadLibrary(System.java:988) at
com.twilio.client.impl.useragent.UserAgent.(UserAgent.java:16)
at
com.twilio.client.impl.CallControlManager.initialize(CallControlManager.java:189)
at
com.twilio.client.impl.CallControlManager.getInstance(CallControlManager.java:131)
at
com.twilio.client.impl.TwilioClientServiceImpl.initialize(TwilioClientServiceImpl.java:169)
at
com.twilio.client.TwilioClientService.onCreate(TwilioClientService.java:50)
at
android.app.ActivityThread.handleCreateService(ActivityThread.java:2761)
at android.app.ActivityThread.access$1800(ActivityThread.java:151)
at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1386)
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$MethodAndArgsCaenter code
hereller.run(ZygoteInit.java:903) at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Twilio developer evangelist here.
It looks like you haven't imported the library into your project.
See where it says:
couldn't find "libtwilio-native.so" at
java.lang.Runtime.loadLibrary(Runtime.java:366) at
You need to have the twilioclient-android.jar in your libs folder and have it properly referenced.
If you want to see how to do that, the easiest way is to follow the docs here or have a look at this sample project I put together here.
UPDATE
Also, as a side-note, you have to absolutely make sure the .so files are accessible by your project. If you're using Gradle, all you need to do is create a new folder under src/main called jniLibs and add all the contents of the lib folder there. This will make sure all the native SDK files are correctly referenced. You can see that on the sample project i posted earlier
Let me know how it goes.

KXmlParser build issue in MIDlet app

I keep getting this error
Uncaught exception java/lang/NoClassDefFoundError: org/xmlpull/v1/XmlPullParserException.
when I try to run a MIDlet with KXmlParser.
I have included the kxml2-2.3.0.jar lib into project build path, and it is visible under the 'Referenced libraries'.
I guess that the library is still not included in the Midlet JAR, but do not know how to correct this?
I am using Nokia SDK 1.0 and Eclipse Indigo.
On the build path dialog of your project, select the Order and Export tab and select the kxml jar file so that it is exported.

Resources