I just start using RxJava in my projects, i have got this error :
java.lang.NoSuchMethodError: No static method getService()Lcom/app/seddik/yomii/api/GalleryPhotosService;
In this class the error has occured, and says :
No static method getService()Lcom/app/seddik/yomii/api/GalleryPhotosService; in class Lcom/app/seddik/yomii/api/GalleryPhotosService; or its super classes (declaration of 'com.app.seddik.yomii.api.GalleryPhotosService' appears in /data/app/com.app.seddik.yomii-2/base.apk:classes27.dex)
at com.app.seddik.yomii.data.datasource.GalleryPhotosDataSource.(GalleryPhotosDataSource.java:40)
public class GalleryPhotosDataSource extends ItemKeyedDataSource<Integer, GalleryPhotosItems> {
private GalleryPhotosService galleryPhotosService;
private CompositeDisposable compositeDisposable;
private MutableLiveData<NetworkState> networkState = new MutableLiveData<>();
private MutableLiveData<NetworkState> initialLoad = new MutableLiveData<>();
/**
* Keep Completable reference for the retry event
*/
private Completable retryCompletable;
GalleryPhotosDataSource(CompositeDisposable compositeDisposable) {
this.galleryPhotosService = GalleryPhotosService.getService();
this.compositeDisposable = compositeDisposable;
}
....
The error appear in this line :
this.galleryPhotosService = GalleryPhotosService.getService();
My gradle dependencies :
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 27
buildToolsVersion "27.0.0"
defaultConfig {
applicationId "com.app.seddik.yomii"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
retrolambdaConfig 'net.orfjackal.retrolambda:retrolambda:2.5.1'
// Support libraries
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:27.1.0'
compile 'com.android.support:support-v4:27.1.0'
// Retrofit
compile 'com.squareup.retrofit2:retrofit:2.4.0'
compile 'com.squareup.retrofit2:converter-gson:2.4.0'
compile 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
// Glide
compile 'com.github.bumptech.glide:glide:4.6.1'
compile 'com.github.bumptech.glide:compiler:4.6.1'
compile 'com.github.bumptech.glide:okhttp3-integration:4.6.1'
compile 'com.squareup.picasso:picasso:2.5.2'
// Others
compile 'com.github.chrisbanes:PhotoView:2.1.3'
compile 'com.github.varunest:sparkbutton:1.0.5'
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.andkulikov:transitionseverywhere:1.7.8'
compile 'jp.co.cyberagent.android.gpuimage:gpuimage-library:1.3.0'
compile 'com.zhihu.android:matisse:0.4.3'
compile 'com.seatgeek:placesautocomplete:0.3-SNAPSHOT'
compile 'id.zelory:compressor:2.1.0'
compile 'org.greenrobot:eventbus:3.1.1'
compile 'com.github.florent37:shapeofview:1.1.2'
// Firebase Messaging
compile 'com.google.firebase:firebase-messaging:17.1.0'
compile 'cn.pedant.sweetalert:library:1.3'
compile 'com.android.support:multidex:1.0.1'
//Google services
compile 'com.google.android.gms:play-services-location:15.0.0'
compile 'com.google.android.gms:play-services-places:15.0.0'
// find bugs
compile 'com.google.code.findbugs:jsr305:2.0.1'
// Timber for logging
compile 'com.jakewharton.timber:timber:4.6.1'
//Architecture Components
compile "android.arch.lifecycle:extensions:1.1.0"
//Paging
compile "android.arch.paging:runtime:1.0.1"
//Rx
compile 'io.reactivex.rxjava2:rxjava:2.2.0'
compile 'io.reactivex.rxjava2:rxandroid:2.1.0'
testCompile 'junit:junit:4.12'
}apply plugin: 'com.google.gms.google-services'
This my interface Retrofit Service :
public interface GalleryPhotosService {
// Retrofit services
static GalleryPhotosService getService() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(AppConfig.URL_UPLOAD_PHOTOS)
.addCallAdapterFactory(RxJava2CallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.build();
return retrofit.create(GalleryPhotosService.class);
}}
Related
I am getting error Unable to merge dex, try everything on stackoverflow
buildscript {
repositories {
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url 'https://maven.google.com' }
flatDir {
dirs 'libs'
}
mavenCentral()
}
def daggerVersion = '2.8'
android {
compileSdkVersion 28
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.upliftapp"
minSdkVersion 21
targetSdkVersion 28
versionCode 39
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
resConfigs "en"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
// shrinkResources = true
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
//force 'com.android.support:support-v4:27.1.0'
}
}
}
}
dexOptions {
javaMaxHeapSize "4g"
}
aaptOptions {
cruncherEnabled false
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile('com.twitter.sdk.android:twitter:1.14.1#aar') {
transitive = true;
}
compile('com.twitter.sdk.android:tweet-composer:1.0.5#aar') {
transitive = true;
}
compile project(':ViewPagerIndicator-Library')
compile project(':library_imageloading')
compile project(':ShortcutBadgerLib')
compile project(':CircleProgressView')
compile project(':StickyHeaderLibrary')
compile project(':VideoLibtoro')
compile project(':token_textview_library')
compile project(':swap_lib')
compile project(':library_parallaxeffect')
compile project(':curton_library')
compile project(':fullscreenvideoview')
compile project(':android-volley-master')
compile 'com.github.clans:fab:1.6.4'
compile "com.android.support:appcompat-v7:28.+"
compile 'com.android.support:design:28.+'
compile 'com.android.support:cardview-v7:28.+'
compile 'com.android.support:support-v4:28.+'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'com.android.support:recyclerview-v7:28.+'
compile 'com.facebook.fresco:fresco:0.9.0'
compile 'com.mixpanel.android:mixpanel-android:4.+'
compile 'com.facebook.android:facebook-android-sdk:4.35.0'
compile 'com.crittercism:crittercism-android-agent:+'
compile 'com.google.android.gms:play-services-base:+'
implementation 'com.google.android.gms:play-services-maps:+'
implementation 'com.google.android.gms:play-services-appindexing:+'
compile 'com.orhanobut:logger:1.15'
compile 'org.java-websocket:Java-WebSocket:1.3.0'
/*compile 'com.amazonaws:aws-android-sdk-s3:2.2.+'
compile 'com.amazonaws:aws-android-sdk-core:2.2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.2.+'*/
compile 'com.amazonaws:aws-android-sdk-s3:2.+'
compile 'com.amazonaws:aws-android-sdk-core:2.+'
compile 'com.amazonaws:aws-android-sdk-ddb:2.+'
compile 'com.google.code.gson:gson:2.6.2'
compile 'net.ypresto.androidtranscoder:android-transcoder:0.1.10'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.instabug.library:instabug:8.0.13'
compile 'org.jsoup:jsoup:1.8.3'
compile 'com.chauthai.swipereveallayout:swipe-reveal-layout:1.4.0'
compile 'com.github.stfalcon:frescoimageviewer:0.4.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.etsy.android.grid:library:1.+'
compile 'com.jpeng:LoadingProgress:1.1.0'
compile 'com.theartofdev:fast-image-loader:0.8.+'
compile 'com.android.support.constraint:constraint-layout:1.0.1'
compile 'com.android.support:multidex:1.0.1'
compile 'in.srain.cube:ultra-ptr:1.0.11'
testCompile 'junit:junit:4.12'
compile project(':library_scrollable')
compile 'io.branch.sdk.android:library:2.+'
compile 'com.appsflyer:af-android-sdk:4+#aar'
compile 'com.vdurmont:emoji-java:3.1.3'
compile project(':bettervideoplayer')
compile 'com.makeramen:roundedimageview:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:okhttp:3.8.0'
implementation project(':emojify_new')
compile 'org.apache.commons:commons-lang3:3.4'
compile 'com.github.nkzawa:socket.io-client:0.3.0'
implementation 'com.wowza.gocoder.sdk.android:com.wowza.gocoder.sdk:2.0#aar'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-iid:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
compile 'com.google.firebase:firebase-crash:9.4.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
error log
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Have you tried updaing your libraries? also drop the compile keyword and replace it with implementation
Unable to merge dex
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException:
com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
build.grandle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
// buildToolsVersion "27.1.1"
defaultConfig {
applicationId "com.osan.user.askprediction"
minSdkVersion 16
targetSdkVersion 27
versionCode 3
versionName "1.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation('com.payumoney.sdkui:plug-n-play:1.0.0') {
transitive = true;
exclude module: 'payumoney-sdk'
}
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.google.android.gms:play-services-places:15.0.0'
implementation 'com.google.firebase:firebase-messaging:15.0.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.payumoney.core:payumoney-sdk:7.0.1'
testCompile 'junit:junit:4.12'
implementation files('libs/okhttp-2.5.0.jar')
implementation files('libs/okio-1.6.0.jar')
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.paytm:pgplussdk:1.1.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
configurations {
all*.exclude group: 'com.android.volley'
}
apply plugin: 'com.google.gms.google-services'
try
android {
defaultConfig {
multiDexEnabled true
}
}
in your
app/build.gradle
Add this library in your dependencies too
compile 'com.android.support:multidex:1.0.1'
I'm trying to create a signed APK, but an error will appear at the end:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/design/widget/CoordinatorLayout$1.class
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
maven { url "https://github.com/omadahealth/omada-nexus/raw/master/release" }
maven { url "https://jitpack.io" }
}
dependencies {
}
}
android {
signingConfigs {
config {
}
}
lintOptions {
abortOnError false
}
dataBinding {
enabled = true
}
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.myandroidapp.android"
minSdkVersion 17
targetSdkVersion 27
versionCode 5
versionName "1.3"
multiDexEnabled true
}
buildTypes {
release {
ext.enableCrashlytics = true
//shrinkResources false
//minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
//debuggable false
//jniDebuggable false
signingConfig signingConfigs.config
//zipAlignEnabled true
}
debug {
//debuggable true
ext.enableCrashlytics = true
//minifyEnabled false
//shrinkResources false
//renderscriptDebuggable false
//jniDebuggable false
proguardFiles 'proguard-rules.txt'
//signingConfig signingConfigs.debug
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/**'
exclude 'META-INF/**'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
repositories {
mavenCentral()
jcenter()
}
android {
dexOptions {
jumboMode = true
javaMaxHeapSize "4g"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
// Navigation Drawer Library
compile('com.mikepenz:materialdrawer:5.3.0#aar') {
transitive = true
}
//Google, Inc (Play services) Libraries
implementation 'com.google.android.gms:play-services-places:11.8.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services-ads:11.8.0'
implementation 'com.google.android.gms:play-services-auth:11.8.0'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-appindexing:11.8.0'
implementation 'com.google.android.gms:play-services-appinvite:11.8.0'
//Google, Inc (Firebase) Libraries
implementation 'com.firebase:firebase-jobdispatcher:0.6.0'
implementation 'com.firebaseui:firebase-ui-database:2.3.0'
implementation 'com.firebase:geofire-android:2.1.2'
// Google, Inc (Support) Libraries
implementation 'com.android.support:support-v13:27.0.2'
//implementation 'com.android.support:customtabs:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:support-v4:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:multidex:1.0.2'
implementation 'com.android.support:palette-v7:27.0.2'
implementation 'com.android.support:support-vector-drawable:27.0.2'
//implementation 'com.android.support.constraint:constraint-layout:1.0.2'
// Facebook, Inc SDKs
implementation 'com.facebook.android:facebook-android-sdk:4.29.0'
// Libraries for images
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.github.bumptech.glide:glide:3.8.0'
implementation 'com.lorentzos.swipecards:library:1.0.9'
implementation 'com.skyfishjy.ripplebackground:library:1.0.1'
implementation 'com.vanniktech:emoji-twitter:0.5.1'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.github.yalantis:ucrop:2.2.1'
implementation 'com.github.jkwiecien:EasyImage:1.3.1'
implementation 'jp.wasabeef:picasso-transformations:2.1.2'
implementation 'com.squareup.picasso:picasso:2.5.2'
// Location Helper Library
implementation 'com.squareup.retrofit2:retrofit:2.2.0'
implementation 'com.squareup.retrofit:converter-gson:2.0.0-beta1'
// Time library
implementation 'joda-time:joda-time:2.9.9'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
// Others
// event bus
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.flipboard:bottomsheet-core:1.5.3'
implementation 'com.flipboard:bottomsheet-commons:1.5.3'
implementation 'com.greysonparrelli.permiso:permiso:0.3.0'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.5.2'
implementation 'com.airbnb.android:lottie:2.2.5'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
apply plugin: 'com.google.gms.google-services'
This may be due to different versions of the support library being used.
Add the following in your build.gradle
configurations.all {
resolutionStrategy {
force 'com.android.support:design:27.0.2'
force 'com.android.support:support-v4:27.0.2'
force 'com.android.support:appcompat-v7:27.0.2'
}
}
i read more solutions about this problem but my problem couldn't resolve. its happened after add more library such Dagger and Realm on my project
Full stack error:
java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/internal/widget/TintManager;
at android.support.design.widget.TabLayout$TabView.<init>(TabLayout.java:1179)
at android.support.design.widget.TabLayout.createTabView(TabLayout.java:655)
at android.support.design.widget.TabLayout.addTabView(TabLayout.java:690)
at android.support.design.widget.TabLayout.addTab(TabLayout.java:385)
at android.support.design.widget.TabLayout.addTab(TabLayout.java:360)
at android.support.design.widget.TabLayout.setTabsFromPagerAdapter(TabLayout.java:644)
at android.support.design.widget.TabLayout.setupWithViewPager(TabLayout.java:615)
UPDATED:
My gradle file content :
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'realm-android'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.pishguy.androidapplication.xxx"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
project.ext {
supportVersion = '24.2.1'
daggerVersion = '2.0.1'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile("com.android.support:support-v4:$supportVersion") {
force = true;
}
compile "com.android.support:appcompat-v7:$supportVersion"
compile 'io.reactivex:rxandroid:1.2.1'
compile 'io.reactivex:rxjava:1.1.6'
compile 'com.jakewharton.rxbinding:rxbinding-appcompat-v7:0.4.0'
compile 'com.jakewharton.rxbinding:rxbinding-design:0.4.0'
compile 'com.jakewharton:butterknife:8.2.1'
apt 'com.jakewharton:butterknife-compiler:8.2.1'
compile('io.socket:socket.io-client:0.7.0') {
exclude group: "org.json", module: "json"
}
compile('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.bugsnag:bugsnag-android:+'
compile 'com.facebook.rebound:rebound:0.3.8'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.jaredrummler:android-device-names:1.0.9'
compile 'org.sufficientlysecure:html-textview:1.6'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.kogitune:pre-lollipop-activity-transition:1.3.0'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.alexvasilkov:foldable-layout:1.2.0'
compile 'cat.ereza:customactivityoncrash:1.5.0'
compile 'com.github.hotchemi:permissionsdispatcher:2.1.3'
apt 'com.github.hotchemi:permissionsdispatcher-processor:2.1.3'
compile 'com.github.goka.flickableview:flickableview:1.0.0'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.github.justzak:dilatingdotsprogressbar:1.0.1'
compile('de.keyboardsurfer.android.widget:crouton:1.8.5#aar') {
exclude group: 'com.google.android', module: 'support-v4'
}
compile 'com.h6ah4i.android.materialshadowninepatch:materialshadowninepatch:0.6.5'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.tumblr:backboard:0.1.0'
compile "com.google.dagger:dagger:${daggerVersion}"
apt "com.google.dagger:dagger-compiler:${daggerVersion}"
provided 'javax.annotation:javax.annotation-api:1.2'
compile project(':lib-searchview')
}
how can i resolve this problem?
Replace
compile("com.android.support:support-v4:${supportPackageVersion}") {
force = true;
}
compile "com.android.support:appcompat-v7:${supportPackageVersion}"
with
compile 'com.android.support:appcompat-v7:23.1.1'
May be it will help you.
Support library versions from RxBinding:
supportVersion = '24.2.1'
supportAnnotations = "com.android.support:support-annotations:$supportVersion"
supportV4CoreUi = "com.android.support:support-core-ui:$supportVersion"
supportRecyclerView = "com.android.support:recyclerview-v7:$supportVersion"
supportAppCompat = "com.android.support:appcompat-v7:$supportVersion"
supportDesign = "com.android.support:design:$supportVersion"
supportLeanback = "com.android.support:leanback-v17:$supportVersion"
Your current build.gradle support version:
project.ext {
supportPackageVersion = '24.0.0'
You should update to 24.2.1.
in my application i want to use this below pasted code as PicassoCache, but after use that such as :
PicassoCache.getPicassoInstance(context)
.load(list.get(position).getStoreImage())
.placeholder(R.drawable.ic_messages)
.into(holder.store_avatar);
i get this error:
Could not find class 'com.squareup.okhttp.CacheControl$Builder', referenced from method com.squareup.picasso.OkHttpDownloader.load
06-12 01:13:17.484 6246-6246/ir.pishguy.signalpresentationproject E/AndroidRuntime: FATAL EXCEPTION:
main java.lang.NoClassDefFoundError: com.squareup.okhttp.OkHttpClient
PicassoCache:
import com.squareup.picasso.Downloader;
import com.squareup.picasso.OkHttpDownloader;
import com.squareup.picasso.Picasso;
public class PicassoCache {
private static Picasso picassoInstance = null;
private PicassoCache(Context context) {
Downloader downloader = new OkHttpDownloader(context, Integer.MAX_VALUE);
Picasso.Builder builder = new Picasso.Builder(context);
builder.downloader(downloader);
picassoInstance = builder.build();
}
public static Picasso getPicassoInstance(Context context) {
if (picassoInstance == null) {
new PicassoCache(context);
return picassoInstance;
}
return picassoInstance;
}
}
My gradle:
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
apply plugin: 'android-command'
apply plugin: 'realm-android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "ir.pishguy.signalpresentationproject"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
command {
events 2000
}
lintOptions {
disable 'InvalidPackage'
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
ext {
supportLibVersion = '23.4.0'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile 'com.squareup.picasso:picasso:2.5.2'
compile('io.socket:socket.io-client:0.7.0')
{
// excluding org.json which is provided by Android
exclude group: "org.json", module: "json"
}
compile ('com.squareup.retrofit2:retrofit:2.0.2'){
exclude module:'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.0.0-beta4'
compile 'com.squareup.okhttp3:okhttp:3.3.1'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.github.devlight.navigationtabbar:library:+'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile "de.hdodenhof:circleimageview:2.0.0"
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.2.2'
compile "com.balysv:material-ripple:1.0.2"
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.github.chyrta:AndroidOnboarder:+'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.android.support:multidex:1.0.1'
}
For me combination
// Retrofit
compile('com.squareup.retrofit2:retrofit:2.0.2') {
exclude module: 'okhttp'
}
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
// Picasso
compile 'com.squareup.picasso:picasso:2.5.2'
works well, but here some answers said that
compile 'com.squareup.okhttp:okhttp-urlconnection:x.x.x'
may help.
Try the following combination, it's working for me :
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
Hope it will work for you :)