1

I have a jar that consists of a class that extends Activity and performs some activity on onCreate. I want to import this jar into my Android app and start the activity.

How can I go about this?

Thanks George

Ron
  • 67
  • 1
  • 2
  • 6

2 Answers2

3

Step #1: Put the JAR in your project's libs/ directory.

Step #2: If you are using Eclipse, add this JAR to your build path

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • what if he's not using eclipse? – o0'. Apr 26 '10 at 21:22
  • Ok. After that, can I just create an Intent object and supply the package name and class name, and then call the startActivity? – Ron Apr 26 '10 at 21:28
  • I did that: put the JAR in libs, and the JAR to build path and add the activity in manifest but in logCat says FATAL EXCEPTION: main ActivityNotFoundException. Any idea?? – Ivan Mar 22 '13 at 11:09
  • @Ivan: Make sure you are on the latest SDK tools and ADT plugin, then undo your manual change to the build path -- just having the JAR in `libs/` should be sufficient. If that does not help, ask a fresh StackOverflow question, where you include your manifest and your entire stack trace. – CommonsWare Mar 22 '13 at 11:27
  • I have SDK Tools v21.1, I remove the jar file from Build path and just having the jar in libs but the FATAL EXCEPTION continues – Ivan Mar 22 '13 at 11:42
  • this is my new question maybe you can help me http://stackoverflow.com/questions/15569620/i-cant-call-an-activity-from-a-jar-file Thanks – Ivan Mar 22 '13 at 11:55
0

I got this working. I put the JAR in the assets folder, and didnt have to set the build path. Thanks a lot!

Chris
  • 3,787
  • 13
  • 42
  • 49