Reputation:
I want to import okhttp source code (not jar) to android studio as a module. Any suggestions on that ? Thanks !
Upvotes: 11
Views: 44407
Reputation: 219
Go to app level build.gradleand add
For older gradle
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
For newer version add
implementation("com.squareup.okhttp3:okhttp:4.12.0")
Upvotes: 0
Reputation: 553
Unless you just need the source code for some reason in your app, you can just add it as a library by adding
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
to your Gradle build script or
implementation("com.squareup.okhttp3:okhttp:4.12.0")
for kts.
Upvotes: 27
Reputation: 12772
Add this line to your Module level build.gradle
script (Not project level):
dependencies {
// ...
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
}
Then click the build icon (green axe) on top right corner.
Upvotes: 8
Reputation: 51
OkHttp
is a java project, you can use idea rather than Android studio.
pop.xml
in project root directoryUpvotes: 1
Reputation: 12518
Their source is available on Github: https://github.com/square/okhttp
Clone it to your machine, and import it into your project.
Upvotes: 2