Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Shared library project with dependencies: Linker error

Here is my situation:

I have a working application, using a single BlackBerry project, with several dependencies, like bbm, ksoap2 etc.

 

I want to develop a very similar application that shares a lot of the code, UI as well as connection code.

 

Now I created a shared BlackBerry project and set the type to Library. This library has most of the dependencies now, as the webservice or bbm code is in there, for example.

 

Both projects compile successfully, the packaging also succeeds.

 

But when i start the project on the simulator i get the following error:

RuntimeException

Error starting MyApp: Class someClassFromTheLibrary not found

Linker error: 'VerifyError' for MyApp

Class 'someClassFromTheLibrary' not found

 

If i remove calls to the offending class the same error appears with another one, seems to be the first class to be used.

 

I have already disabled maven dependency management and everything else that makes the project more complex, but to no avail.

 

Used system is Eclipse 3.6.2, Plugin 1.5.0.201110141512, JRE 5.0, default simulator 9700

 

Any ideas? 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Shared library project with dependencies: Linker error

I see no reasons why you should get that error and have never encountered it myself. Does it work on an actual device?
---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Shared library project with dependencies: Linker error

[ Edited ]

i tested it on the device today, and it works. Even re-enabled maven dependencies, and it still works.
Going to test another simulator now.

 

On the simulator i first get the message "module Shared not found". I load the module manually using File/load  java program.

Now i get java.lang.Error,  the eventlog states "ApplicationControlImpl assertIPCAllowed".

 

News:

I can get it to run on the simulator when i copy the shared.cod manually into the simulator directory.

 

It seems to be a problem with the build process that the shared.cod is not automatically deployed on the simulator. 

----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
Posts: 15,694
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Shared library project with dependencies: Linker error

The error looks like an issue with Application Control.  There were some 5.0 simulators that sometimes tried to check app control settings when they shouldn't be (should be disabled by default in the sim).  The Run/Debug As deployment mechanism doesn't create a real application group as would be done with typical installation methods, which can cause application control checks to fail because there are not settings configured for the application (it can't check if the permission was set to Allow, Deny or Prompt because they don't exist).

 

The issue of the simulators checking for app control settings when they shouldn't has been fixed in newer simulator releases.

 

Can you try this in a 7.0 sim?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Shared library project with dependencies: Linker error

Hello Mark,
there is no change on the OS 7 simulator, it seems to boil down to the shared module not being copied into the simulator directory.

It does not matter if i set the dependency with maven or add Shared as a project on the build path and click the "order and export" checkbox.

Copying the library cod manually is a nuisance in the daily work, but it also breaks our automated build and control server (jenkins).

Currently i have no idea how to proceed. The "export" seems to work only on jar files, maybe we could build a jar out of the shared project and use that as a dependency?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Shared library project with dependencies: Linker error

When we build with Maven for the simulator we build the libraries as a COD and programatically copy them to the simulator directory (custom plugin does this).

 

When building a release on the build server the Maven dependency code is copied over into the project.

 

When building a shared COD I had to go through this junk: http://supportforums.blackberry.com/t5/Java-Development/NoClassDefFoundError-using-shared-library-co...

 

Maven dependencies are seperate and shouldn't affect Eclipse classpath or exports.

Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Shared library project with dependencies: Linker error

Yes, we should probably try to get the plugin of your colleague to work with our project, it could provide a solution.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
Posts: 15,694
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Shared library project with dependencies: Linker error

How did you configure dependencies into the lib project?  Did you copy source code to the lib project or import jar files?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 16,986
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Shared library project with dependencies: Linker error

The lib project has several dependencies, yes.
facebookapi, log4b, paymentapi are added as a jar dependency, marked as export.
bbm-spi and ksoap2 are linked using maven, but both are installed manually on the simulator anyhow as we don't change them.
(for releases we have built them into cod files and add them to jad/alx).

In any case, the shared.cod is built successfully on "package project", just not copied to the simulator folder.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: Shared library project with dependencies: Linker error

If the shared.cod is built with Maven, you could try pointing your classpath to the JAR your the local repo.