OK I have made some progress. Instead of using System.loadLibrary(), I
ended up copying the library to / directory on the android and used
the function System.load("/libaudioserver.so").
Dalvik Debug Monitor indicates that the library was loaded however,
gives the message that
"No JNI_OnLoad found in /libaudioserver.so"
I found another post in which it was indicated that:
No JNI_OnLoad is perfectly normal, it's only a debug message.
http://groups.google.com/group/android-ndk/browse_thread/thread/186678942625f46a/557bfe20de389d24
So I went ahead and started calling the functions, however, the
application crashes.
Questions:
How to include .jar in Eclipse. If I try to load my .jar, and right
click on it to say that 'include in build path' I get the following
errors:
[2011-08-09 21:13:58 - IPPA] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Loa/as/
NewTestClass;
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:
123)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.dex.file.DexFile.add(DexFile.java:143)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.command.dexer.Main.processClass(Main.java:372)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.command.dexer.Main.processFileBytes(Main.java:346)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.command.dexer.Main.access$400(Main.java:59)
[2011-08-09 21:13:58 - IPPA] Dx at com.android.dx.command.dexer.Main
$1.processFileBytes(Main.java:294)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:
244)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:
130)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:
108)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.command.dexer.Main.processOne(Main.java:313)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.command.dexer.Main.processAllFiles(Main.java:233)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.dx.command.dexer.Main.run(Main.java:185)
[2011-08-09 21:13:58 - IPPA] Dx at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[2011-08-09 21:13:58 - IPPA] Dx at
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[2011-08-09 21:13:58 - IPPA] Dx at
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[2011-08-09 21:13:58 - IPPA] Dx at
java.lang.reflect.Method.invoke(Unknown Source)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.ide.eclipse.adt.internal.build.DexWrapper.run(DexWrapper.java:
179)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.ide.eclipse.adt.internal.build.BuildHelper.executeDx(BuildHelper.java:
585)
[2011-08-09 21:13:58 - IPPA] Dx at
com.android.ide.eclipse.adt.internal.build.builders.PostCompilerBuilder.build(PostCompilerBuilder.java:
490)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:
629)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
172)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
203)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:
255)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:
258)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:
311)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:
343)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:
144)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:
242)
[2011-08-09 21:13:58 - IPPA] Dx at
org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
[2011-08-09 21:13:58 - IPPA] Dx 1 error; aborting
[2011-08-09 21:13:58 - IPPA] Conversion to Dalvik format failed with
error 1
How to deal with this error? How to start using functions from .jar
archive?
Thanks
On Aug 9, 8:30 am, Ashish <
anan...@gmail.com> wrote:
> Hi Philippe,
> Thanks for the prompt reply. I updated the source line to
> System.loadLibrary("audioserver") but no change. Dalvik Debug Monitor
> indicates that library could not be loaded.
>
> Can indicate if the following steps are correct when loading the
> library in Eclipse project.
>
> After starting Eclipse, I load my test Android application. I have
> created a new folder called libs. I right click on the folder libs and
> select Import -> General -> File System. I then select my
> libaudioserver.so library and click OK.
>
> Is this correct? Note that I do not use Eclipse to generate the
> libaudioserver.so.
>
> Thanks for your help.
> Ash
>
> On Aug 9, 6:36 am, Philippe Simons <
simons.phili...@gmail.com> wrote:
>
>
>
>
>
>
>
> > yup... your System.loadLibrary call is wrong
>
> > System.loadLibrary("audioserver.so");
>
> > should be
>
> > System.loadLibrary("audioserver");
>
> > On Mon, Aug 8, 2011 at 10:23 PM,Ashish<
anan...@gmail.com> wrote:
> > > Hi Philippe,
>
> > > That is correct. The library that is generated is called
> > > libaudioserver.so
>
> > > Any other ideas as to what could be going wrong?
>
> > > Thanks
>
> > > On Aug 8, 10:23 pm, Philippe Simons <
simons.phili...@gmail.com> wrote:
> > > > System.loadLibrary take as arguments the undecorated name of your library
> > > > if your library file is libaudioserver.so, you need to pass "audioserver"
> > > to
> > > > loadLibrary()
>