retrofit | A type-safe HTTP client for Android and the JVM | HTTP Client library

 by   square Java Version: 2.10.6 License: Apache-2.0

kandi X-RAY | retrofit Summary

kandi X-RAY | retrofit Summary

retrofit is a Java library typically used in Utilities, HTTP Client applications. retrofit has no bugs, it has build file available, it has a Permissive License and it has high support. However retrofit has 2 vulnerabilities. You can download it from GitHub, Maven.

A type-safe HTTP client for Android and Java. For more information please see [the website][1].

            kandi-support Support

              retrofit has a highly active ecosystem.
              It has 41644 star(s) with 7277 fork(s). There are 1591 watchers for this library.
              It had no major release in the last 12 months.
              There are 153 open issues and 2484 have been closed. On average issues are closed in 53 days. There are 38 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of retrofit is 2.10.6

            kandi-Quality Quality

              retrofit has 0 bugs and 0 code smells.

            kandi-Security Security

              retrofit has 2 vulnerability issues reported (1 critical, 1 high, 0 medium, 0 low).
              retrofit code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              retrofit is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              retrofit releases are not available. You will need to build from source code and install.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              retrofit saves you 5021 person hours of effort in developing the same functionality from scratch.
              It has 27997 lines of code, 2400 functions and 299 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed retrofit and discovered the below as its top functions. This is intended to give you an instant insight into retrofit implemented functionality, and help decide if they suit your requirements.
            • Parses annotations .
            • Resolves the given type using the given context .
            • Enqueues the Callback .
            • Gets the call adapter for the return type .
            • Crawl the specified URL .
            • Delivers a response .
            • Gets the next request body converter .
            • Submits a call to the server .
            • Parse the service method adapter info .
            • Adapts a call to the Observable .
            Get all kandi verified functions for this library.

            retrofit Key Features

            No Key Features are available at this moment for retrofit.

            retrofit Examples and Code Snippets

            Is it possible to use arrow functions in react props?
            Lines of Code : 22dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            class Child extends Component {
              render() {
                return <>;
            class Parent extends Component {
              list = [
                { btn: {...someProps}},
                { btn: {...someProps} },
                { btn: {...someProps} },
            How to output every combination of values in 2 columns, in groups? - SQL
            Lines of Code : 17dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            SELECT  p.group_id, p.parent, c.child
            FROM   ( 
                       SELECT group_id, parent
                       FROM   YourTable
                       GROUP BY group_id, parent
                   p CROSS JOIN 
                       SELECT group_id, child
            Get parent id from level with Oracle SQL
            Lines of Code : 63dot img3License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            select *
            from   t
            MATCH_RECOGNIZE (
              ORDER BY id DESC
         AS id,
       AS name,
                child.lvl  AS lvl,
        AS parent_id
              ONE ROW PER MATCH
              PATTERN (child ancestor
            SwiftUI - MKMapView - Display map center coordinate in a @EnvironmentObject variable
            Lines of Code : 14dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            class Coordinator: NSObject, MKMapViewDelegate {
                var parent: MapView
                init(_ parent: MapView) {
                    self.parent = parent
            func mapView(_ mapView: MKMapView, regionDidChangeAn
            React Highcharts - how to use drillUp from parent component?
            Lines of Code : 45dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            const Child = ({ setChart }) => {
              const chartComponent = useRef(null);
              useEffect(() => {
              }, []);
              return (
            How to fix the error, " Each child must be laid out exactly once." in flutter
            Lines of Code : 81dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
              Widget build(BuildContext context) {
                return Scaffold(
                  appBar: AppBar(
                    title: Text('BMI CALCULATOR'),
                    centerTitle: true,
                  body: Column(
                    children: [
            Java not choosing the most specific method when called through a generic wrapper?
            Javadot img7Lines of Code : 23dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public class Parent {
              void foo(int i) { System.out.println("Parent-int"); }
              void foo(Integer i) { System.out.println("Parent-Integer"); }
            class Child extends Parent {
                void foo(int i) { System.out.println("Child-int"); }
            How to resize accordion after removing a pane in JavaFX
            Javadot img8Lines of Code : 88dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            public class SimpleLayoutAccordionOnRemove extends Application {
                 * AccordionSkin that hacks the broken layout after remove of expanded pane.
                public static class HackedAccordionSkin extends AccordionSkin {
            How to size a QML Combox to the width of its bigger element?
            Lines of Code : 14dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            import QtQuick.Controls
            ApplicationWindow {
                width: 640
                height: 480
                visible: true
                ComboBox {
                    anchors.centerIn: parent
                    implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted
                    model: ["String", "
            Changing In to Exists in SQL - with DISTINCT
            Lines of Code : 11dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            WHERE EXISTS (
              SELECT 1
              FROM ORGHEADER AS aaa
              WHERE aaa.oh_code = t.code
                AND aaa.oh_pk NOT IN (
                  SELECT parent 
                  FROM ORGRELATEDPARTY  
                  WHERE pr_partytype = 'MNG'

            Community Discussions


            Retrofit OkHttp - "unexpected end of stream"
            Asked 2022-Mar-27 at 18:38

            I am getting "Unexpected end of stream" while using Retrofit (2.9.0) with OkHttp3 (4.9.1)

            Retrofit configuration:



            Answered 2022-Mar-27 at 18:38

            OK, It took some time, but I've found what was going wrong and how to workaround that.

            When Android Studio's emulators running in Windows series OS (checked for 7 & 10) receive json-typed reply from server with retrofit it can with various probability loose 1 or 2 last symbols of the body when it is decoded to string, this symbols contain closing curly brackets and so such body could not be parsed to object by gson converter which results in throwing exception.

            The idea of workaround I found is to add an interceptor to retrofit which would check the decoded to string body if its last symbols match those of valid json response and add them if they are missed.



            A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptWithoutKotlincTask$KaptExecutionWorkAction?java.lang.reflect.Invocation?
            Asked 2022-Mar-06 at 10:01

            when I run android application in real device I am getting following gradle errors



            Answered 2021-Aug-21 at 12:15

            I fixed it my problem by updating current kotlin version to latest version and moshi version to 1.12.0



            OkHttpClient sometimes getting incomplete json response
            Asked 2022-Mar-03 at 12:02

            I have been facing this incomplete json error and unable to find the issue. The API response work fine in POSTMAN. But this issue happened in my android emulator and it only happened randomly. This project is build with kotlin dagger-hilt retrofit2 okhttp3 gson.

            Success Response



            Answered 2022-Mar-03 at 12:02

            I suspect the Android emulator might be interfering with you here. I’ve seen issues with it misbehaving, particularly on Windows.


            If you'd like to workaround, consider changing your server to use something other than Connection: close to terminate your response body. Perhaps chunked encoding or a content-length header.



            android datastore-preferences: Property delegate must have a 'getValue(Context, KProperty<*>)' method
            Asked 2022-Feb-28 at 12:19

            I'm writing a jetpack compose android app, I need to store some settings permanently.

            I decided to use androidx.datastore:datastore-preferences:1.0.0 library, I have added this to my classpath.

            According to the descripton I have added this line of code to my kotline file at the top level:

            val Context.prefsDataStore: DataStore by preferencesDataStore(name = "settings")

            But I get a compile error:



            Answered 2022-Jan-13 at 09:20

            I got this error because of an incorrect import:



            android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify
            Asked 2022-Feb-23 at 14:13

            After upgrading to android 12, the application is not compiling. It shows

            "Manifest merger failed with multiple errors, see logs"

            Error showing in Merged manifest:

            Merging Errors: Error: android:exported needs to be explicitly specified for . Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined. See for details. main manifest (this file)

            I have set all the activity with android:exported="false". But it is still showing this issue.

            My manifest file:



            Answered 2021-Aug-04 at 09:18

            I'm not sure what you're using to code, but in order to set it in Android Studio, open the manifest of your project and under the "activity" section, put android:exported="true"(or false if that is what you prefer). I have attached an example.



            One or more issues found when checking AAR metadata values:
            Asked 2022-Feb-18 at 17:01

            Hey I am trying to run my application and I am getting this error




            Answered 2021-Nov-19 at 06:20

            Dependency: androidx.lifecycle:lifecycle-runtime-ktx:2.4.0. The issue is with this dependency, there may be some transitive dependency error. I would suggest use the alpha version of this dependency, worked for me. Replace with this dependency : androidx.lifecycle:lifecycle-*:2.4.0-alpha03



            Android Build Error: "lStar not found..."
            Asked 2022-Feb-18 at 06:59

            I have error like this after trying to build my apps in Emulator

            /Users/joel/.gradle/caches/transforms-3/06231cc1265260b25a06bafce7a4176f/transformed/core-1.7.0-alpha02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.

            I don't know what causes this error. After digging some answer which has similarly error (but in flutter) Problem. But still not solved my issue.

            I have this dependency in my project



            Answered 2021-Sep-28 at 17:18

            I managed to fix this by upgrading compileSdk to 31 and kotlin gradle plugin to 1.5.10



            Could not resolve - Gradle project sync failed. Basic functionality will not work properly - in kotlin project
            Asked 2022-Feb-14 at 19:47

            It was a project that used to work well in the past, but after updating, the following errors appear.



            Answered 2021-Sep-17 at 11:03

            Add mavenCentral() in Build Script



            Hilt circular dependency
            Asked 2022-Jan-10 at 18:41

            I'm creating a pet project with Hilt, and perhaps I'm having this issue because I'm installing everything in SingletonComponent::class, and perhaps I should create components for each one.

            The pet project has a NetworkModule, UserPrefsModule, and the problem appeared when I was trying to create an Authenticator for OkHttp3.

            This is my network module



            Answered 2022-Jan-10 at 18:41

            In most programming languages, if you require an instance of B to construct A and an instance of A to construct B, then you won't be able to construct either.


            • AccessTokenRefreshDataSource requires AuthenticationService
            • AuthenticationService requires Retrofit
            • Retrofit requires OkHttpClient
            • OkHttpClient requires Authenticator
            • Authenticator requires AccessTokenRefreshDataSource

            ...and consequently, regardless of your module or component structure, Dagger can't create any of those instances first.

            However, if your AccessTokenRefreshDataSourceImpl does not need its AuthenticationService instance within the constructor itself, you can replace it with Provider: Dagger automatically lets you inject Provider for any T in the graph, among other useful bindings. This allows Dagger to create your AccessTokenRefreshDataSource without first creating an AuthenticationService, with the promise that once the object graph is created your AccessTokenRefreshDataSource can receive the singleton AuthenticationService instance it needs. After you inject the provider, just call authenticationServiceProvider.get() to get the instance wherever you need it (presumably outside the constructor).

            Of course, you can solve your problem with the same refactor anywhere else in your graph you control. AccessTokenAuthenticator is also a reasonable refactor point, assuming you've written it yourself and thus can modify its constructor.

            Points discussed in the comments:

            • You can always inject a Provider instead of any binding T in your graph. In addition to being valuable for breaking dependency cycles, it can also be handy if your dependency-injected class needs to instantiate an arbitrary number of that object, or if creating the object takes a lot of memory or classloading and you want to delay it until later. Of course, if the object is cheap to construct without dependency cycles and you expect to call get() exactly once, then you can skip that and directly inject T as you've done here.
              • Provider is a single-method object. Calling get() on it is the same as calling a getter of type T on the Component itself. If the object is unscoped, you get a new one; if the object is scoped, you get the one that Dagger has stored in the Component.

              • Generally speaking you can just inject the Provider and call get on it directly:



            Data Class with Nullable Parameter in Kotlin 1.5.0 & 1.6.0 Throwing BackendException
            Asked 2021-Dec-06 at 07:56

            Recently updated from Kotlin 1.4.20 to 1.5.30.

            I have this class which used to compile no problem



            Answered 2021-Dec-06 at 07:56

            My Gradle couldn't find the redacted-gradle-plugin but both of your classes compiles with this minimalistic build.gradle.kts:


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install retrofit

            Download [the latest JAR][2] or grab from Maven central at the coordinates com.squareup.retrofit2:retrofit:2.9.0. Snapshots of the development version are available in [Sonatype’s snapshots repository][snap]. Retrofit requires at minimum Java 8+ or Android API 21+.


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone square/retrofit

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular HTTP Client Libraries


            by square


            by guzzle


            by pagekit


            by tmenier


            by php-http

            Try Top Libraries by square


            by squareKotlin


            by squareKotlin


            by squareKotlin


            by squareJava


            by squareKotlin