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
Related
Hey I am updating kotlinx coroutines to latest version in android. I am getting weird issue on lint check. I updated my version to 1.5.1 to 1.6.0 in my project.
buidl.gradle(application)
ext {
kotlin_version = '1.5.21'
kotlin_serializtion_version = '1.5.21'
kotlin_coroutines_version = "1.6.0"
retrofit_version = '2.5.0'
moshiVersion = "1.12.0"
retrofit2_version = "2.5.0"
okhttp3_version = "4.9.0"
mockk_version = "1.10.4"
picassoVersion = "2.71828"
lifecycle_version = "2.4.0"
koin_version = "3.1.5"
barcode_scanner_version = "16.1.1"
camerax_version = "1.0.0"
camera_view_version = "1.0.0-alpha22"
stripe_version = "19.0.0"
jacoco_version = "0.8.7"
room_version = "2.3.0"
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath 'com.google.gms:google-services:4.3.3'
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_serializtion_version"
classpath 'com.google.firebase:firebase-appdistribution-gradle:2.2.0'
}
buidl.gradle(app)
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "androidx.fragment:fragment-ktx:1.4.0"
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.android.material:material:1.2.1'
//Kotlin extensions library for Play Core
implementation 'com.google.android.play:core-ktx:1.8.1'
//Android Kotlin extensions
implementation "androidx.core:core-ktx:1.3.2"
//Unit test
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-inline:3.4.0'
androidTestImplementation 'org.mockito:mockito-android:3.4.0'
implementation "org.jacoco:org.jacoco.core:$jacoco_version"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation 'androidx.arch.core:core-testing:2.1.0'
testImplementation "io.mockk:mockk:${mockk_version}"
//Moshi (JSON parser)
implementation "com.squareup.moshi:moshi-kotlin:$moshiVersion"
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshiVersion"
//Retrofit2
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
implementation "com.squareup.retrofit2:converter-moshi:$retrofit2_version"
//Paging 3
implementation "androidx.paging:paging-runtime-ktx:3.0.0-alpha07"
//Okhttp3
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttp3_version"
//Kotlin Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$kotlin_coroutines_version"
//ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
//HTML parser
implementation 'org.jsoup:jsoup:1.12.1'
//Payments
implementation 'com.google.android.gms:play-services-wallet:19.1.0'
implementation "com.stripe:stripe-android:$stripe_version"
//Firebase
implementation platform('com.google.firebase:firebase-bom:27.1.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-config-ktx'
implementation "com.google.firebase:firebase-messaging"
implementation "com.google.firebase:firebase-core"
//Pager indicator
implementation 'me.relex:circleindicator:2.1.4'
//Animations
implementation 'com.airbnb.android:lottie:3.2.2'
implementation 'pl.bclogic:pulsator4droid:1.0.3'
//Loading images
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
//View container which can wrap content
implementation 'com.google.android:flexbox:2.0.1'
//Phone Authentication
implementation 'com.google.android.gms:play-services-auth:20.0.1'
implementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1'
implementation 'com.googlecode.libphonenumber:libphonenumber:8.7.0'
//Video player
implementation 'com.google.android.exoplayer:exoplayer:2.11.3'
//Dependency injection - Koin AndroidX Scope features
implementation "io.insert-koin:koin-android:$koin_version"
implementation "io.insert-koin:koin-androidx-workmanager:$koin_version"
testImplementation "io.insert-koin:koin-test-junit4:$koin_version"
testImplementation "io.insert-koin:koin-test:$koin_version"
//WorkManager
implementation "androidx.work:work-runtime-ktx:2.7.1"
// App Startup
implementation "androidx.startup:startup-runtime:1.1.0"
//Progress button extension
implementation 'com.github.razir.progressbutton:progressbutton:2.1.0'
//PDF Viewer
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
//Amplitude
implementation 'com.amplitude:android-sdk:2.25.2'
//Salesforce chat
implementation "com.salesforce.service:chat-ui:4.2.2"
//Jumio
implementation "com.jumio.android:core:3.9.2#aar" // Jumio Core library
implementation "com.jumio.android:nv:3.9.2#aar" // Netverify library
implementation "com.jumio.android:nv-barcode:3.9.2#aar" // Barcode scanning
implementation "com.jumio.android:nv-mrz:3.9.2#aar" // MRZ scanning
//AppsFlyer
implementation 'com.appsflyer:af-android-sdk:6.2.0'
implementation 'com.android.installreferrer:installreferrer:2.2'
// Code Scanner & Camera
implementation "com.google.mlkit:barcode-scanning:$barcode_scanner_version"
implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation "androidx.camera:camera-view:$camera_view_version"
// Braze (marketing push notifications)
implementation "com.appboy:android-sdk-ui:14.0.0"
// Room
implementation "androidx.room:room-ktx:$room_version"
kapt "androidx.room:room-compiler:$room_version"
androidTestImplementation "androidx.room:room-testing:$room_version"
implementation "androidx.room:room-runtime:$room_version"
//Memory leak analysis - should only run in dev builds (devqaImplementation)
//devqaImplementation 'com.squareup.leakcanary:leakcanary-android:2.2'
}
Error what I am getting
Could not load custom lint check jar file /Users/vmodi/.gradle/caches/transforms-2/files-2.1/28f32124189df6c8d7d39ecfef6ee770/jetified-ui-graphics-1.0.5/jars/lint.jar
java.lang.NoClassDefFoundError: com/android/tools/lint/client/api/Vendor
at androidx.compose.ui.graphics.lint.UiGraphicsIssueRegistry.<init>(UiGraphicsIssueRegistry.kt:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at com.android.tools.lint.client.api.JarFileIssueRegistry$Factory.loadIssueRegistry(JarFileIssueRegistry.kt:200)
at com.android.tools.lint.client.api.JarFileIssueRegistry$Factory.get(JarFileIssueRegistry.kt:152)
at com.android.tools.lint.client.api.JarFileIssueRegistry$Factory.get(JarFileIssueRegistry.kt:116)
at com.android.tools.lint.client.api.LintDriver.registerCustomDetectors(LintDriver.kt:494)
at com.android.tools.lint.client.api.LintDriver.analyze(LintDriver.kt:414)
at com.android.tools.lint.LintCliClient.run(LintCliClient.kt:256)
at com.android.tools.lint.LintCliClient.run(LintCliClient.kt:237)
at com.android.tools.lint.gradle.LintGradleClient.run(LintGradleClient.kt:255)
at com.android.tools.lint.gradle.LintGradleExecution.runLint(LintGradleExecution.kt:259)
at com.android.tools.lint.gradle.LintGradleExecution.lintSingleVariant(LintGradleExecution.kt:275)
at com.android.tools.lint.gradle.LintGradleExecution.analyze(LintGradleExecution.kt:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.android.tools.lint.gradle.api.ReflectiveLintRunner.runLint(ReflectiveLintRunner.kt:38)
at com.android.build.gradle.tasks.LintBaseTask.runLint(LintBaseTask.java:117)
at com.android.build.gradle.tasks.LintPerVariantTask.lint(LintPerVariantTask.java:67)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:49)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:42)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:28)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:726)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:693)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:569)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:395)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:387)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:157)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:242)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:150)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:84)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:554)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:537)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:278)
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'
}
I am getting Duplicate class com.google.protobuf.AbstractMessageLite found in modules jetified-protobuf-javalite-3.11.0.jar (com.google.protobuf:protobuf-javalite:3.11.0) and jetified-protobuf-lite-3.0.1.jar (com.google.protobuf:protobuf-lite:3.0.1).
I have not seen an answer that clears up my issue. I appreciate any assistance.
apply plugin: 'com.android.application'
apply plugin: 'idea'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: "io.spring.dependency-management"
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
compileSdkVersion target_sdk_version
buildToolsVersion "29.0.2"
android.buildFeatures.dataBinding
defaultConfig {
applicationId "com.example.app"
minSdkVersion 29
targetSdkVersion target_sdk_version
multiDexEnabled true
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
packagingOptions {
exclude 'META-INF/main.kotlin_module'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable = true
}
debug {
minifyEnabled false
testCoverageEnabled false
}
}
dataBinding {
enabled = true
}
productFlavors {
}
lintOptions {
abortOnError false
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
sourceSets {
main {
main.java.srcDirs += 'src/main/kotlin'
}
}
compileOptions {
sourceCompatibility '1.8'
targetCompatibility '1.8'
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
lintOptions {
abortOnError false
disable 'GradleDependency', 'GoogleAppIndexingWarning'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'org.jetbrains.kotlin' && requested.name == 'kotlin-reflect') {
details.useVersion kotlin_version
}
}
}
}
buildscript {
ext {
gson_version = "2.8.2"
dagger_version = '2.25.2'
rx_version = '2.2.15'
glide_version = "4.7.1"
rx_firebase_version = "1.1.3"
support_version = '28.0.0'
rx_android_version = '2.1.1'
glide_version = '4.11.0'
target_sdk_version = 29
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
def nav_version = "2.3.0"
def lifecycle_version = "2.2.0"
def arch_version = "2.1.0"
def firebase_config = '19.2.0'
implementation ("com.google.firebase:firebase-config:$firebase_config",{
// protobuf-lite that firebase-config and Tink depends on.
exclude group: 'com.google.protobuf',module: 'protobuf-javalite'
exclude group: 'com.google.protobuf',module: 'protobuf-lite'
})
//Base SDK
implementation 'com.amazonaws:aws-android-sdk-appsync:3.0.2'
implementation 'com.amazonaws:aws-android-sdk-core:2.16.13'
//Dagger
implementation 'com.google.dagger:dagger-android:2.28.1'
kapt 'com.google.dagger:dagger-compiler:2.28.1'
kapt 'com.google.dagger:dagger-android-processor:2.28.1'
implementation 'com.google.dagger:dagger-android-support:2.28.1'
//Firebase/Amazon
implementation 'com.amazonaws:aws-android-sdk-iot:2.16.13'
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.16.13'
implementation "com.firebase:firebase-jobdispatcher:0.8.6"
implementation 'com.firebaseui:firebase-ui-auth:5.0.0'
implementation 'com.google.firebase:firebase-analytics:17.4.4'
implementation 'com.google.firebase:firebase-auth:19.3.2'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-firestore:21.5.0'
implementation 'com.google.firebase:firebase-storage:19.1.1'
///Glide
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
//JETBRAINS
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72'
//Kotlin
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
implementation 'com.fasterxml.jackson.module:jackson-module-kotlin:2.11.1'
//Lifecycle
// https://mvnrepository.com/artifact/android.arch.lifecycle/common-java8
implementation(group: 'androidx.lifecycle', name: 'lifecycle-common-java8', version: '2.2.0')
// Annotation processor
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation 'androidx.lifecycle:lifecycle-common-java8:2.2.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-alpha05'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-alpha05'
implementation "androidx.navigation:navigation-dynamic-features-fragment:2.3.0"
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.0'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.0'
// optional - ReactiveStreams support for LiveData
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version"
// optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$arch_version"
kapt 'androidx.databinding:databinding-compiler:4.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.8.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.8.0'
//Mini
implementation 'com.github.pabloogc:Mini:1.0.5'
kapt 'com.github.pabloogc.Mini:mini-processor:1.0.5'
annotationProcessor 'com.github.pabloogc.Mini:mini-processor:1.0.5'
// Required for Cognito
implementation('com.amazonaws:aws-android-sdk-cognitoauth:2.16.13#aar') { transitive = true }
//Rx
implementation 'io.reactivex.rxjava2:rxjava:2.2.19'
implementation "io.reactivex.rxjava2:rxandroid:$rx_android_version"
implementation 'com.tbruyelle.rxpermissions2:rxpermissions:0.9.5#aar'
//Support
implementation 'androidx.activity:activity-ktx:1.2.0-alpha06'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.browser:browser:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta8'
implementation 'androidx.core:core-ktx:1.3.0'
implementation 'androidx.core:core:1.5.0-alpha01'
implementation 'androidx.fragment:fragment:1.3.0-alpha06'
implementation 'androidx.fragment:fragment-ktx:1.3.0-alpha06'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.preference:preference:1.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.viewpager2:viewpager2:1.0.0'
implementation 'com.google.android.material:material:1.3.0-alpha01'
implementation 'com.google.android.gms:play-services-auth:18.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.android.gms:play-services-places:17.0.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.android.libraries.places:places:2.3.0'
implementation 'com.google.guava:guava:29.0-jre'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.karumi:dexter:6.2.1'
implementation 'com.pavelsikun:material-seekbar-preference:2.3.0'
implementation 'info.guardianproject.panic:panic:1.0'
implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1'
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
implementation 'org.eclipse.paho:org.eclipse.paho.android.service:1.1.1'
//Test
testImplementation 'junit:junit:4.13'
testImplementation 'com.natpryce:hamkrest:1.7.0.0'
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testImplementation 'org.junit.platform:junit-platform-runner:1.6.2'
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
androidTestImplementation 'androidx.test:runner:1.3.0-rc01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-rc01'
}
repositories {
google()
mavenCentral()
maven { url "http://dl.bintray.com/jetbrains/spek" }
apply plugin: 'com.google.gms.google-services'
//kotlin annotation processor
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
}
kotlin {
experimental {
coroutines "enable"
}
}
...
You need to add an exclusion on one of the imports so it only adds the package once.
Example:
// Now junit will not include hamcrest library. Therefore there will be no
//dependency conflict.
compile ('junit:junit:4.12'){
exclude group: 'org.hamcrest', module:'hamcrest-core'
}
I am having some trouble with the dagger 2 stuff, any hel will be appreciated!
So in the following image are listed the errors that I am getting on compile time:
Also here is my build.grade(Module:app) file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.vasco.trackme"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
ext {
supportLibVersion = "26.1.0"
daggerVersion = "2.11"
goolePlayServiceVersion = "11.8.0"
butterKnifeVersion = "8.8.1"
retrofitVersion = "2.1.0"
okhttpVersion = "3.7.0"
okhttpLoggingVersion = "3.4.2"
jodaTimeSerilialiserVersion = "1.2.0"
timberVersion = "4.3.1"
picasoVersion = "2.5.2"
picasoDownloaderVersion = "1.1.0"
rxLifeCycleVersion = "0.4.0"
rxJavaBindingVersion = "1.0.0"
rxJavaVersion = "1.2.5"
rxAndroidVersion = "1.2.1"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:design:${supportLibVersion}"
implementation "com.android.support:preference-v14:${supportLibVersion}"
implementation "com.android.support:cardview-v7:${supportLibVersion}"
implementation "com.android.support:recyclerview-v7:${supportLibVersion}"
//maps and location (avoiding the unnecessary stuff from the google play services lib)
implementation "com.google.android.gms:play-services-maps:${goolePlayServiceVersion}"
implementation "com.google.android.gms:play-services-location:${goolePlayServiceVersion}"
//dagger
implementation "com.google.dagger:dagger:${daggerVersion}"
annotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"
//butterKnife
implementation "com.jakewharton:butterknife:${butterKnifeVersion}"
annotationProcessor "com.jakewharton:butterknife-compiler:${butterKnifeVersion}"
//network
implementation "com.squareup.okhttp3:okhttp:${okhttpVersion}"
implementation "com.squareup.okhttp3:logging-interceptor:${okhttpLoggingVersion}"
implementation "com.fatboyindustrial.gson-jodatime-serialisers:gson-jodatime-serialisers:${jodaTimeSerilialiserVersion}"
//retrofit
implementation "com.squareup.retrofit2:retrofit:${retrofitVersion}"
implementation "com.squareup.retrofit2:converter-gson:${retrofitVersion}"
implementation "com.squareup.retrofit2:adapter-rxjava:${retrofitVersion}"
//timber
implementation "com.jakewharton.timber:timber:${timberVersion}"
//picaso
implementation "com.squareup.picasso:picasso:${picasoVersion}"
implementation "com.jakewharton.picasso:picasso2-okhttp3-downloader:${picasoDownloaderVersion}"
//rx Life cycle
implementation "com.trello:rxlifecycle:${rxLifeCycleVersion}"
implementation "com.trello:rxlifecycle-components:${rxLifeCycleVersion}"
//RxJava Binding
implementation "com.jakewharton.rxbinding:rxbinding:${rxJavaBindingVersion}"
//RxJava
implementation "io.reactivex:rxjava:${rxJavaVersion}"
implementation "io.reactivex:rxandroid:${rxAndroidVersion}"
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
testImplementation 'junit:junit:4.12'
}
Component classes:
#ApplicationScope
#Component(modules = {CommunicationServiceModule.class, DBModule.class,
SharedPrefsModule.class, ActivityModule.class, PicasoModule.class})
public interface AppComponent {
DBHelper getDBHelper();
Preferences getPreferences();
CommunicationService getCommunicationService();
Picasso getPicasso();
}
#JourneyScope
#Component(modules = JourneyModule.class, dependencies = AppComponent.class)
public interface JourneyComponent {
void injectFragment(JourneyFragment journeyFragment);
}
#MainActivityScope
#Component(modules = MainActivityModule.class, dependencies = AppComponent.class)
public interface MainActivityComponent {
void injectActivity(MainActivity mActivity);
}
Should't the "DaggerMainActivityComponent" begenerated at compiletime?
How couldn't be found? (weird)
Regarding the second error I have no idea what is about!!!
Many Thanks
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?