0

I have a android project (named : My Application) that uses a dependency (named Utility). I added this java library as a dependency in [My Application]'s build.gradle file :

but in Utility project, I used all java sources (not android manifest and not xml resource files), but I also used import android.os.AsyncTask; import in one of my java files inside that library.

My problem is that, what dependency should I add to Utility's build.gradle file, so it can recognize android.os package. this is my Utility project's build.gradle file :

1 Answer 1

1

in order to have these classes accessible, you have to build an Android library:

apply plugin: "com.android.library" 

this would also require to add a Manifest.xml and res directory.

see the documentation.

Sign up to request clarification or add additional context in comments.

3 Comments

in this case it requires me to add buildscript sections and after that, adding buildtoolsversion and when i add all of them, it tells me that she can not find android manifest file :( but i not not have android manifest file and i do not want to add it
@BehzadGhadimi you are probably contradicting yourself, when demanding these Android classes, but not wanting to build an Android library (there is no other way). instead of adding files and directories, you could create a new library project with the new project (or module) wizard, then copy & paste the files into.
allright, I thought that maybe there should be another way, I do it as you said and it is ok now, thanks for your answer :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.