square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
43.13k stars 7.3k forks source link

Library Using Older Version of Retrofit #1152

Closed theshapguy closed 9 years ago

theshapguy commented 9 years ago

I recently was testing out Twitter Digits and Retrofit.

compile 'com.squareup.retrofit:retrofit:2.0.0-beta2'
    compile 'com.squareup.retrofit:converter-gson:2.0.0-beta2'
    compile 'com.squareup.retrofit:adapter-rxjava:2.0.0-beta2'

    compile('com.digits.sdk.android:digits:1.8.0@aar') {
        transitive = true;
    }

However when I build the app I get this error. It cannot find the build adapter, which is no longer in Retrofit 2.0.

Do I have to wait till Digits Updates its module to Retrofit 2 or is there any other options to use them both together. Forcing one module, here Digits, to use Retrofit 1.9 and my app to use 2.0.


10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime: FATAL EXCEPTION: main
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime: Process: shap.np.saito, PID: 3729
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime: java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit/RestAdapter$Builder;
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.twitter.sdk.android.core.internal.oauth.OAuthService.<init>(OAuthService.java:50)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.twitter.sdk.android.core.internal.oauth.OAuth2Service.<init>(OAuth2Service.java:59)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsGuestSessionProvider.<init>(DigitsGuestSessionProvider.java:38)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsClient.createAuthRequestQueue(DigitsClient.java:83)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:73)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:53)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.Digits.createDigitsClient(Digits.java:221)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.Digits.getDigitsClient(Digits.java:210)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsAuthButton.getDigitsClient(DigitsAuthButton.java:105)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsAuthButton.onClick(DigitsAuthButton.java:75)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.view.View.performClick(View.java:5254)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.view.View$PerformClick.run(View.java:21179)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:739)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:95)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:145)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:6837)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:  Caused by: java.lang.ClassNotFoundException: Didn't find class "retrofit.RestAdapter$Builder" on path: DexPathList[[zip file "/data/app/shap.np.saito-1/base.apk"],nativeLibraryDirectories=[/data/app/shap.np.saito-1/lib/arm64, /vendor/lib64, /system/lib64]]
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.twitter.sdk.android.core.internal.oauth.OAuthService.<init>(OAuthService.java:50) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.twitter.sdk.android.core.internal.oauth.OAuth2Service.<init>(OAuth2Service.java:59) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsGuestSessionProvider.<init>(DigitsGuestSessionProvider.java:38) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsClient.createAuthRequestQueue(DigitsClient.java:83) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:73) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsClient.<init>(DigitsClient.java:53) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.Digits.createDigitsClient(Digits.java:221) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.Digits.getDigitsClient(Digits.java:210) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsAuthButton.getDigitsClient(DigitsAuthButton.java:105) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.digits.sdk.android.DigitsAuthButton.onClick(DigitsAuthButton.java:75) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.view.View.performClick(View.java:5254) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.view.View$PerformClick.run(View.java:21179) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.os.Handler.handleCallback(Handler.java:739) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.os.Handler.dispatchMessage(Handler.java:95) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.os.Looper.loop(Looper.java:145) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at android.app.ActivityThread.main(ActivityThread.java:6837) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Native Method) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.reflect.Method.invoke(Method.java:372) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199) 
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:    Suppressed: java.lang.ClassNotFoundException: retrofit.RestAdapter$Builder
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.Class.classForName(Native Method)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:     at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:            ... 21 more
10-01 13:56:34.801 3729-3729/shap.np.saito E/AndroidRuntime:  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
JakeWharton commented 9 years ago

Do I have to wait till Digits Updates its module to Retrofit 2 or is there any other options to use them both together.

Yeah, unfortunately you either have to wait until they update their library to work with v2, or they need to be shading their Retrofit dependency so as not to cause conflicts like this.

The alternative is to ship Retrofit in a new package name which sounds appealing to people which have this happen, but is fraught with its own problems that I'm not too fond of.

A slightly hacky workaround (that I don't have a working example of off-hand) would be to create an empty library module in your project which depends on the Digits SDK. Then use either ProGuard or jarjar to move the Retrofit v1 package to something like retrofit1.* or com.digits.sdk.internal.retrofit.*. In your application you would then depend on that library module instead of the Digits SDK directly.

rallat commented 9 years ago

The Fabric team is aware of this issue and we will update retrofit to 2.0.0 once is final. Thanks for reporting this @TheShapGuy

artem-zinnatullin commented 9 years ago

@rallat please shade Retrofit (and other significant dependencies), if you switch to Retrofit v2 without shading — those who still use 1.9 in their apps won't be able to use new versions of your tools.

JakeWharton commented 9 years ago

Conversely, if every library that wants to use Rertofit shades it, that's a ton of wasted APK size and methods towards the count.

skhaz commented 9 years ago

Any news?

marcinkosztolowicz commented 9 years ago

The same question :+1:

chenWork commented 9 years ago

same thing with zendesk

felipecsl commented 9 years ago

Just stepped on this issue too...

felipecsl commented 9 years ago

Alright... 4 hours later, here's the fix. I've repackaged digits, twitter-core and retrofit 1.8 with jarjar to fix the package clash. You can find here a zip file with repackaged digits-1.9.1.aar, fabric-1.3.7.aar, retrofit-1.8.0.jar and twitter-core-1.6.1.aar to use retrofit1 package instead of retrofit. Here are the rough steps for reference (you don't need to do this, just download the zip file above):

  1. Download digits 1.9.1, fabric 1.3.7 and twitter-core 1.6.1 AAR files from here
  2. Dowload retrofit 1.8 jar from here
  3. Unzip digits and twitter-core aar files
  4. Run jarjar with rule rule retrofit.** retrofit1.@1 on digits, twitter-core classes.jar and retrofit-1.8.0.jar
  5. Replace both classes.jar with the jarjar'ed ones and re-zip both directories (create zip file, then rename file extension to aar)
  6. Gather all the 4 files and put them in your projects libs directory

Now manually add dependencies to aar files (you need to do this):

project/build.gradle

  // Workaround for digits still depending on Retrofit 1.8.0
  // Revert once that's upgraded to 2.0.0
  compile 'com.google.code.gson:gson:2.4'
  compile 'com.digits.sdk.android:digits:1.9.1@aar'
  compile 'io.fabric.sdk.android:fabric:1.3.7@aar'
  compile 'com.twitter.sdk.android:twitter-core:1.6.1@aar'
  compile(files('libs/retrofit-1.8.0.jar'))

root-level build.gradle

allprojects {
  repositories {
    // this tells gradle to read the aar files from the libs directory
    // make sure you don't have maven { url 'https://maven.fabric.io/public' } here, since
    // you want to grab the files specifically from the libs folder and not from maven
    flatDir { dirs 'libs' }
  }
}

You'll also need this since you're depending both on retrofit 1.x and 2.x:

android {
  packagingOptions {
    exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.properties'
    exclude 'META-INF/maven/com.squareup.retrofit/retrofit/pom.xml'
  }
}

That should be it.

TheMedo commented 9 years ago

@felipecsl I managed to get it up an running with your proposed solution, but when I try to do a release build I fails with: Unable to compute hash of ..\release\classes.jar I'm guessing this has something to do with the Proguard configuration, but simply adding retorfit1 instead of retorfit to the rules doesn't seem to work.

Any help would be appreciated :)

guptavps commented 8 years ago

Is there any update on this issue please.

SandroMachado commented 8 years ago

@guptavps this will be "automatically" fixed in the final release with the new Java Interoperability Policy for Major Version Updates. You can read more about it at the @JakeWharton blog: http://jakewharton.com/java-interoperability-policy-for-major-version-updates/

guptavps commented 8 years ago

thanks for the update. Is there any date published for this. I have already used Retrofit 2.0 beta in my project and wanted to use Digits now for user login which i can't....

Date: Mon, 28 Dec 2015 07:53:04 -0800 From: notifications@github.com To: retrofit@noreply.github.com CC: guptavps@hotmail.com Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

@guptavps this will be automatically fixed in the final release with the new Java Interoperability Policy for Major Version Updates. You can read more here: http://jakewharton.com/java-interoperability-policy-for-major-version-updates/

— Reply to this email directly or view it on GitHub.

ytRino commented 8 years ago

@guptavps See #1209 and #1342. Retrofit2 now uses new package name retrofit2 and conflicts has been solved.

guptavps commented 8 years ago

Sorry for being novice, can you please tell me the steps to follow to avoid the conflict and error please...

Date: Mon, 28 Dec 2015 22:23:19 -0800 From: notifications@github.com To: retrofit@noreply.github.com CC: guptavps@hotmail.com Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

@guptavps See #1209 and #1342. Retrofit2 now uses new package name retrofit2 and conflicts has been solved.

— Reply to this email directly or view it on GitHub.

guptavps commented 8 years ago

I am trying to use Retrofit 2.0 beta with dependency compile 'com.squareup.retrofit:retrofit:2.0.0-beta2' and i also have Fabric digits as followscompile('com.digits.sdk.android:digits:1.9.2@aar') { transitive = true; }

When i try to run digits code, it says RestAdapter could not be found. What change should i make please. From: guptavps@hotmail.com To: reply@reply.github.com; retrofit@noreply.github.com Subject: RE: [retrofit] Library Using Older Version of Retrofit (#1152) Date: Tue, 29 Dec 2015 06:56:42 +0000

Sorry for being novice, can you please tell me the steps to follow to avoid the conflict and error please...

Date: Mon, 28 Dec 2015 22:23:19 -0800 From: notifications@github.com To: retrofit@noreply.github.com CC: guptavps@hotmail.com Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

@guptavps See #1209 and #1342. Retrofit2 now uses new package name retrofit2 and conflicts has been solved.

— Reply to this email directly or view it on GitHub.

JakeWharton commented 8 years ago

You need to use the 2.0.0-SNAPSHOT until there is another release. 2.0.0-beta2 does not contain the package name change.

On Tue, Dec 29, 2015 at 1:59 AM guptavps notifications@github.com wrote:

I am trying to use Retrofit 2.0 beta with dependency compile 'com.squareup.retrofit:retrofit:2.0.0-beta2' and i also have Fabric digits as followscompile('com.digits.sdk.android:digits:1.9.2@aar') { transitive = true; }

When i try to run digits code, it says RestAdapter could not be found. What change should i make please. From: guptavps@hotmail.com To: reply@reply.github.com; retrofit@noreply.github.com Subject: RE: [retrofit] Library Using Older Version of Retrofit (#1152) Date: Tue, 29 Dec 2015 06:56:42 +0000

Sorry for being novice, can you please tell me the steps to follow to avoid the conflict and error please...

Date: Mon, 28 Dec 2015 22:23:19 -0800 From: notifications@github.com To: retrofit@noreply.github.com CC: guptavps@hotmail.com Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

@guptavps See #1209 and #1342. Retrofit2 now uses new package name retrofit2 and conflicts has been solved.

— Reply to this email directly or view it on GitHub.

— Reply to this email directly or view it on GitHub https://github.com/square/retrofit/issues/1152#issuecomment-167735019.

guptavps commented 8 years ago

Appreciate your reply Jake. I changed to SNAPSHOT version and i had make changes to many import statements in my app such as 1) Changed "import retrofit.Call" TO "import retrofit2.Call"2) Changed "import com.squareup.okhttp" to "import okhttp3" etc. Below is my change for GSON converter in my build gradle file. compile 'com.squareup.retrofit2:converter-gson:2.0.0-SNAPSHOT' compile 'com.squareup.retrofit2:retrofit:2.0.0-SNAPSHOT' Now i am able to run both Digits and my application but i am getting below exception now :(. Please guide me how to fix this please. Thanks java.lang.IllegalStateException: JSON must start with an array or an object.12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at com.google.gson.stream.JsonWriter.beforeValue(JsonWriter.java:626)12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at com.google.gson.stream.JsonWriter.value(JsonWriter.java:418)12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at com.google.gson.internal.bind.TypeAdapters$13.write(TypeAdapters.java:364)12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at com.google.gson.internal.bind.TypeAdapters$13.write(TypeAdapters.java:348)12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at retrofit2.GsonRequestBodyConverter.convert(GsonRequestBodyConverter.java:46)12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at retrofit2.GsonRequestBodyConverter.convert(GsonRequestBodyConverter.java:29)12-29 13:17:32.308 25821-28649/starcare.mycare W/System.err: at retrofit2.RequestAction$Body.perform(RequestAction.java:245)12-29 13:17:32.309 25821-28649/starcare.mycare W/System.err: at retrofit2.RequestFactory.create(RequestFactory.java:63)12-29 13:17:32.309 25821-28649/starcare.mycare W/System.err: at retrofit2.OkHttpCall.createRawCall(OkHttpCall.java:124)12-29 13:17:32.309 25821-28649/starcare.mycare W/System.err: at retrofit2.OkHttpCall.execute(OkHttpCall.java:114)Date: Mon, 28 Dec 2015 23:02:57 -0800 From: notifications@github.com To: retrofit@noreply.github.com CC: guptavps@hotmail.com Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

You need to use the 2.0.0-SNAPSHOT until there is another release.

2.0.0-beta2 does not contain the package name change.

On Tue, Dec 29, 2015 at 1:59 AM guptavps notifications@github.com wrote:

I am trying to use Retrofit 2.0 beta with dependency compile

'com.squareup.retrofit:retrofit:2.0.0-beta2'

and i also have Fabric digits as

followscompile('com.digits.sdk.android:digits:1.9.2@aar') {

transitive = true;

}

When i try to run digits code, it says RestAdapter could not be found.

What change should i make please.

From: guptavps@hotmail.com

To: reply@reply.github.com; retrofit@noreply.github.com

Subject: RE: [retrofit] Library Using Older Version of Retrofit (#1152)

Date: Tue, 29 Dec 2015 06:56:42 +0000

Sorry for being novice, can you please tell me the steps to follow to

avoid the conflict and error please...

Date: Mon, 28 Dec 2015 22:23:19 -0800

From: notifications@github.com

To: retrofit@noreply.github.com

CC: guptavps@hotmail.com

Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

@guptavps See #1209 and #1342. Retrofit2 now uses new package name

retrofit2 and conflicts has been solved.

Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub

https://github.com/square/retrofit/issues/1152#issuecomment-167735019.

— Reply to this email directly or view it on GitHub.

guptavps commented 8 years ago

Hi, Need your help on this. I am trying to upload file using Retrofit 2.0-SNAPSHOT and i am getting below error while uploading. Request you to point me to a fix please, bit urgent please.I am doing like this - @Multipart @POST("document/uploadReport.json") Call uploadReport(@Part("myfile\"; filename=\"image.png\" ") RequestBody file, @Part("fileName") String fileName, @Part("mimeType") String mimeType, @Part("fileSize") String fileSize, @Part("userId") String userId); java.lang.IllegalStateException: JSON must start with an array or an object.12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at com.google.gson.stream.JsonWriter.beforeValue(JsonWriter.java:626)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at com.google.gson.stream.JsonWriter.value(JsonWriter.java:418)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at com.google.gson.internal.bind.TypeAdapters$13.write(TypeAdapters.java:364)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at com.google.gson.internal.bind.TypeAdapters$13.write(TypeAdapters.java:348)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at retrofit2.GsonRequestBodyConverter.convert(GsonRequestBodyConverter.java:46)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at retrofit2.GsonRequestBodyConverter.convert(GsonRequestBodyConverter.java:29)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: at retrofit2.RequestAction$Part.perform(RequestAction.java:193)12-31 12:54:41.951 26150-29732/starcare.mycare W/System.err: Date: Mon, 28 Dec 2015 23:02:57 -0800 From: notifications@github.com To: retrofit@noreply.github.com CC: guptavps@hotmail.com Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

You need to use the 2.0.0-SNAPSHOT until there is another release.

2.0.0-beta2 does not contain the package name change.

On Tue, Dec 29, 2015 at 1:59 AM guptavps notifications@github.com wrote:

I am trying to use Retrofit 2.0 beta with dependency compile

'com.squareup.retrofit:retrofit:2.0.0-beta2'

and i also have Fabric digits as

followscompile('com.digits.sdk.android:digits:1.9.2@aar') {

transitive = true;

}

When i try to run digits code, it says RestAdapter could not be found.

What change should i make please.

From: guptavps@hotmail.com

To: reply@reply.github.com; retrofit@noreply.github.com

Subject: RE: [retrofit] Library Using Older Version of Retrofit (#1152)

Date: Tue, 29 Dec 2015 06:56:42 +0000

Sorry for being novice, can you please tell me the steps to follow to

avoid the conflict and error please...

Date: Mon, 28 Dec 2015 22:23:19 -0800

From: notifications@github.com

To: retrofit@noreply.github.com

CC: guptavps@hotmail.com

Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

@guptavps See #1209 and #1342. Retrofit2 now uses new package name

retrofit2 and conflicts has been solved.

Reply to this email directly or view it on GitHub.

Reply to this email directly or view it on GitHub

https://github.com/square/retrofit/issues/1152#issuecomment-167735019.

— Reply to this email directly or view it on GitHub.

clowestab commented 8 years ago

Likewise, even with this name change I am unable to get Twitter working alongside the remainder of my app (which is utilising the 3rd BETA).

I still get: java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit/RestAdapter$Builder;

Can anyone share any insight?

guptavps commented 8 years ago

I was able to resolve using the retrofit2.0-SNAPSHOT version. Let me know if you need exact dependency.


From: Thomas Clowes notifications@github.com Sent: Friday, January 8, 2016 11:17 AM To: square/retrofit Cc: guptavps Subject: Re: [retrofit] Library Using Older Version of Retrofit (#1152)

Likewise, even with this name change I am unable to get Twitter working alongside the remainder of my app (which is utilising the 3rd BETA).

I still get: java.lang.NoClassDefFoundError: Failed resolution of: Lretrofit/RestAdapter$Builder;

Can anyone share any insight?

Reply to this email directly or view it on GitHubhttps://github.com/square/retrofit/issues/1152#issuecomment-169968683.

[https://avatars2.githubusercontent.com/u/1960718?v=3&s=400]https://github.com/square/retrofit/issues/1152#issuecomment-169968683

Library Using Older Version of Retrofit · Issue #1152 ...https://github.com/square/retrofit/issues/1152#issuecomment-169968683 github.com Alright... 4 hours later, here's the fix. I've repackaged digits, twitter-core and retrofit 1.8 with jarjar to fix the package clash. You can find here a zip file ...

clowestab commented 8 years ago

I have tried with the snapshot version and the 3rd BETA (this is the latest release so I assume that it includes the name change).

Running Fabric.with(this, new Twitter(authConfig));

gives the error "java.lang.VerifyError: com/twitter/sdk/android/core/internal/TwitterSessionVerifier"

Is there something that I am overlooking as regards getting these working side by side?

vdisawar commented 8 years ago

Changing to com.squareup.retrofit2:retrofit:2.0.0-beta3 fixes the issue.

StayZeal commented 8 years ago

I have the same issue with retrofit-2.0.0-beta3.jar

01-20 16:05:34.543: E/AndroidRuntime(22650): java.lang.NoClassDefFoundError: retrofit2.Retrofit$Builder
01-20 16:05:34.543: E/AndroidRuntime(22650):    at co.gofun.retrofitdemo.MainActivity.get(MainActivity.java:27)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at co.gofun.retrofitdemo.MainActivity.onCreate(MainActivity.java:21)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.Activity.performCreate(Activity.java:5451)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2346)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2443)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.ActivityThread.access$800(ActivityThread.java:157)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1354)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.os.Handler.dispatchMessage(Handler.java:110)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.os.Looper.loop(Looper.java:193)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at android.app.ActivityThread.main(ActivityThread.java:5348)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at java.lang.reflect.Method.invokeNative(Native Method)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at java.lang.reflect.Method.invoke(Method.java:515)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645)
01-20 16:05:34.543: E/AndroidRuntime(22650):    at dalvik.system.NativeStart.main(Native Method)
felipefcm commented 8 years ago

@StayZeal If you are using Android Studio, try to "Invalidate Caches".

clowestab commented 8 years ago

Still not able to integrate Twitter within my latest app because of the java.lang.NoClassDefFoundError: retrofit2.Retrofit$Builder issue..

Invalidating caches has not worked for me.

Can anyone give any detailed insight into how they got the Twitter SDK working alongside Beta 3?

dp-singh commented 8 years ago

Didn't work for me as well.

SaadBilal commented 8 years ago

Any working solution yet?

as00paf commented 8 years ago

Same error for me, whats up with it ?

AlexVPerl commented 8 years ago

Same issue / error here with latest version of Fabric / Twitter.

Reached out to support 2 weeks ago, still no answer.

Did anyone find a workaround for this?

LostBee commented 8 years ago

Any update on this? Can we use Digits with latest Retrofit now?

walee-balogun commented 8 years ago

Update pls! What's the workaround ?