How to make LibGDX + Android Studio jar file? - java

I can't find a way to create an Android Studio jar file for Desktop. I am using Android Studio 1.3.2 and LibGDX library. I created a video game and I want to share it with other PC's without having to install Android Studio to run my project.
What should I do?

If you still have got a build.gradle file for the desktop configuration, execute the "dist" build configuration via gradle. As a result, a runnable jar file will be created.
If you do not know how to achieve this in Android Studio, this can be easily done from the command prompt:
swich to your projects directory
./gradlew desktop:dist

Related

Is it possible to run a jar file in an android application?

I am a begginer in android and I want to develop an application which show a list of jar files to user and user can choose one of them and run it. Is it possible to run a jar file in an android application? (not as a library)
Nope we cannot run a jar file on android devices, You see we have .apk to install it on our android device. But not .jar, Also Android uses the Dalvik VM, where as you need the Java VM to run a jar-file. So you can run jar on android.

Generate a JAR file that links the assets for a LibGDX project using gradle

i'm having an issue when i try to generate a jar file for a desktop game that i made using LibGDX. The problem is that i run the following command:
gradlew desktop:dist
in the Windows command line it generates the jar file in Project/desktop/build/libs folder but when i double click it it closes immediately.
I tried to run it with the following command:
java -jar desktop-1.0.jar
It prints this
Error
I'm new to LibGDX and graddle but i think the problem is in the gradle.build file in my desktop project folder, in the line
project.ext.assetsDir = new File("../core/assets");
My assets are in the core project folder since i unchecked the Android box in the LibGDX project setup and it runs properly when i do it in Netbeans (using the gradle project plug in).
I'm desperate, this is the last thing that i need to finish this project at the uni.
Any help is appreciated.
So i found the mistake, i opened the jar file with 7zip and saw that the images folder changed its name, so i changed it again and it worked.
Hope this helps someone in the future.

NDK installation is required for reuse NDK code?

I have downloaded code http://code.google.com/p/aacplayer-android/downloads/detail?name=aacplayer-android-r25.zip&can=2&q= for playing AAC file in ANDROID
and below is image of that code in eclipse
Here you can see that there is jni folder and libs folder in LIBS folder also contain .so files
Currently i have not installed any NDK and i have imported this project which is working fine...
but if i use this files and code into my project should i have to install NDK?
I have copy and paste this jni and libs folder to my application, now what should i have to do! How to tell my apps that this is the native code!
my apps folder structor is (after copy paste) below
If you do not want to rebuild the .so files you should not need the NDK. Eclipse/Java/Android will handle them as fine as native java libraries. You need the ANdroid NDK if you want to be able to compile c/c++ code for the android platform.

Java project won't compile to a JAR correctly for Android

in an app I'm working on I have an issue with a Java library which is here - https://github.com/kennydude/Boid-Twitter-API
When I run ant android which builds an Android package it builds fine and Eclipse can read the Jar fine.
But on my device it says that dalvik cannot locate any of the classes and eventually throws a ClassDef Exception.
I have used Jars before, so I'm wondering if it's my ant file that's broken
I would open your app project in eclipse (the one that depends on the Java library that is not found at run-time) and add the jar file the Java library produced to its build path. Then execute
android -s update project -p .
in the same directory as your apps' Manifest.xml file in order do generate ant build files.
After this, you should be able to build your app using ant by doing
ant debug
or
ant release
I fixed it by ensuring Ant was compiling to 1.6 of Java which is my target in Eclipse for the application.
Perhaps you're not placing your jar in the libs directory as opposed to lib directory? Here's a similar issue Java (Android) - class not found exception
First of all to build an apk with ant for Android you have to use ant debug or ant release, i don't know what ant android does and why you are using it but this command is not part of the standard approach to ant for Android, that's for sure.
Ant is just a building tools, if a developer provide a building solution in ant, does not mean that his application is for Android.
Under Android everything that is not a native library is converted in a DEX object, which is something similar to bytecode for the Dalvik, there is no jar or other container in your app.
This question may be helpful for you Adding a library/JAR to an Eclipse Android project .
There are a lot of conceptual errors in this topic, you probably want to study the Android platform before using it.

How to deploy MIDlet application use eclipse?

I am using EclipseME to write MIDlet application.
I have deployed by right click on Project->J2ME->Create Package.
After that, I copied Jad and Jar files in Deploy folder to My phone.
For BlackBerry: When I run Jad file, it is installed successful. And run ok.
For Android: When I run jar file, it popup message "open file failed".
Please tell me how to deploy MIDlet app by using Eclipse for all cell phone that can run it.
Android phones can't runt J2ME.
Directly you can't run Java ME application on android. But You can use some alternative ways like App runner or J2ab.
For Android you should develop an application using android sdk. Better you read the android documentation. Search android in google. It will help you.

Categories