.jar and .so lib files build problem

122 views
Skip to first unread message

williamc...@epii.com.co

unread,
Jul 26, 2014, 10:53:05 AM7/26/14
to codenameone...@googlegroups.com
Hi, I'm trying to use a native lib for ANDROID that is composed by two files: a "library1.jar" file and a "library2.so" file, the library documentation says that I have to put the "library2.so" file into a directory like this "armeabi/library2.so". What I did was to put the "library1.jar" File into the "native/android" directory and the "library2.so" file into "native/android/armeabi" directory, then I send my project to ANDROID build and the app builds successfully, but when I run the app in my phone it breaks instantly. I tried building the app without the "library2.so" file included and it builds successfully too, so I think that the problem is that the "library1.jar" library file uses the "library2.so" file in some way, and I don't know how to say to the build process how to point to that file. So the question is: How can I get it work/build correctly? 

thanks for your help!

Chen Fishbein

unread,
Jul 26, 2014, 2:10:57 PM7/26/14
to codenameone...@googlegroups.com, williamc...@epii.com.co
Hi,
Create an android library project put your .so and.jar files into that project, then zip the whole library project and change the suffix to .andlib and place that under the native/android dir.

williamc...@epii.com.co

unread,
Jul 26, 2014, 5:24:33 PM7/26/14
to codenameone...@googlegroups.com, williamc...@epii.com.co
Hi, I just did what you suggest, but I got an error: 
BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:577: /dependency/ePOS_Print_CN1Lib/ resolve to a path with no project.properties file for project /tmp/..., 

I looked for the project.properties file and I found that file inside the nbproject folder, and I putted my .so and .jar files in that folder and zipped it to nbproject.andlib and I got this other error:

BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:577: java.lang.NullPointerException
at com.android.ant.DependencyHelper.getDirectDependencies(DependencyHelper.java:237)
at com.android.ant.DependencyHelper.resolveFullLibraryDependencies(DependencyHelper.java:289)
at com.android.ant.DependencyHelper.init(DependencyHelper.java:185)
at com.android.ant.DependencyHelper.<init>(DependencyHelper.java:177)
at com.android.ant.GetLibraryPathTask.execute(GetLibraryPathTask.java:149)
at com.android.ant.ComputeDependencyTask.execute(ComputeDependencyTask.java:226)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

thanks for your help!

Shai Almog

unread,
Jul 27, 2014, 2:18:30 AM7/27/14
to codenameone...@googlegroups.com, williamc...@epii.com.co
Hi,
how are you sending a cn1lib?
When Chen said library he means Android native library project not a cn1lib.
Reply all
Reply to author
Forward
0 new messages