Reputation: 12207
I have the following project structure:
MyApp (an Android Application Project)
-- includes MyLibrary
MyLibrary (an Android Library Project)
--libs
----- core.jar*
The problem is that core.jar
is not built into the final APK of MyApp
, so i get NoClassDefFoundError
s, and my app crashes. The core.jar
is set to be exported in MyLibrary
, and it is displayed in MyApp
's Android Private Libraries section, but it does not included in the APK.
I'm using the latest Eclipse Kepler, and the latest ADT.
What am i doing wrong?
Upvotes: 1
Views: 1341
Reputation: 12207
I found the error at last. It was a problem with core.jar
. I built it with an ant script, and it seems the script was bad. This is the bad script. And this is the good script. I wonder which preference was wrong in the bad.
So it was not the Android builder problem at all.
bad script:
<?xml version="1.0" encoding="utf-8" ?>
<project name="project" default="jar" basedir=".">
<target name="compile" description="Compile source">
<mkdir dir="bin" />
<javac srcdir="src" includes="**" destdir="bin"/>
<copy todir="bin">
<fileset dir="src" />
</copy>
</target>
<target name="jar" description="Package into JAR" depends="compile">
<jar destfile="project.jar" basedir="bin" compress="true" />
</target>
</project>
good script:
<project name="core" basedir="." default="dist" >
<property name="dist.dir" value="dist" />
<property name="src.dir" value="src" />
<property name="build.dir" value="bin" />
<target name="dist" depends="clean, package" />
<target name="clean" >
<delete dir="${build.dir}" />
</target>
<target name="init" >
<mkdir dir="${build.dir}" />
</target>
<target name="compile" >
<javac debug="off" destdir="${build.dir}" source="1.6" srcdir="${src.dir}" target="1.6" />
</target>
<target name="package" depends="init, compile" >
<jar basedir="${build.dir}" destfile="${dist.dir}/core.jar" />
</target>
</project>
Upvotes: 1
Reputation: 11
Is "MyLibrary" checked on "Order and Export" Tab under "Java Build Path" Properties options of your project?
I believe it maybe only it.
Upvotes: 1