NoClassDefFoundError on Android release build - android

I'm using Dagger 2 and proguard, and one of my users gets a NoClassDefFoundError when he attempts to open the app after installing from the PlayStore. He's using KitKat, Samsung TabS. I'm at a loss here. What could be going wrong?
Here are my dependencies:
compile rootProject.ext.kotlinStdLib
kapt rootProject.ext.dataBindingCompiler
compile rootProject.ext.cardView
compile rootProject.ext.design
compile rootProject.ext.appCompat
compile rootProject.ext.hockeyApp
compile rootProject.ext.rxAndroid
compile rootProject.ext.everNoteJob
compile rootProject.ext.gpsServices
compile rootProject.ext.dagger
kapt rootProject.ext.daggerCompiler
provided rootProject.ext.javax
compile rootProject.ext.retrofit
compile rootProject.ext.retrofitRxJava
compile rootProject.ext.retrofitGson
compile rootProject.ext.okHttp
debugCompile rootProject.ext.okHttpLogger
debugCompile rootProject.ext.leakCanary
compile rootProject.ext.rxJava2
testCompile rootProject.ext.junit
testCompile rootProject.ext.assertj
testCompile rootProject.ext.mockitoKotlin
testCompile rootProject.ext.roboElectric
testCompile rootProject.ext.kotlinStdLib
androidTestCompile rootProject.ext.mockitoKotlin
androidTestCompile rootProject.ext.kotlinReflect
androidTestCompile rootProject.ext.kotlinStdLib
androidTestCompile rootProject.ext.espresso
androidTestCompile rootProject.ext.espressoIntents
androidTestCompile rootProject.ext.espressoTestRunner
androidTestCompile rootProject.ext.findBugs
androidTestCompile rootProject.ext.dexMaker
androidTestCompile rootProject.ext.uiAutomator
And their versions:
buildToolsVersion = "25.0.2"
jdkVersion = '1.8'
minSdkVersion = 19
targetSdkVersion = 25
compileSdkVersion = 25
kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib-jre7:${kotlin_version}"
kotlinReflect = "org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"
androidSupportVersion = '25.4.0'
daggerVersion = '2.9'
hockeyApp = "net.hockeyapp.android:HockeySDK:4.1.3"
appCompat = "com.android.support:appcompat-v7:${androidSupportVersion}"
design = "com.android.support:design:${androidSupportVersion}"
cardView = "com.android.support:cardview-v7:${androidSupportVersion}"
dagger = "com.google.dagger:dagger:${daggerVersion}"
daggerCompiler = "com.google.dagger:dagger-compiler:${daggerVersion}"
rxAndroid = "io.reactivex.rxjava2:rxandroid:2.0.1"
javax = "javax.annotation:jsr250-api:1.0"
dataBindingCompiler = "com.android.databinding:compiler:$gradle_plugin_version"
threeTenAbp = "com.jakewharton.threetenabp:threetenabp:1.0.5"
everNoteJob = "com.evernote:android-job:1.1.11"
gpsServices = "com.google.android.gms:play-services-gcm:11.0.1"
leakCanary = "com.squareup.leakcanary:leakcanary-android:1.5.1"
retrofitVersion = '2.2.0'
okhttpVersion = '3.7.0'
retrofit = "com.squareup.retrofit2:retrofit:${retrofitVersion}"
retrofitRxJava = "com.squareup.retrofit2:adapter-rxjava2:${retrofitVersion}"
retrofitGson = "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
okHttp = "com.squareup.okhttp3:okhttp:${okhttpVersion}"
okHttpLogger = "com.squareup.okhttp3:logging-interceptor:${okhttpVersion}"
rxJava2 = "io.reactivex.rxjava2:rxjava:2.1.0"
powerMockVersion = '2.0.0-beta.5'
junit = "junit:junit:4.12"
mockitoKotlin = "com.nhaarman:mockito-kotlin:1.5.0"
assertj = "org.assertj:assertj-core:3.6.2"
roboElectric = "org.robolectric:robolectric:3.3.2"
espresso = "com.android.support.test.espresso:espresso-core:3.0.1"
espressoIntents = "com.android.support.test.espresso:espresso-intents:3.0.1"
espressoIdler = "com.android.support.test.espresso.idling:idling-concurrent:3.0.0"
espressoTestRunner = "com.android.support.test:runner:1.0.1"
dexMaker = "com.linkedin.dexmaker:dexmaker-mockito:2.2.0"
uiAutomator = "com.android.support.test.uiautomator:uiautomator-v18:2.1.3"
findBugs = "com.google.code.findbugs:jsr305:3.0.2"
Is there anything I'm doing wrong here?

Related

Android resource linking fail in Android -3.1.24?

I am Work on MVVM module app and Getting error : - C:\Users\123.gradle\caches\transforms-2\files-2.1\67afe2b5b1b4fe8a866b1004d9b96c04\core-1.7.0\res\values\values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.
I have use this dependencies : -
dependencies {
implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
// Dependencies for working with Architecture components
// You'll probably have to update the version numbers in build.gradle (Project)
// Room components
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"
androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-viewmodel:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$rootProject.lifecycleVersion"
// UI
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constraintLayoutVersion"
implementation "com.google.android.material:material:$rootProject.materialVersion"
// Testing
testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion"
androidTestImplementation("androidx.test.espresso:espresso-core:$rootProject.espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation "androidx.test.ext:junit:$rootProject.androidxJunitVersion"
}
Virsion is
ext {
appCompatVersion = '1.3.0'
constraintLayoutVersion = '2.0.4'
coreTestingVersion = '2.1.0'
lifecycleVersion = '2.3.1'
materialVersion = '1.3.0'
roomVersion = '2.3.0'
// testing
junitVersion = '4.13.2'
espressoVersion = '3.1.0'
androidxJunitVersion = '1.1.2'
}

Cannot access androidx.lifecycle.HasDefaultViewModelProviderFactory - Library Module Warning

Getting -> Cannot access androidx.lifecycle.HasDefaultViewModelProviderFactory Warning On Library Module Activity Class.
Gradle Dependencies:
dependencies {
// debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
implementation "com.airbnb.android:epoxy:$rootProject.epoxyVersion"
implementation "com.airbnb.android:epoxy-databinding:$rootProject.epoxyVersion"
annotationProcessor "com.airbnb.android:epoxy-processor:$rootProject.epoxyVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.appcompat:appcompat:$rootProject.appCompatVersion"
implementation "se.emilsjolander:StickyScrollViewItems:$rootProject.StickyScrollViewItemsVersion"
implementation "androidx.constraintlayout:constraintlayout:$rootProject.constrainlayout_version"
implementation "com.google.firebase:firebase-analytics:$rootProject.firebase_core_version"
implementation "com.google.firebase:firebase-messaging:$rootProject.firebase_messaging_version"
implementation "com.crashlytics.sdk.android:crashlytics:$rootProject.crashlytics_version"
implementation "com.google.firebase:firebase-analytics:$rootProject.firebase_core_version"
implementation "com.google.firebase:firebase-config:$rootProject.firebase_config"
implementation "com.squareup.retrofit2:retrofit:$rootProject.retrofit_version"
implementation "com.google.code.gson:gson:$rootProject.gson_version"
implementation "com.squareup.okhttp3:okhttp:$rootProject.okhttp_version"
implementation "com.squareup.retrofit2:converter-gson:$rootProject.retrofit_converter_version"
implementation "com.squareup.retrofit2:converter-scalars:$rootProject.retrofit_converter_version"
implementation "com.squareup.okhttp3:logging-interceptor:$rootProject.okhttp_version"
implementation "com.squareup.retrofit2:adapter-rxjava2:$rootProject.retrofit_version"
implementation "com.jakewharton:butterknife:$rootProject.butterknife_version"
annotationProcessor "com.jakewharton:butterknife-compiler:$rootProject.butterknife_version"
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation "androidx.cardview:cardview:$rootProject.card_view_version"
implementation "androidx.legacy:legacy-support-v4:$rootProject.legacy_support_version"
implementation "androidx.recyclerview:recyclerview:$rootProject.recyclerview_version"
implementation "com.android.volley:volley:$rootProject.volley_version"
implementation "com.github.bumptech.glide:glide:$rootProject.glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$rootProject.glide_version"
implementation "com.facebook.shimmer:shimmer:$rootProject.facebook_shimmer_version"
implementation "androidx.gridlayout:gridlayout:$rootProject.grid_layout_version"
implementation "com.github.badoualy:stepper-indicator:$rootProject.stepper_indicator"
implementation "androidx.browser:browser:$rootProject.browser_version"
implementation "com.github.MikeOrtiz:TouchImageView:$rootProject.touch_imageview_version"
implementation "com.orhanobut:logger:$rootProject.orhanobut_logger"
implementation "androidx.multidex:multidex:$rootProject.multidex_version"
implementation "com.google.dagger:dagger:$rootProject.dagger2Version"
annotationProcessor "com.google.dagger:dagger-compiler:$rootProject.dagger2Version"
annotationProcessor "com.google.dagger:dagger-android-processor:$rootProject.dagger2Version"
implementation "com.google.dagger:dagger-android-support:$rootProject.dagger2Version"
implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.lifecycleVersion"
implementation "androidx.lifecycle:lifecycle-common-java8:$rootProject.lifecycleVersion"
implementation "com.ethanhua:skeleton:$rootProject.skeleton_version"
implementation "io.supercharge:shimmerlayout:$rootProject.shimmerlayout_version"
implementation "org.igniterealtime.smack:smack-android-extensions:$rootProject.smack_version"
implementation "org.igniterealtime.smack:smack-tcp:$rootProject.smack_version"
implementation "org.igniterealtime.smack:smack-extensions:$rootProject.smack_version"
implementation "org.igniterealtime.smack:smack-android:$rootProject.smack_version"
implementation "org.igniterealtime.smack:smack-experimental:$rootProject.smack_version"
implementation "com.vanniktech:emoji:$rootProject.emoji_version"
implementation "com.vanniktech:emoji-google:$rootProject.emoji_version"
implementation "com.amulyakhare:com.amulyakhare.textdrawable:$rootProject.text_drawable_version"
implementation "de.hdodenhof:circleimageview:$rootProject.circle_image_view_version"
implementation "org.jsoup:jsoup:$rootProject.jsoup_version"
implementation "com.squareup.picasso:picasso:$rootProject.picasso_version"
implementation "androidx.room:room-runtime:$rootProject.room_version"
annotationProcessor "androidx.room:room-compiler:$rootProject.room_version"
// optional - RxJava support for Room
implementation "androidx.room:room-rxjava2:$rootProject.room_version"
implementation "io.reactivex.rxjava2:rxandroid:$rootProject.rx_android_version"
// Test helpers
implementation "com.github.smart-fun:XmlToJson:$rootProject.xml_to_json_version"
implementation "androidx.navigation:navigation-fragment:$rootProject.navigation_version"
implementation "androidx.navigation:navigation-ui:$rootProject.navigation_version"
implementation "net.opacapp:multiline-collapsingtoolbar:$rootProject.collapsing_toolbar_version"
implementation "androidx.viewpager2:viewpager2:$rootProject.viewpager2_version"
implementation "com.google.android.material:material:$rootProject.material_version"
implementation "androidx.transition:transition:$rootProject.transition_version"
implementation "androidx.paging:paging-runtime:$rootProject.paging_version"
implementation project(":evalyPaymentLibrary")
implementation project(path: ':richlinkpreview')
configurations {
all*.exclude group: 'xpp3', module: 'xpp3'
}
}
Versions
ext{
dagger2Version = '2.16'
lifecycleVersion = '2.2.0'
epoxyVersion = '3.9.0'
appCompatVersion = '1.1.0'
xml_to_json_version = '1.4.5'
room_version = '2.2.5'
rx_android_version = '2.1.1'
circle_image_view_version = '3.1.0'
emoji_version = '0.6.0'
smack_version = '4.3.0'
shimmerlayout_version = '2.1.0'
skeleton_version = '1.1.2'
multidex_version = '2.0.1'
gson_version = '2.8.6'
logger_version = '2.2.0'
touch_imageview_version = '2.2.0'
facebook_core_version = '5.0.0'
finestwebview_version = '1.2.7'
stepper_indicator = '1.0.7'
android_support_version = '28.0.0'
facebook_shimmer_version = '0.5.0'
glide_version = '4.11.0'
volley_version = '1.1.1'
espresso_core_version = '3.0.2'
runner_version = '1.0.2'
butterknife_version = '8.1.0'
loggin_interceptor_version = '3.10.0'
retrofit_converter_version = '2.7.1'
okhttp_version = '4.4.0'
retrofit_version = '2.7.1'
crashlytics_version = '2.10.1'
firebase_messaging_version = '20.1.7'
firebase_core_version = '17.4.4'
firebase_config = '19.1.4'
constrainlayout_version = '1.1.3'
StickyScrollViewItemsVersion = '1.0.0'
card_view_version = '1.0.0'
legacy_support_version = '1.0.0'
recyclerview_version = '1.1.0'
grid_layout_version = '1.0.0'
browser_version = '1.0.0'
orhanobut_logger = '2.2.0'
text_drawable_version = '1.0.1'
jsoup_version = '1.11.3'
picasso_version = '2.71828'
navigation_version = '2.3.0'
collapsing_toolbar_version = '27.1.1'
viewpager2_version = '1.0.0'
material_version = '1.3.0-alpha01'
transition_version = '1.3.1'
paging_version = '2.1.2'
}
Tried Invalidates Caches Android Studio Multiple Time. No Good Luck.
My project is running up-to-date, I am using Android Studio 4.0.
My Project Structure is As Default ->
my_project
-app
-myLibrary
-anotherLibrary

java.lang.NoSuchMethodError: No static method

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);
}}

Context and Resource in Android Instrumented Unit Tests

I'm designing a system with some not-so-simple classes that require a Context object in order to initialize them. These classes make use of third party classes which also require context initialization. This class also utilizes the context to load a number of string resources necessary to the functionality.
The problem comes with writing Instrumented Unit tests for these classes. When I attempt to get a Context object for the test using InstrumentationRegistry.getContext(), I run into an exception where the context cannot find the string resources associated with the class (android.content.res.Resources$NotFoundException).
My question is this: How can I design these tests so that the context can retrieve the string resources that I need, and also act as suitable context objects for the third party classes? There's only so much mocking I can do as some of these classes handle auth tokens, which would be difficult to mock. I can't be the only person who's run into this issue in the Android domain, so I'm sure there's a common solution for this presumably common problem.
EDIT:
As suggested, I've tried integrating Robolectric (version 3.3.2) in my Project, however when I try and run my unit tests I'm met with the following error:
Error:Error converting bytecode to dex:
Cause: Dex cannot parse version 52 byte code.
This is caused by library dependencies that have been compiled using Java 8 or above.
If you are using the 'java' gradle plugin in a library submodule add
targetCompatibility = '1.7'
sourceCompatibility = '1.7'
to that submodule's build.gradle file.
I've tried adding the targetCompatibility and sourceCompatibility lines to my gradle files (in several locations) to no avail.
Here's my mobile build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'checkstyle'
apply plugin: 'io.fabric'
project.ext {
supportLibVersion = '25.3.0'
multiDexSupportVersion = '1.0.1'
gsonVersion = '2.8.0'
retrofitVersion = '2.2.0'
daggerVersion = '2.4'
butterKnifeVersion = '8.5.1'
eventBusVersion = '3.0.0'
awsCoreServicesVersion = '2.2.+'
twitterKitVersion = '2.3.2#aar'
facebookVersion = '4.+'
crashlyticsVersion = '2.6.7#aar'
autoValueVersion = '1.2'
autoValueParcelVersion = '0.2.5'
autoValueGsonVersion = '0.4.4'
permissionDispatcher = '2.2.0'
testRunnerVersion = '0.5'
espressoVersion = '2.2.2'
junitVersion = '4.12'
roboelectricVersion = '3.3.2'
}
def gitSha = exec('git rev-parse --short HEAD', "unknown");
def gitCommitCount = 100 + Integer.parseInt(exec('git rev-list --count HEAD', "-1"))
def gitTag = exec('git describe --tags', stringify(gitCommitCount))
def gitTimestamp = exec('git log -n 1 --format=%at', -1)
def appId = "com.example.myapp"
def isCi = "true".equals(System.getenv("CI"))
// Uncomment if you wish to enable Jack & Java8
// apply from: 'jack.gradle'
// Uncomment if you wish to enable Sonar
//apply from: 'sonar.gradle'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId appId
minSdkVersion 16
targetSdkVersion 25
multiDexEnabled = true
versionCode gitCommitCount
versionName gitTag
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildConfigField 'String', 'GIT_SHA', "\"${gitSha}\""
buildConfigField 'long', 'GIT_TIMESTAMP', "${gitTimestamp}L"
}
buildTypes {
debug {
applicationIdSuffix '.debug'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
qa.initWith(buildTypes.release)
qa {
applicationIdSuffix '.qa'
debuggable true
}
}
lintOptions {
abortOnError false
}
applicationVariants.all { variant ->
def strictMode = !variant.name.equals("release")
buildConfigField 'boolean', 'STRICT_MODE_ENABLED', "${strictMode}"
}
}
configurations.all {
resolutionStrategy {
force "com.android.support:support-annotations:$supportLibVersion"
force "com.squareup.okhttp3:okhttp:3.4.1"
force "com.squareup:okio:1.9.0"
force "com.google.guava:guava:19.0"
}
}
dependencies {
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.android.support:design:$supportLibVersion"
compile "com.android.support:recyclerview-v7:$supportLibVersion"
compile "com.android.support:cardview-v7:$supportLibVersion"
compile "com.android.support:multidex:$multiDexSupportVersion"
compile "com.squareup.retrofit2:retrofit:$retrofitVersion"
compile "com.squareup.retrofit2:converter-gson:$retrofitVersion"
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.jakewharton.timber:timber:4.3.1'
compile "com.jakewharton:butterknife:$butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
compile "org.greenrobot:eventbus:$eventBusVersion"
annotationProcessor "org.greenrobot:eventbus:$eventBusVersion"
compile 'io.reactivex.rxjava2:rxandroid:2.0.0'
debugCompile 'com.squareup.okhttp3:logging-interceptor:3.4.2'
compile "com.google.auto.value:auto-value:$autoValueVersion"
annotationProcessor "com.google.auto.value:auto-value:$autoValueVersion"
compile "com.ryanharter.auto.value:auto-value-parcel-adapter:$autoValueParcelVersion"
annotationProcessor "com.ryanharter.auto.value:auto-value-parcel:$autoValueParcelVersion"
compile "com.github.hotchemi:permissionsdispatcher:$permissionDispatcher"
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissionDispatcher"
compile("com.crashlytics.sdk.android:crashlytics:$crashlyticsVersion") {
transitive = true;
}
compile("com.twitter.sdk.android:twitter:$twitterKitVersion") {
transitive = true
}
compile "com.facebook.android:facebook-android-sdk:$facebookVersion"
compile "com.amazonaws:aws-android-sdk-core:$awsCoreServicesVersion"
annotationProcessor "com.amazonaws:aws-android-sdk-core:$awsCoreServicesVersion"
compile "com.amazonaws:aws-android-sdk-apigateway-core:$awsCoreServicesVersion"
annotationProcessor "com.amazonaws:aws-android-sdk-apigateway-core:$awsCoreServicesVersion"
compile "com.amazonaws:aws-android-sdk-cognito:$awsCoreServicesVersion"
annotationProcessor "com.amazonaws:aws-android-sdk-cognito:$awsCoreServicesVersion"
compile "com.amazonaws:aws-android-sdk-cognitoidentityprovider:$awsCoreServicesVersion"
annotationProcessor "com.amazonaws:aws-android-sdk-cognitoidentityprovider:$awsCoreServicesVersion"
compile "com.amazonaws:aws-android-sdk-lambda:$awsCoreServicesVersion"
annotationProcessor "com.amazonaws:aws-android-sdk-lambda:$awsCoreServicesVersion"
compile "com.amazonaws:aws-android-sdk-sns:$awsCoreServicesVersion"
annotationProcessor "com.amazonaws:aws-android-sdk-sns:$awsCoreServicesVersion"
androidTestCompile "junit:junit:$junitVersion"
androidTestCompile "com.android.support.test:runner:$testRunnerVersion"
androidTestCompile "com.android.support.test:rules:$testRunnerVersion"
androidTestCompile "com.android.support.test.espresso:espresso-intents:$espressoVersion"
androidTestCompile "com.android.support.test.espresso:espresso-core:$espressoVersion"
androidTestCompile "com.squareup.retrofit2:retrofit-mock:$retrofitVersion"
androidTestCompile "org.robolectric:robolectric:$roboelectricVersion"
testCompile "junit:junit:$junitVersion"
testCompile 'com.google.truth:truth:0.30'
testCompile 'org.hamcrest:hamcrest-all:1.3'
testCompile "org.robolectric:robolectric:$roboelectricVersion"
}
task checkCodingStyle(type: Checkstyle) {
description 'Runs Checkstyle inspection against Android sourcesets.'
group = 'Code Quality'
ignoreFailures = false
showViolations = false
source 'src'
include '**/*.java'
exclude '**/gen/**'
exclude '**/R.java'
exclude '**/BuildConfig.java'
reports {
xml.destination "$project.buildDir/reports/checkstyle/report.xml"
}
classpath = files()
configFile = file("${rootProject.rootDir}/config/checkstyle/checkstyle.xml")
}
def stringify(int versionCode) {
def builder = new StringBuilder();
def dot = ""
String.format("%03d", versionCode).toCharArray().each {
builder.append(dot)
builder.append(it)
dot = "."
}
return builder.toString()
}
def exec(String command, Object fallback = null) {
def cmd = command.execute([], project.rootDir)
cmd.waitFor()
if (cmd.exitValue() != 0) {
if (fallback == null) {
throw new RuntimeException("'$command' failed: $cmd.errorStream.text")
} else {
return fallback
}
}
return cmd.text.trim()
}
if (isCi) {
build.finalizedBy(checkCodingStyle)
}
The accepted answer is not the actual solution. There are many cases when you want to test your interaction with a real Android framework. Robolectric, as any other stub, may hide some actual issues.
Your problem is that you use InstrumentationRegistry.getContext() that is not the same that your app uses. According to docs:
Return the Context of this instrumentation's package.
And you should have used InstrumentationRegistry.getTargetContext() instead:
Return a Context for the target application being instrumented.
Because it, in the contrary to the first, will have access to your resourses.

Android get Failed resolution of: Landroid/support/v7/internal/widget/TintManager

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.

Categories

Resources