Integrating Swarm with Libgdx - android

Im looking to integrate Swarm high scores with my game that is built on a modified version of the game framework outlined in the Beginning Android Games book by Mario zechner.
The problem is that my game consists of two halves. One is the gameframework which contains the activity and all the background open gl code. That framework is added as a jar to my game. So i cant reference Swarm in the manifest of the framework, because it doesnt exist. The manifest of the game is the one that is used. Ive tried following the steps for getting Swarm working with libgdx but that doesnt work. I get a classnot found error on runtime.
anyone got any ideas?
thanks
Edit: Unable to post screenshot of the error as my rep is too low.But the error said:
java.lang.RuntimeException: Unable to instatiate activity ComponentInfo{com.MYSTUFF/com.MYSTUFF.FartJumper

Class not found exceptions are thrown when a class loader is unable to find a class. Check to make sure your classes are all named properly and referenced in the manifest xml file.

Related

How to achieve Dynamic code Loading in Android?

Objective:
I have an android application (main) from which I want to download (jar, apk, or any sort of package) and load the package dynamically and start the main activity of my loaded package from my main application.
The solutions I have tried:
I have followed this blog post and try to load the app using DexClassLoader https://medium.com/#kalpeshchandora12/dynamic-code-loading-in-android-dea83ba3bc85#:~:text=DCL(Dynamic%20code%20loading)%20allows,location%20and%20executed%20at%20runtime. I am able to follow all the step and able to load the class from the downloaded apk, now I don't know how to call the main activity of the loaded apk.
I have followed this plugin(https://github.com/DroidPluginTeam/DroidPlugin), which is telling me that I can dynamically load the apk from the server, and then I can install it in the background and then can run it by any communication method (broadcasting, AIDL, etc.) but while following the plugin, I have encountered an error (sort of I/O error while opening APK), it's not able to open my apk for installation.
I don't know if whatever I tried is correct or not and I am not an android guy, instead, I am a unity guy and trying to run my games (I have almost 50) within android applications. There is no choice of loading the game statically in the android project because it severely increases the size.
Please recommend me an approach to achieve this task or if anyone can guide me on how to solve the problems that I am facing.
It sounds like you need look at Feature Delivery.

Android Studio 'forgetting' that layout files exist

Noob Android Studio 3.6.1 on Mac Mojave developer here. I have a very simple app with a few activities. Every so often, the Kotlin class for one of the activities will complain of an unresolved reference to the corresponding layout XML file.
For example, in the Kotlin Class (TraceActivity.kt), I have the following code:
setContentView(R.layout.activity_trace)
and the corresponding XML file lives at:
MyApp/app/src/main/res/layout/activity_trace.xml
All pretty standard stuff I reckon. But setContentView would complain that it couldn't resolve activity_trace. This has happened on a few occasions, and I discovered that restarting would resolve the problem. But this morning, it isn't helping. And it's also started complaining about some of the strings I've added to strings.xml
I managed to get round the errors by making use of the full names for each of the items e.g.
com.mysite.myapp.R.layout.activity_trace
and
com.mysite.myapp.R.string.my_message
So my guess (as a noob) that somewhere it's losing track of where it is. And yet my other activities are perfectly happy when I omit the full location. Can anyone offer some insight here? Thank you - SO is awesome.

Google Maps in Android app crashes

In attempting to add a map to an Android app I encountered an error to the extent of:
04-15 17:36:42.036: E/AndroidRuntime(28534):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{xxx}: android.view.InflateException: Binary XML file
line #7: Error inflating class fragment
I have read over numerous posts, and articles on what the problem might be and have tried any number of suggestions from:
verifying uses-library in Manifest
Adding the Google SDK (as opposed to the Android SDK).
Extending FragmentActivity (as opposed to Activity).
Setting up API Keys and adding them to the Manifest.
However, nothing changes the results. The app still crashes when trying to launch that activity, with the same error message.
In an attempt to narrow things down I downloaded the sample application from here, but it crashes with the exact same error message.
Being relatively new to Android, the above sample looked fine, but with it crashing it's hard to tell where the error is. The complete stack trace is can be found here.
I am developing this on a Nexus 4, running Android 4.2.
I would have assumed that the referenced sample app would have at least worked. Am I wrong? Is there something wrong with the sample I've been referencing?
Have a look to my detailed step by step tutorial for using google android Map v2 on Android Virtual Device(Emulator) Android 4.2 http://umut.tekguc.info/en/content/google-android-map-v2-step-step
Specifically, make sure that the reference to google-play-services_lib can be resolved. If it cannot be resolved, the application will compile and launch successfully up to the point where it actually needs to display the map. Then it will crash.
Right click on the project in Eclipse, and select Properties.
On the left select "Android"
Ensure that google-play-services_lib has a green check mark next to it on the right under Library.
If it has a red "X" or is missing entirely, the reference will need to be re-added.

Google Maps app loads to emulator but will not open on emulator

I followed the google maps tutorial to create a new google maps project, obtained an api key, included the , and the INTERNET permissions in the manifest file. Included
in the main.xml file, and followed the steps to modify the main.java file. The app will install to the emulator, but as soon as I click on the app, a notifications shows:
The application has stopped unexpectedly.
I have exhausted all resources, so hopefully someone can help. Thanks in advance for all of the help. Also, in the logcat, I am getting a number of errors after I "click" on the app in the emulator. One error in particular that I have read about, but not found a fix for is:
Caused by: java.lang.ClassNotFoundException: com.hutzley.TestMap.MyApplication in loader dalvik.system.PathClassLoader
Something in your app is trying to refer to com.hutzley.TestMap.MyApplication, and this class does not exist in your project. Since a reference from Java would typically generate a compile error, I recommend that you check your manifest, find where this is referenced, and change it to whatever it is supposed to be.
Make sure you are using one of the special emulator images which supports the Google APIs, without this you would be trying to run your app on an environment that lacks required libraries for maps to work.

do i need to install sqlite?

Do i need to install sqlite for android or its already installed while installing all the plugin. I was trying to run the application MJAndroid, example in O'Reilly book but i am getting error in the file where the application is trying to extend SQLiteCursor Class.
EDIT
This is the Error Tree.. I am an absolute beginner to android
EDIT2
#CommonsWare thanks for the links. I tried those links and now its giving a new error ie:
The type R is already defined
Screen shot
aanybody pls explain
SQLite is part of the standard Android library; its classes can be found in android.database.sqlite. You don't need to install it.
What is the error you are getting when extending SQLiteCursor?
Look at:
http://www.javakb.com/Uwe/Forum.aspx/java-tools/2404/Eclipse-cannot-find-java-lang-Enum
and:
http://www.eclipsezone.com/eclipse/forums/t108476.html
for advice on your java.lang.Enum import problem. You might also want to take a closer look at the first error, which suggests your build path is messed up.

Categories

Resources