Complete Noob Questions/ Limiting Android Logger Output

Hi,

Noob not only to Android Development but to JME3. But not to Java.

So far so good, have completed tutorials and ready to start developing project for uni.

We have our HelloTutorials displaying and running well on our Android phone, however APK file is 40mb. Is this normal?

Also, a build for each project (again, the builds are only of simple HelloTutorial apps) takes about 90 seconds, before Console prompts to connect Android via usb. Is this normal? Youtube demo shows a rapid build.

Finally, we are trying to fool around with Touch capabilities, there is limited documentation for TouchEvent.get(delta)X/Y, so we are looking for output from Android on touchEvents. However, there is massive amount of logger output from the Android. Is there a way to limit this output, so we can only see what we want to output ie, if we use System.out.println? However we don’t believe System.out.println is appropriate, so what would be appropriate?

Great SDK, we are having a lot of fun, thank you for the help.

T&D

You can select the libraries to include (remove the main JME3 one and then if you look under libraries there are a number of options).

Choose just the feature set you need and you can reduce the apk size quite a lot.

I’ve not played a lot with android yet.
I did a simple project with Eclipse “standard” ADT plugin, and a very quick port of some demo I had in JME to android.
It seems so much more difficult in Netbeans! For example, ADT has a feature to filter out the logs sent by the device. Or the emulator.

As I told before, I’m very young with Android development (2 weeks or so…) so maybe I’ve not configured/installed JMP correctly yet for Android development.
Any advice on this is welcome.

You probably have the test-data.jar packaged with the apk, it’s around 40mb and you’ll probably won’t need it so for a starter remove it.
Then as @zarch said, jme is split in several jars so you can bundle only the ones you really need. You can remove jme-effect as it’s the lib containing post process filters, and they are not supported on android. If you don’t use terrain, jme-terrain can be removed and so on.

Anyway the build is kind of long, whatever you do, there is a pre-dexing operation that should be done once (the first time you build) and then only when the jars change, but an issue in android SDK make them pre-dexed at each build.
@iwgeric is watching for this issue, on the android sdk issue tracker, and we’ll be warned when it’s fixed.

Once it’s fixed it should make the build a lot faster (knock on wood).

About the logging part you ahve several options.

  • You can install nbAndroid netbeans plugin http://www.nbandroid.org/p/installation.html to get access to the adb-logcat view which is very convenient. You’ll have a window where you can filter according to the name of the logger (you’ll have to use standard java logging no system.out). I recommend this option as it’s straght forward.
  • You can configure what’s logged in the console in the mobile-impl.xml in the nbproject folder. line 110 the adb logcat is launched with default log filtering options, you can change them to suit your needs
    see this doc to know hw the filtering works http://developer.android.com/tools/debugging/debugging-log.html
1 Like

Thanks Nehon. This view (adb-logcat) is the one I was talking about in ADT. Good to know we can use it right in JMP !

Thank you.

What are differences between compile-time libraries (right click -> properties -> libraries) vs. Libraries in project directory?

there is no difference.

Ok thank you.

I have installed NBAndroid, under Installed Plugins I have Android version 1.90 installed.

However, there is no options under tools to utilize NBAndroid or LogCat. To utilize NBAndroid do I have to create New Project -> Android ? Or can I use NBAndroid from basic Simple JMonkey game? How do I use the features of NBAndroid?

Thank you.

once installed you should have access to adb logcat from the menu Window/Output/ADB log

also when you create a JME project and enable mobile deployement, it will create a mobile folder inthe project (you can see it in the file explorer). This mobile folder is an android project and you can open it as a project with nbandroid.

Thanks for all of your help nehon.

We are having more issues. We are trying to minimize librariess as best as we can to assemble a smaller APK file, as well as trying to take full experience of Android capabilities.

Basically, we are trying to run “water” on Android. We have created ‘simple water’, and tried to deploy it on Android. However we had a huge APK file that wouldn’t fit. Therefore Properties -> Libraries and edited jme3-libraries.jar. We removed every inside package except jme3 effects, to try and find which package was necessary to deploy “simplewater”. Then we removed jme3-effects just for kicks. Now there are no packages in jme3-libraries!!! We have removed it and added it, and there are none left in the Jar file!

When we try to run ANYTHING we have a lot of errors. This is the console when we try to run the default main (helloWorld) in the ‘mygame’ package.

This is for the which should be the computer, not the Android, I am not sure why I am getting issues about Android.

INFO JmeAndroidSystem 3:39:56 PM Running on jMonkeyEngine 3.0.0 Beta
Exception in thread “main” java.lang.NoClassDefFoundError: android/opengl/GLSurfaceView$Renderer
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.jme3.system.android.JmeAndroidSystem.newContext(JmeAndroidSystem.java:100)
at com.jme3.system.JmeSystem.newContext(JmeSystem.java:128)
at com.jme3.app.Application.start(Application.java:387)
at com.jme3.app.Application.start(Application.java:368)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:130)
at Main.main(Main.java:26)
Caused by: java.lang.ClassNotFoundException: android.opengl.GLSurfaceView$Renderer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
… 18 more
Java Result: 1

Then this is the error I get when I try to run on Android.

Mar 14, 2013 3:47:25 PM com.jme3.system.JmeSystem checkDelegate
SEVERE: Failed to find a JmeSystem delegate!
Ensure either desktop or android jME3 jar is in the classpath.
Exception in thread “main” java.lang.NullPointerException
at com.jme3.system.JmeSystem.showSettingsDialog(JmeSystem.java:118)
at com.jme3.app.SimpleApplication.start(SimpleApplication.java:124)
at mygame.Main.main(Main.java:32)

Thank you so much.

no please don’t change what’s in the jme3-libraries.
If you need something lighter, just make another lib and add jars to it.
however you may have issues with simple water , the reflection and refraction might not work (might even crash at some point)

to have a proper setting, just take all the libs that are in jme3-libs, then remove what you obviously don’t need. JME-testdata is the biggest one, and you rpobably don’t need it.
then if you don’t use terrain remove JME-terrain,
If you don’t use nifty , remove all nifty* jars (there are some dependencies to nifty too but start by that)

don’t remove desktop, or lwjgl related jars, because you’ll need them to test your app on desktop and they won’t be copied over to the android bundled apk.

Nehon I have already edited “jme3-libraries” such that there is nothing to remove from the jar when I go to edit it.

How can I restore this JAR file to factory settings? Thank you

Just put all the libs that are in your Users/yourUserName/AppData/Roaming/.jmonkeyplatform\3.0RC2\libs
Don’t pick the ones that have sources or javadoc in the name though, and don’t go in the sub folders.

Nehon, I am on Mac OSX.

Mac equivalent of AppData is Libraries -> ApplicationSupport

I have jmonkeyplatform\3.0RC2\ but no libs folder.

in 3.0RC2 I have:

build.properties
config>
liblwjgl.jnilib
lock
maven>
modules>
openal.dylib
update_tracking>
var>

Any ideas?

Thanks for your support Nehon.

mhh no there must be a Roaming equivalent
@normen, where is it on osx?

Thanks. I figured there was some type of preferences folder that needed to be trashed to execute a full Uninstall. When I originally trashed all my Libs jar, I tried to uninstall, and when I reinstalled, I still had the same issue.

The solution was to trash the folder that is referenced in the the ‘troubleshooting’ URL normen has reffered me to, After you uninstall JME. Then I reinstalled JME and my Libs jar is back to normal. Now that my Libs jar is back to normal, I can see the path of all the Jars it needs.

For reference, on Mac, the ‘libs’ path that Nehon is referring to on Mac default install is:

Applications/jmonkeyplatform.app/Contents/Resources/jmonkeyplatform/jmonkeyplatform/libs

Thanks again. I gotta reinstall NBAndroid and Android SDK, I’ll be back later in the week with more questions. This topic resolved, thanks for all of your help.

Resolved