0

I build a module in android studio, but in the module, the class of it, I cannot call any android functions. like "Log.d"、"Context".

How can I use the function of android framework in a module project.

CodeAlien
  • 766
  • 2
  • 7
  • 15

1 Answers1

0

Without code it is hard to tell, but I think you are not extending the class Activity in any of your classes

Update:

see this answer to see how to create a library project:
https://stackoverflow.com/a/17064024/1173391

Here is a step by step instruction on how to do this:
http://www.vogella.com/tutorials/AndroidLibraryProjects/article.html

Community
  • 1
  • 1
Nickolaus
  • 4,785
  • 4
  • 38
  • 60
  • yes, that's true. But I do not need any layout in my sdk. Just want to use some functions of framework. Like Context, Handler and so on. – CodeAlien Feb 03 '15 at 18:01
  • yeah therefore you need to extend from any Activity class – Nickolaus Feb 03 '15 at 18:03
  • and this means I should build an android project, add AndroidManifest.xml. And if I do like this, I cannot get a .jar any more – CodeAlien Feb 03 '15 at 18:12
  • of course you can, it is just a normal library project – Nickolaus Feb 03 '15 at 18:14
  • can you tell me how to do that. I just cannot find in build/libs a jar. I use the way post at: http://stackoverflow.com/questions/21712714/how-to-make-a-jar-out-from-an-android-studio-project – CodeAlien Feb 03 '15 at 18:35
  • I cannot find "jar" option of gradle, If I add AndroidManifest.xml in my module. – CodeAlien Feb 03 '15 at 18:42
  • follow the tutorial link from above – Nickolaus Feb 03 '15 at 18:42
  • but u know, I just followed it. And it's going well, when I do not use any android framework functions. But If I add some android functions, jar option of gradle will be gone. – CodeAlien Feb 03 '15 at 18:45
  • how can I get framework functionality. I just import android.jar to the module. But it doesn't work. – CodeAlien Feb 03 '15 at 19:19