21:54, EEST
June 9, 2014
Hi,
I am facing an issue with the running the example Android app. I have installed Android Developer Tools along with the corresponding JDK. I have downloaded all the dependencies including the jar files. When I’m trying to run the sample code, I get a NoClassDefFoundError, specifically with trying to execute the code on line 106 inside ConnectAndReadTimeTask.java as provided in the sample code. I tried many things, including copying the jar files into a libs folder inside my workspace.
It seems to me that the runtime doesn’t recognize the UaClient class as part of the third party library. I have definitely included the jar file Prosys-OPC-UA-Java-SDK-Client-Server-Evaluation-1.4.8-8731.jar. I think the issue is that the jar files are not being included in the runtime classpath. This is because I am not getting the error at compile time, but at runtime. I’m not sure what I should do. Is this a java runtime issue as I suspect? Any advice would be helpful!
7:40, EEST
December 21, 2011
Did you notice my first comment to the Blog article?
You must also define the libraries that you use in the Order & Export section of the Build Path editor – and make sure that they are defined before the Android libraries.
12:22, EEST
December 21, 2011
14:49, EEST
June 9, 2014
Jouni Aro said
Did you notice my first comment to the Blog article?
You must also define the libraries that you use in the Order & Export section of the Build Path editor – and make sure that they are defined before the Android libraries.
Unfortunately that doesn’t seem to be working. I have all my jars above my Android and Google libraries. My OpcUaSampleAppForAndroid src and gen libraries are also placed before the Android libraries. I tried playing around with this but nothing seems to be working. Should I be toggling the checkbox that is to the left side of the library and thus ‘export’ the library?
Just to clarify: I’m getting a NoClassDefFoundError, which means that the compiler is ok with everything, but the runtime isn’t. It’s complaining because when it tries to excute the line of code on line 106 of ConnectAndReadTimeTask.java:
UaClient myClient = new UaClient(serverUri);
it throws the stated error. The compiler is not complaining; this program is happily starting. However, when I try to read the time from the server, that’s when the runtime complains. Have you seen this kind of problem before?
Thanks!
16:33, EEST
December 21, 2011
19:24, EEST
June 9, 2014
Jouni Aro said
Yes, you need to check every library for export: otherwise they are not copied to your Android device and cannot be found when the application starts. It’s weird that they are not checked by default.
I’m afraid that’s still not working. I’m trying to run the app on my emulator. Would you like me to send you a screenshot of my build path and order and export? Is that possible to do here?
Most Users Ever Online: 1919
Currently Online:
56 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 734
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1523
Posts: 6449
Newest Members:
christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, Thomassnism, biancacraft16, edgardo3518Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1