I'm wondering if it is somehow possible to pack a the native-code (.so-
File) into a jar file.
The reason for this is that I am making a game engine (that uses a
native physics-library) and I don't want the developers have to deal
with the native-stuff at all. Right now the developers would have to
add the "engine.jar" file AND the "libphysics.so" file manually.
So is it possible to put the ".so" into the ".jar" ?
Best Regards,
Nicolas
On Mar 21, 8:11 pm, Nicolas Gramlich <nicolasgraml...@gmail.com>
wrote:
Is that possible?
Regards,
Nicolas
As long as libphysics.so is in the project directory in
libs/armeabi/libphysics.so android tools automatically compiles it into
their apk. So then the user of your library just has to make sure this
is "so" and doesn't have to deal with native stuff ever again.
However when you compile a new .so, you have to tell your clients to
update their projects with the new library...
If you find a way though to include it in the jar, and have android find
it properly let me know.
Sincerely,
Ethan Rublee
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
@Gregory
I really try to narrow the common end-developers interference with
native stuff down to zero.
The physics stuff is sth like: createWorld/createBox/createCircle/
setGravity/setVelocity/...
So one would probably not be able to use 100% of the stuff of the
physics engine, but enough for like 95% of the games.
(While I still could provide the sources so the .so could be
recompiled for personal needs)
Best Regards,
Nicolas
On 21 Mrz., 23:35, Gregory Ray <gr...@seekmobileinteractive.com>
wrote:
> You can not package your .so in a JAR. Also I would be willing to guess that
> your users want native access since it would be challenging to create a game
> using only java or something like lua.
>
> > android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>
On Mar 21, 5:35 pm, Gregory Ray <gr...@seekmobileinteractive.com>
wrote:
> You can not package your .so in a JAR. Also I would be willing to guess that
> your users want native access since it would be challenging to create a game
> using only java or something like lua.
>
> > android-ndk...@googlegroups.com<android-ndk%2Bunsu...@googlegroups.com>
The reason is that during packaging all non .class files are added to
the apk (which is really just a jar file) using the same path.
That path I mentioned above is the path where the native libraries go
in the apk.
It should work. I think.
Xav
> To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
>
>
--
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
Please do not send me questions directly. Thanks!
I tried it with both: "lib" and "libs" and what I get is:
for "libs/...":
[2010-03-24 11:12:51 - AndEnginePlayGround] The library
'andenginephysicsbox2d.jar' contains native libraries that will not
run on the device.
[2010-03-24 11:12:51 - AndEnginePlayGround] The following libraries
were found:
[2010-03-24 11:12:51 - AndEnginePlayGround] - armeabi/
libandenginephysicsbox2d.so
for "lib/...":
[2010-03-24 11:16:49 - AndEnginePlayGround] The library
'andenginephysicsbox2d.jar' contains native libraries that will not
run on the device.
[2010-03-24 11:16:49 - AndEnginePlayGround] Additionally some of those
libraries will interfer with the installation of the application
because of their location in lib/
[2010-03-24 11:16:49 - AndEnginePlayGround] lib/ is reserved for NDK
libraries.
[2010-03-24 11:16:49 - AndEnginePlayGround] The following libraries
were found:
[2010-03-24 11:16:49 - AndEnginePlayGround] - lib/armeabi/
libandenginephysicsbox2d.so
Both were built with ant:
#######################
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="createjar" name="AndEngine">
<property environment="env" />
<property name="ECLIPSE_HOME" value="E:/eclipse/galileo-android" />
<property name="debuglevel" value="source,lines,vars" />
<property name="target" value="1.6" />
<property name="source" value="1.6" />
<property name="bin" value="bin" />
<property name="src" value="src" />
<property name="libs" value="libs" />
<property name="binfile" value="bin/andenginephysicsbox2d.jar" />
<property name="targetfile_1" value="../AndEnginePlayground/lib/
andenginephysicsbox2d.jar" />
<target name="createjar" >
<jar destfile="${binfile}">
<zipfileset prefix="libs" dir="${libs}">
<include name="**/*.so" />
</zipfileset>
<zipfileset dir="${src}">
<include name="**/*.*" />
<exclude name="**/R.java" />
</zipfileset>
<zipfileset dir="${bin}">
<include name="**/*.class" />
<exclude name="**/R.class" />
<exclude name="**/R$*.class" />
</zipfileset>
</jar>
<copy file="${binfile}" tofile="${targetfile_1}"/>
</target>
</project>
#######################
Resulting directories are (correct):
xyz.jar
+-->lib(s)
+-->armeabi
+-->xyz.so
+-->org
+-->anddev
+--> ...
+->META-INF
#######################
Any secret setting to enable or so ;) ?
Best Regards,
Nicolas
> > For more options, visit this group athttp://groups.google.com/group/android-ndk?hl=en.
I'm afraid there's no work around, you'll need to manually add the
library to the project that includes the jar file.
Xav
> For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
/Michael
Has there been a resolution to this? It seems stupid to disable a perfectly good feature because a couple of jackasses accidentally left Windows code in their JAR files. Does it really matter if there are extra, unreferenced bits in it anyway? It would be terribly convenient to distribute our libraries as a single JAR.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-ndk/-/inLU5f4q-HMJ.
Doesn't Android include the APIs for reading resources from a JAR
file? If an app has permission to write to its own lib directory
(/data/data/<appname>/lib) it might be possible to extract an .so from
a JAR and write it to the app's lib directory, and then call
System.loadLibrary as normal. Just an idea.. I haven't tested it
myself./Michael