How to solve "Cannot access androidx.activity.contextaware.ContextAware'"? - android

I'm building a simple application using LiveData and viewmodels but iam getting the following warning messages in my activity surrodning my activity some of the warning
Cannot access 'androidx.activity.contextaware.ContextAware' which is a supertype of 'com.example.movies.presentation.home.MoviesActivity'. Check your module classpath for missing or conflicting dependencies
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$life_cycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$life_cycle_version"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
kapt "androidx.lifecycle:lifecycle-compiler:$life_cycle_version"
// Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$life_cycle_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
//moshi
implementation("com.squareup.moshi:moshi:$moshi_version")
kapt("com.squareup.moshi:moshi-kotlin-codegen:$moshi_version")
//retrofit
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
implementation("com.squareup.okhttp3:logging-interceptor:$okhttp_version")
//espresso testing
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_core"
androidTestImplementation "androidx.test:runner:$test_runner"
androidTestImplementation "androidx.test:rules:$test_runner"
// Hilt For instrumentation tests
androidTestImplementation "com.google.dagger:hilt-android-testing:$hilt_testing"
androidTestAnnotationProcessor "com.google.dagger:hilt-compiler:$hilt_testing"
//Hilt For local unit tests
testImplementation "com.google.dagger:hilt-android-testing:$hilt_testing"
testAnnotationProcessor "com.google.dagger:hilt-compiler:$hilt_testing"
//mockk for testing
testImplementation "io.mockk:mockk:$mockk_version"
//coroutine testing
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutine_test_version"
testImplementation("org.junit.jupiter:junit-jupiter-api:$junit_5")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junit_5")
testImplementation "android.arch.core:core-testing:$arch_version"
my module build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.31"
ext.hilt_version = '2.31.2-alpha'
ext.junit = '1.7.1.1'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "de.mannodermaus.gradle.plugins:android-junit5:$junit"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
life_cycle_version = "2.2.0"
espresso_core = "3.3.0"
test_runner = "1.3.0"
hilt_testing = "2.33-beta"
moshi_version = "1.10.0"
mockk_version = "1.11.0"
retrofit_version = "2.9.0"
okhttp_version = "4.9.0"
coroutine_test_version = "1.4.3"
junit_5 = "5.7.1"
arch_version = "2.2.0"
}

It was resolved when I added the activity jetpack module to the gradle file
def activity_version = "1.2.2"
// Java language implementation
implementation "androidx.activity:activity:$activity_version"
// Kotlin
implementation "androidx.activity:activity-ktx:$activity_version"

I got rid of this error message by upgrading the appCompat library to the latest version from 1.2.0 to 1.3.0-rc01.

Related

Gradle failed to update dependencies in Android Studio

I am trying to update dependencies in build.gradle , but they fail to update and a message like this is always shown
Failed to resolve: ***********
Unresolved dependencies
Could not resolve**************
Note:
No proxy is set
Offline Mode is disabled
When I try to update the dependencies , it starts downloading and after some minutes, it shows an error message ..
I tried to change proxy settings to Auto-Detect , but the same problem keeps occurring
Please help
ext {
var = '54642664'
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
buildscript {
repositories {
google()
mavenCentral()
}
}
allprojects {
repositories {
google()
mavenCentral()
maven{ url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
repositories {
mavenCentral()
}
android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
bundle{
language{
enableSplit = false
}
}
defaultConfig {
applicationId "com.afeefinc.electricityinverter"
minSdkVersion 19
targetSdkVersion 32
versionCode 101
versionName "3.9.20"
multiDexEnabled true
resConfigs 'en', 'ar', 'es', 'tr', 'hi', 'ru', 'fr', 'fil', 'zh', 'fa', 'bn', 'de', 'in', 'ur', 'af', 'pt', 'it', 'my', 'uk', 'ro', 'el', 'vi', 'th', 'ja', 'iw', 'ku', 'ko', 'nl'
//Define languages that your app supports.
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'com.afeefinc.electricityinverter'
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.5.0'
implementation 'androidx.navigation:navigation-ui:2.5.0'
implementation 'org.jetbrains:annotations:22.0.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.github.philJay:MPandroidChart:v3.1.0'
implementation 'com.google.firebase:firebase-inappmessaging-display'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-firestore'
implementation 'com.google.firebase:firebase-auth'
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.gms:play-services-ads:21.0.0'
implementation("com.android.billingclient:billing:5.0.0")
implementation 'com.google.firebase:firebase-dynamic-module-support:16.0.0-beta02'
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime:2.5.0"
annotationProcessor "androidx.lifecycle:lifecycle-common-java8:2.5.0"
implementation 'com.anjlab.android.iab.v3:library:2.0.0'
implementation 'androidx.work:work-runtime-ktx:2.8.0-alpha02'
implementation 'com.github.bumptech.glide:glide:4.13.0'
implementation 'com.google.firebase:firebase-analytics'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.0'
implementation 'com.github.jd-alexander:LikeButton:0.2.3'
// annotationProcessor "androidx.lifecycle:lifecycle-compiler:2.4.1"
implementation "android.arch.lifecycle:common-java8:1.1.1"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5

The app was built in API level 28. Current Android Studio version is 2021.2.1.
Now I have migrated the old code to Androidx. Gradle plugin and all the dependencies are updated properly but getting this following error on build :
"Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//ext.kotlin_version = '1.7.0'
repositories {
google()
//jcenter()
mavenCentral()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'com.google.gms:google-services:4.3.12'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
//jcenter()
mavenCentral()
//maven { url 'https://jitpack.io' }
maven { url 'https://maven.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
buildscript {
repositories {
maven { url 'https://jitpack.io' }
google()
}
dependencies {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.crashlytics'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.gms.google-services'
App Level: build.gradle
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.fetch.fetch"
minSdkVersion 18
targetSdkVersion 30
versionCode 8
versionName "1.7"
multiDexEnabled true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
buildToolsVersion '30.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.1'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
//tabindicator
implementation 'me.relex:circleindicator:1.2.2#aar'
//rating bar
implementation 'com.iarcuschin:simpleratingbar:0.1.5'
//design
implementation 'com.google.android.material:material:1.0.0'
//Country code picker
implementation project(':ccp')
//otp Library
//implementation 'com.github.aabhasr1:OtpView:1.0.6'
implementation 'com.github.aabhasr1:OtpView:1.0.5'
//butterknife
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
//retofit
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.2.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.squareup.retrofit2:converter-jackson:2.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.12.0'
implementation 'com.squareup.okhttp:okhttp:2.3.0'
// RxJava
implementation 'io.reactivex.rxjava2:rxjava:2.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation('com.squareup.retrofit2:retrofit:2.3.0') {
exclude module: 'okhttp'
}
//firebase
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:18.0.0'
//geofire
implementation 'com.firebase:geofire-android:2.3.1'
// Firebase
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
//glide
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
/* implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-auth:9.0.0'
implementation 'com.google.android.gms:play-services-places:11.8.0'*/
implementation 'com.google.android.gms:play-services-location:16.0.0'
//implementation 'com.google.android.gms:play-services:16.0.9'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
//implementation 'com.google.android.gms:play-services-places:11.8.0'
//implementation 'com.google.android.libraries.places:places-compat:1.1.0'
implementation 'com.google.android.libraries.places:places:1.1.0'
implementation 'com.wdullaer:materialdatetimepicker:3.6.4'
implementation 'com.molpay:molpay-mobile-xdk-android:3.24.0'
//Play Core Library
implementation 'org.jsoup:jsoup:1.11.3'
}

Jetpack compose, Instrumental tests: java.lang.ClassNotFoundException: Didn't find class "androidx.test.internal.util.Checks"

When running an androidTest(instrumentation) before the test is able to run I get a crash as the app launches. I have provided the crash log. The app gradle and project gradle file, finally the very basic test that i was about to get started on.
The full error log:
2021-08-16 10:44:44.368 20858-20858/com.matrix.install.test D/AndroidRuntime: Shutting down VM
2021-08-16 10:44:44.372 20858-20858/com.matrix.install.test E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.matrix.install.test, PID: 20858
java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/test/internal/util/Checks;
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.onResume(InstrumentationActivityInvoker.java:159)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355)
at android.app.Activity.performResume(Activity.java:7117)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.test.internal.util.Checks" on path: DexPathList[[zip file "/system/framework/android.test.mock.jar", zip file "/system/framework/android.test.runner.jar", zip file "/data/app/com.matrix.install.test-KWEjjLDHWFQ3kQvgJfaPgg==/base.apk"],nativeLibraryDirectories=[/data/app/com.matrix.install.test-KWEjjLDHWFQ3kQvgJfaPgg==/lib/arm64, /system/lib64, /vendor/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
at androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity.onResume(InstrumentationActivityInvoker.java:159) 
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1355) 
at android.app.Activity.performResume(Activity.java:7117) 
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3556) 
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3621) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2862) 
at android.app.ActivityThread.-wrap11(Unknown Source:0) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589) 
at android.os.Handler.dispatchMessage(Handler.java:106) 
at android.os.Looper.loop(Looper.java:164) 
at android.app.ActivityThread.main(ActivityThread.java:6494) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807) 
App Gradle:
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'com.google.firebase.crashlytics'
id 'kotlin-parcelize'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.matrix.install"
minSdkVersion 21
targetSdkVersion 30
versionCode 6
versionName "1.0.6"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
}
// Inject the Maps API key into the manifest
manifestPlaceholders = [mapsApiKey: properties.getProperty("MAPS_API_KEY", "")]
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders = [enableCrashReporting: "true"]
}
debug {
manifestPlaceholders = [enableCrashReporting: "false"]
}
}
buildFeatures {
compose true
viewBinding = true
}
kotlinOptions {
jvmTarget = '1.8'
}
composeOptions {
kotlinCompilerExtensionVersion '1.0.1'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude "META-INF/AL2.0"
exclude "META-INF/LGPL2.1"
}
}
dependencies {
def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"
//Google libs
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.21"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
def compose_version = "1.0.1"
//Compose libs
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling:$compose_version"
implementation "androidx.compose.foundation:foundation:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.material:material-icons-core:$compose_version"
implementation "androidx.compose.material:material-icons-extended:$compose_version"
implementation "androidx.activity:activity-compose:1.3.1"
implementation "com.google.android.libraries.maps:maps:3.1.0-beta"
implementation "com.google.maps.android:maps-v3-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha07"
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
implementation "androidx.constraintlayout:constraintlayout-compose:1.0.0-beta02"
//play services
// implementation "com.google.android.gms:play-services-maps:17.0.0"
implementation "com.google.android.gms:play-services-location:18.0.0"
//Firebase
implementation platform('com.google.firebase:firebase-bom:26.8.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-analytics-ktx'
//Dagger //2.28-alpha
implementation "com.google.dagger:hilt-android:2.36"
kapt "com.google.dagger:hilt-android-compiler:2.36"
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
implementation 'androidx.hilt:hilt-work:1.0.0'
// When using Kotlin.
kapt 'androidx.hilt:hilt-compiler:1.0.0'
//DB viewer
def stetho_version = "1.5.1"
implementation "com.facebook.stetho:stetho-okhttp3:$stetho_version"
//Coroutines
def coroutines_version = "1.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutines_version"
//Life Cycle
def life_cycle_version = "2.2.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$life_cycle_version"
//DB
def room_version = "2.3.0"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
//Request libraries
def retrofit_version = "2.6.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit_version"
//Json parser
def moshi_version = "1.9.2"
implementation "com.squareup.moshi:moshi-adapters:$moshi_version"
implementation "com.squareup.moshi:moshi-kotlin:$moshi_version"
//Modal
def kotlin_result_version = "1.1.7"
implementation("com.michael-bull.kotlin-result:kotlin-result:$kotlin_result_version")
//Time
def joda_version = "2.9.9"
implementation "joda-time:joda-time:$joda_version"
//Accompanist
implementation "com.google.accompanist:accompanist-coil:0.11.1"
implementation 'com.google.accompanist:accompanist-insets-ui:0.15.0'
implementation 'com.google.accompanist:accompanist-insets:0.15.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.12.0'
//Swipe refresh
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
//Video player
implementation 'com.google.android.exoplayer:exoplayer:2.11.7'
implementation 'com.google.android.exoplayer:exoplayer-hls:2.11.7'
// barcode scanner
implementation "com.google.zxing:core:3.3.0"
implementation "com.journeyapps:zxing-android-embedded:3.4.0#aar"
def work_version = "2.5.0"
//Work manager
implementation "androidx.work:work-runtime-ktx:$work_version"
// Testing dependencies
implementation 'androidx.test:runner:1.4.0'
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
// Compose testing dependencies
androidTestImplementation "androidx.compose.ui:ui-test:$compose_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
androidTestImplementation "androidx.test.espresso:espresso-contrib:3.3.0"
androidTestImplementation "androidx.test.espresso:espresso-core:3.3.0"
}
apply plugin: 'com.google.gms.google-services'
Project Gradle:
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
//Dependency injection
classpath "com.google.dagger:hilt-android-gradle-plugin:2.36"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.0'
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
finally the test class, very little here as this crash is a blocker:
#ExperimentalTestApi
#SdkSuppress(minSdkVersion = Build.VERSION_CODES.O)
class RegisterDeviceFragmentKtTest {
#get:Rule
val composeTestRule = createComposeRule()
#Test
fun registerDeviceViewTest() {
val mockedViewState = RegisterDeviceViewModel.RegisterDeviceViewState("123abc")
composeTestRule.setContent {
RegisterDeviceView(
modifier = Modifier,
viewState = mockedViewState,
imeiChanged = {},
navigateToScanner = {
assertTrue(true)
},
registerDevice = {}
)
}
composeTestRule.onNode(hasText("Scan")).performClick()
Thread.sleep(5000)
}
}
Make sure your UI test related libraries are imported with "androidTestImplementation", not "implementation"
eg.:
androidTestImplementation 'androidx.test:runner:1.4.0'
and not
implementation 'androidx.test:runner:1.4.0'
For my case I need to test a recyclerview , but accidentally I put their dependencies in gradle like -
implementation 'androidx.test.espresso:espresso-contrib:3.4.0'
implementation 'androidx.test.espresso:espresso-core:3.4.0'
But it should be
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
Compose test runs on Junit4 so you need Junit4 Runner for that.
Annotate your test class with AndroidJUnit4 like this:
#RunWith(AndroidJUnit4::class)
class RegisterDeviceFragmentKtTest {}

android gradle - google services plugin 3.3.0 error of " For input string: " 12" - how to solve?

i recently updated google services to 3.3.0:
classpath 'com.google.gms:google-services:3.3.0'
Now i have the following error and the recommendation from google here is to upgrade to 3.3.0 for the new firebase versioning.
here is the error:
As you can see its failing during the configuration phase.
if i look at the build error details i see the following :
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':app'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
here are the details of my project gradle file:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
}
//kotlin version
ext.kotlin_version = '1.2.41'
ext.kotlin_ktx_version = '0.3'
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
classpath 'io.fabric.tools:gradle:1.25.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/pt-midtrans/maven" }
maven { url "https://jitpack.io" }
google()
}
project.ext {
minimumSdkVersion = 16
supportlib_version = '27.1.1'
room_version = '1.0.0'
espresso_version = '3.0.1'
archLifecycleVersion = '1.1.1'
dagger = '2.15'
}
}
subprojects {
//todo change this to loop once
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version" //force all versions of support library to be the same. i tried commending out this entire block but that is not the issue
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and the app gradle file:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
//buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion project.ext.minimumSdkVersion
//check top level build.gradle file for attributes -
targetSdkVersion 27
applicationId "com.mobile.mypackage"
versionCode 1
versionName "3" //whatever
testInstrumentationRunner "com.mobile.mypackage.base.MyTestRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'tier'
buildTypes {
release {
debuggable false //for troubleshooting, should set to false in production build
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
}
debugMini {
//this is a proguarded version of debug build, turn off - InstaRun to use
initWith debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
matchingFallbacks = ['debug']
}
}
dexOptions {
//for out of memory gc overhead error
javaMaxHeapSize "6g"
}
lintOptions {
abortOnError false
}
androidExtensions {
experimental = true
}
testOptions {
//this seems to be absolutely nothing in build tools 25.0.3. after upgrading gradle will check again
animationsDisabled = true
execution 'ANDROID_TEST_ORCHESTRATOR'
}
productFlavors {
def STRING = "String"
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def BASE_ENDPOINT = "BASE_ENDPOINT"
staging {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-STAGING'
applicationIdSuffix 'staging'
}
labs {
dimension 'tier'
ext.alwaysUpdateBuildId = false
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-LABs'
applicationIdSuffix 'labs'
}
prod {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
}
}
}
kapt {
useBuildCache = false //toggle this to see if it will help
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation("com.android.support:appcompat-v7:$supportlib_version") {
force = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:support-annotations:$supportlib_version"
implementation("com.android.support:design:$supportlib_version") {
force = true
}
implementation 'com.android.support:multidex:1.0.3'
//firebase
implementation("com.google.firebase:firebase-core:15.0.2") {
force = true
}
implementation("com.google.firebase:firebase-auth:15.1.0") {
force = true
}
implementation("com.google.firebase:firebase-config:15.0.2") {
force = true
}
implementation("com.google.android.gms:play-services-auth:15.0.0") {
force = true
}
implementation("com.google.firebase:firebase-messaging:15.0.2") {
force = true
}
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
//square
//testAnnotationProcessor "com.google.dagger:dagger-compiler:$dagger"
implementation "com.google.dagger:dagger:$dagger"
//annotationProcessor "com.google.dagger:dagger-compiler:$dagger"
kapt "com.google.dagger:dagger-compiler:$dagger"
implementation 'com.github.ajalt:timberkt:1.3.0'
implementation 'com.jakewharton:butterknife:8.8.1'
// annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "com.squareup.retrofit2:retrofit:2.3.0"
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
androidTestImplementation 'com.squareup.rx.idler:rx2-idler:0.9.0' //for espresso
implementation 'com.hannesdorfmann.mosby:viewstate:2.0.1'
//------Architecture Components ------------
//room db
implementation "android.arch.persistence.room:runtime:$room_version"
//annotationProcessor "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.lifecycle:common-java8:1.1.1"
kapt "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
// Lifecycles only (no ViewModel or LiveData)
implementation "android.arch.lifecycle:runtime:$archLifecycleVersion"
//annotationProcessor "android.arch.lifecycle:compiler:$archLifecycleVersion"
kapt "android.arch.lifecycle:compiler:$archLifecycleVersion"
implementation "android.arch.lifecycle:extensions:$archLifecycleVersion"
//------END Architecture Components ------------
//event Bus
implementation 'org.greenrobot:eventbus:3.0.0'
//FB
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
//implementation 'com.facebook.android:facebook-applinks:[4,5)'
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
//testing
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
testImplementation 'org.mockito:mockito-core:2.15.0'
androidTestImplementation 'org.mockito:mockito-android:2.8.9'
androidTestImplementation 'com.github.fabioCollini:DaggerMock:0.8.4'
implementation 'com.squareup.okhttp3:mockwebserver:3.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
// Espresso dependencies
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espresso_version"
// androidTestImplementation 'com.android.support.test.espresso:espresso-accessibility:3.0.1'
androidTestImplementation "com.android.support.test.espresso:espresso-web:$espresso_version"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-idling-resource:$espresso_version"
//UI dependencies
implementation 'com.andreabaccega:android-edittext-validator:1.3.4'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation "com.imgix:imgix-java:1.1.10"
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.github.d-max:spots-dialog:0.7#aar' //loading screen
implementation 'com.jaredrummler:material-spinner:1.1.0'//drop down list
implementation 'com.github.ganfra:material-spinner:1.1.1'//drop down list
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
//implementation 'com.github.takusemba:multisnaprecyclerview:1.1.1' //snap
implementation 'com.crystal:crystalrangeseekbar:1.1.1'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.0'
//data structures
implementation 'com.scalified:tree:0.2.4'
//parcelable
implementation 'org.parceler:parceler-api:1.1.9'
//annotationProcessor 'org.parceler:parceler:1.1.9'
kapt 'org.parceler:parceler:1.1.9'
//payment gateways
//implementation 'co.omise:omise-android:2.3.+'
implementation 'co.omise:omise-android:2.6.4'
implementation 'com.braintreepayments.api:braintree:1.+'
debugImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
debugMiniImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
releaseImplementation 'com.midtrans:uikit:1.17.0'
//fresh chat
implementation 'com.github.freshdesk:freshchat-android:1.3.1'
implementation'com.crashlytics.sdk.android:crashlytics:2.9.2'
//one signal
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
//retrofit pretty logs
implementation('com.github.ihsanbal:LoggingInterceptor:2.0.2') {
exclude group: 'org.json', module: 'json'
}
//barcode scanner
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
//masking text
implementation 'com.redmadrobot:inputmask:2.3.0'
// Analytics
implementation "com.google.android.gms:play-services-analytics:15.0.2"
implementation 'com.appsflyer:af-android-sdk:4+#aar'
implementation 'com.android.installreferrer:installreferrer:1.0'
//runtime permissions
implementation 'com.karumi:dexter:4.2.0'
//chrome custom tabs
implementation 'saschpe.android:customtabs:1.0.9'
//searching - https://github.com/algolia/algoliasearch-client-android/releases
implementation 'com.algolia:algoliasearch-android:3.21.11'
//credit card scanner
implementation 'io.card:android-sdk:5.5.1'
//firebase test orchestrator
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestUtil 'com.android.support.test:orchestrator:1.0.2'
//kotlin
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
//kotlin ktx
implementation "androidx.core:core-ktx:$kotlin_ktx_version"
}
apply plugin: 'com.google.gms.google-services' //add to bottom of file
if i downgrade to 3.2.1 i get the following build error:
5 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
UPDATE:
AFTER downgrading to google services 3.2.1 i now face the following error while build the gradle project:
14:37:49.269 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
UPDATE: It seems when disable oneSignal Sdk the deSugar error disappears on 3.2.0 . so i speculate that this has to do something with firebase versioning. but there is still an issue using 3.3.0. i will contact oneSignal seperately.
I have no idea how to fix this. i am using 4.6 and also tried 4.4 of gradle wrapper (just in case).
use classpath 'com.google.gms:google-services:3.2.0'

Failed for task ':app:kaptGenerateStubsDebugKotlin' after adding Room's #Database to database abstract class

I am trying to implement Room into Android application written in Kotlin. After build failing so many times, I pinpointed the problem that it failed when I added #Database into my database class.
package sample.service.local
import android.arch.persistence.room.Database
import android.arch.persistence.room.RoomDatabase
import sample.service.model.Announcement
#Database(entities = [Announcement::class], version = 1)
abstract class AnnounceDatabase: RoomDatabase() {
abstract fun announceDAO(): AnnounceDAO
}
If I commented out the line with #Database it built successfully. Its DAO and Entity files shouldn't be the problem as I tried building with them without #Database and it was successful. I also haven't added them into any other classes; I just created 3 new files which are this database, its dao, and its entity.
Here's build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: "kotlin-kapt"
android {
compileSdkVersion 27
defaultConfig {
applicationId "sample"
minSdkVersion 16
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
dataBinding.enabled true
}
}
project.ext {
supportLibraryVersion = "26.1.0"
daggerVersion = "2.13"
butterKnifeVersion = "8.8.1"
rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.1"
lifecycleVersion = "1.0.0"
roomVersion = "1.0.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.android.support:support-v4:27.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
// Android Support Library
implementation 'com.android.support:design:27.1.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:support-annotations:27.1.0'
implementation 'com.android.support:support-compat:27.1.0'
implementation 'com.android.support:support-core-ui:27.1.0'
// Easy Permission
implementation 'pub.devrel:easypermissions:1.2.0'
// Lifecycle
implementation "android.arch.lifecycle:extensions:1.1.0"
annotationProcessor "android.arch.lifecycle:compiler:1.1.0"
// Kotlin binding
// kapt 'com.android.databinding:compiler:3.1.0'
// Dagger core
kapt "com.google.dagger:dagger-compiler:$project.daggerVersion"
implementation "com.google.dagger:dagger:$project.daggerVersion"
// Dagger Android
kapt "com.google.dagger:dagger-android-processor:$project.daggerVersion"
implementation "com.google.dagger:dagger-android-support:$project.daggerVersion"
// Timber
implementation 'com.jakewharton.timber:timber:4.6.0'
// Simple Item Decoration
implementation 'com.bignerdranch.android:simple-item-decoration:1.0.0'
// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.1.0"
implementation "com.squareup.retrofit2:converter-gson:2.1.0"
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
// implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
// RxJava & RxAndroid
implementation 'io.reactivex.rxjava2:rxjava:2.1.12'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
// PageIndicatorView
implementation 'com.romandanylyk:pageindicatorview:1.0.0#aar'
// Room
implementation "android.arch.persistence.room:rxjava2:$project.roomVersion"
implementation "android.arch.persistence.room:runtime:$project.roomVersion"
kapt "android.arch.persistence.room:compiler:$project.roomVersion"
testImplementation "android.arch.persistence.room:testing:$project.roomVersion"
}
Here's project's gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.31'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I ran gradlew clean build --stacktrace --debug and here's error message
Any help will be appreciated.
The problem is in my Entity class where I used val instead of var for the parameters, so I just changed all of them to var and the problem is solved.
Edit: My DAO class also has a problem as well where ArrayList cannot be used instead of List

Categories

Resources