Reputation: 1711
It seems like there are many different answers to this question, none of which work for me!
When I build my android app with eclipse, everything works fine. My JAR file is located in the /libs
directory of my project, as recommended.
I am using SDK r15 (the latest android sdk available).
When I run ant debug
, the apk file is built. However upon running the file in the emulator, a force quit
is thrown. From LogCat, I see errors consistent with the JAR file not being compiled.
Many of the answers I see here, refer to older versions of the SDK. Also many refer to files which no longer exist. For example, android_rules.xml
no longer exists in the ../tools/ant/ directory
. Instead I see only a build.xml
.
Has anyone solved this issue for the latest android.
Not I MUST use ant (not eclipse) for this build..
Upvotes: 0
Views: 697
Reputation: 38168
If you use ant to build your android project, just add your jar to the libs project. Eclipse will need you to add it through the project properties wizard. Maven should have some archteyp for that but I don't know it.
An extra jar file needs to be both added through dex and apkbuilder, that's not that easy to do it buy hand, you would be more confortable using ant tools coming with the android sdk, they are pretty well done and provide intersting features like adding jars, build a project for debug and release, testing,etc..
add your jar to a folder named libs and run ant compile from the project basedir.
Upvotes: 2