Pregunta

I've searched everywhere I could for a solution to my problem an I couldn't find one, so I hope there's someone outhere who can help me.

I have a .jar library that I want to include into my project, I've followed a fews guides I found, but no one has worked for me so far, despite the fact that I can compile and generate my APK.

After installing the APK and launching the app, when a class member is called (the one from the library I want to import), my app crashes, and logcat gave me this :

Could not find class 'net.rdrei.android.dirchooser.DirectoryChooserActivity', referenced from method com.azsde.myApp.Settings$1.onPreferenceClick

I then decompiled my apk because I was curious to see if the class has been included or not, and I found that it has not be included in my apk, here's a the result of a tree command listing my files:

http://pastebin.com/wcdK37FM

Here are my Java Build Path settings:

What did I do wrong and why isn't my library included in my APK?

¿Fue útil?

Solución

Adding the JAR to your project's build path yourself as if it were a plain Java project will not work.

You add libraries to an Android project by copying the JAR to the libs folder at the root of your project (if the folder does not exist, then create it); ADT will then automatically add it to your build path and set up your project to bring the JAR into your APK.

You can learn more here http://tools.android.com/recent/dealingwithdependenciesinandroidprojects

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top