C
C
cawabanga2013-07-31 21:29:40
Java
cawabanga, 2013-07-31 21:29:40

Class loading problem in Java on Android?

Hello.
I have three Java projects:

  • engine
  • A game
  • Native application on NDK

The engine - it is the engine, it provides any infrastructure, abstraction from the platform, two rendering implementations, for desktops on JOGL and for androids on OGLES 2.0.
A game is a conditionally platform-independent application implemented in terms of an engine.
The native app is the simplest app on the NDK, implemented according to the official tutorial in which the game is embedded.
The game has been tested on a desktop, we are trying to debug it on a virtual device. This is where the weirdness started .
Could not find class 'com.GO.GOHot', referenced from method com.issmd.ngo.ngo_1.NGOSurfaceView.<init>

FATAL EXCEPTION: main
java.lang.NoClassDefFoundError: com.GO.GOHot
at com.issmd.ngo.ngo_1.NGOSurfaceView.<init>(NGOSurfaceView.java:12)
at com.issmd.ngo.ngo_1.FullscreenActivity.onCreate(FullscreenActivity.java:58)
[...]

com.GO.GOHot is the application class from the game project.
Project dependencies look something like this (two tried options):
  1. The engine is in the class path of the game, the game is in the class path of the native application.
  2. The engine is in the class path of the game, the game is compiled into a jar and thrown into the lib folder of the native application.

Judging by the fact that Eclipse (and the thing happens in it) sees all the classes (intelligence, everything), I connected everything more or less correctly. But when you try to run the application on the device, the program for some reason tries to look for the class in runtime, load it from somewhere, shows everyone java.lang.NoClassDefFoundError and dies. An absolutely crazy situation, in my opinion, because here is the code, take it at compile / link time, link it to your joy and work for my joy.
Yes, I looked at all sorts of texts on the Internet, tried to follow them (about Order & Export, in particular), but nothing helped.
I'm testing on AVD and on Android x86 4.0.1 on VMWare. The elementary application on OGLES2.0 works there apprx.
I am new to Java & NDK so I may have made a bunch of stupid mistakes, please correct me.
I would also be grateful for any random advice on how it is generally customary to organize such projects.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
serso, 2013-07-31
@serso

Decompile the apk with smali . If the class is present after decompilation, then the problem is in the code (ClassLoader?), if not, then in the build process (proguard?).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question