reason of android.support.v4.media.MediaBrowserCompat$CallbackHandler error - android

There is an old source needs an update, but it shows an Error:
Program type already present: android.support.v4.media.MediaBrowserCompat$CallbackHandler
gradle.properties file included:
android.useAndroidX = true
android.enableJetifier = false
app.gradle:
compileSdkVersion 29
minSdkVersion 19
targetSdkVersion 29
def component_version = '27.1.1'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
testImplementation 'junit:junit:4.12'
//noinspection GradleCompatible
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:appcompat-v7:' + component_version
implementation 'com.android.support:design:' + component_version
implementation 'com.android.support:recyclerview-v7:' + component_version
implementation 'com.android.support:cardview-v7:' + component_version
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
// FCM
implementation 'com.google.firebase:firebase-messaging:20.1.0'
implementation 'com.google.firebase:firebase-core:17.2.1'
// Material Dialog
implementation 'com.afollestad.material-dialogs:commons:0.9.6.0'
// Glide
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.bumptech.glide:okhttp-integration:1.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0'
implementation 'jp.wasabeef:glide-transformations:2.0.1'
// Yoyo Animation
implementation 'com.daimajia.easing:library:2.1#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
// Abring SDK
implementation 'com.github.msddev:abring-sdk-android:v0.4'
// Infinite Scroll
implementation 'com.github.pwittchen:infinitescroll:0.0.1'
// retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation('com.squareup.retrofit2:retrofit:2.1.0') {
// exclude Retrofit’s OkHttp dependency module and define your own module import
exclude module: 'okhttp'
}
implementation 'com.squareup.okhttp3:logging-interceptor:3.11.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
// JW player
implementation 'com.longtailvideo.jwplayer:jwplayer-core:+'
implementation 'com.longtailvideo.jwplayer:jwplayer-common:+'
implementation project(':mediapicker')
}

According to what you have included in your question, you are trying to add AndroidX libraries into your project.
Irregardless, the android.support.v4.media.MediaBrowserCompat which is an older support library is being referenced from multiple dependencies. That is the meaning of the error you are seeing.
To resolve this, you should run gradlew app:dependencies to retrieve a list of all libraries and see which is referencing the library in question.
Once you find the problem, you can exclude the library from the dependency by:
implementation ('library_name') {
exclude module: 'android.support.v4.media.MediaBrowserCompat'
}
I would also consult the documentation to migrate to AndroidX, since there is no more support for older support libraries.

Related

Android build failed after installing navigation component

I'm trying to build android project with navigation component.
My android project is written by both java and kotlin with some third party libraries(some library is very old).
When I add the following code into my app's build.gradle file in order to install navigation component as gogole site described([navigation component][1])
dependencies {
def nav_version = "2.3.3"
// Java language implementation
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
// Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:1.0.0-alpha05"
}
After that my project build failed with following error.
Execution failed for task ':<<ProjectName>>:transformClassesWithByteCodeTransformForDebug'.
> java.util.concurrent.ExecutionException: java.lang.RuntimeException: cannot find META-INF.versions.9.module-info: module-info found in META-INF/versions/9/module-info.class
The module is java9 feature and module-info.class seems it is required with java9 even I compile my android project with java8.
I also added following statement as some back articles explained, but it's not helped.
packagingOptions {
exclude "**/module-info.class"
}
All Dependencies:
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
compile fileTree(include: ['*.jar'], dir: 'libs')
// Support library
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.multidex:multidex:2.0.1'
// viewmodel
implementation "androidx.lifecycle:lifecycle-reactivestreams:2.1.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.1.0"
implementation "androidx.lifecycle:lifecycle-runtime:2.1.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.1.0"
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
// room
implementation "androidx.room:room-runtime:2.2.3"
kapt "androidx.room:room-compiler:2.2.3"
implementation "androidx.room:room-rxjava2:2.2.3"
testImplementation "androidx.room:room-testing:2.2.3"
androidTestImplementation "androidx.room:room-testing:2.2.3"
// GMS
implementation "com.google.android.gms:play-services-maps:15.0.2"
implementation "com.google.android.gms:play-services-location:15.0.2"
implementation "com.google.android.gms:play-services-tagmanager:16.0.8"
// for Places SDK for Android
implementation "com.google.android.libraries.places:places-compat:1.1.0"
implementation 'com.google.maps.android:maps-ktx:1.5.0'
implementation 'com.google.maps.android:maps-utils-ktx:1.5.0'
// Google
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.google.guava:guava:14.0.1'
// Directions API
implementation "com.google.maps:google-maps-services:0.2.11"
// GreenDao
compile 'de.greenrobot:greendao:1.3.7'
// Util
compile 'com.deploygate:sdk:3.1'
// Firebase
implementation "com.google.firebase:firebase-core:16.0.9"
implementation "com.google.firebase:firebase-messaging:18.0.0"
implementation "com.google.firebase:firebase-dynamic-links:17.0.0"
implementation "com.google.firebase:firebase-config:17.0.0"
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
implementation 'com.google.firebase:firebase-analytics:17.6.0'
// AppsFlyer
implementation 'com.appsflyer:af-android-sdk:4.10.3#aar'
implementation 'com.android.installreferrer:installreferrer:1.0'
// Retrofit2
compile "com.squareup.retrofit2:retrofit:2.3.0"
compile "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
compile "com.squareup.retrofit2:converter-moshi:2.3.0"
implementation("com.squareup.retrofit2:converter-simplexml:2.3.0") {
exclude group: 'xpp3', module: 'xpp3'
exclude group: 'stax', module: 'stax-api'
exclude group: 'stax', module: 'stax'
}
compile "com.squareup.retrofit2:retrofit-mock:2.3.0"
compile "com.squareup.okhttp3:okhttp:3.8.0"
testCompile "com.squareup.okhttp3:mockwebserver:3.8.0"
compile "com.squareup.okhttp3:logging-interceptor:3.8.0"
compile "com.squareup.moshi:moshi:1.5.0"
compile "com.squareup.moshi:moshi-kotlin:1.5.0"
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxkotlin:2.2.0'
// dagger
implementation "com.google.dagger:dagger:2.25.4"
implementation "com.google.dagger:dagger-android:2.25.4"
implementation "com.google.dagger:dagger-android-support:2.25.4"
kapt "com.google.dagger:dagger-compiler:2.25.4"
kapt "com.google.dagger:dagger-android-processor:2.25.4"
kaptTest "com.google.dagger:dagger-compiler:2.25.4"
kaptAndroidTest "com.google.dagger:dagger-compiler:2.25.4"
kaptAndroidTestDebug "com.google.dagger:dagger-compiler:2.25.4"
implementation('com.github.bumptech.glide:glide:4.7.1') {
exclude group: 'com.android.support'
}
implementation('jp.wasabeef:glide-transformations:3.3.0'){
exclude group: 'com.android.support'
}
kapt 'com.github.bumptech.glide:compiler:4.5.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.61"
implementation "org.jetbrains.kotlin:kotlin-reflect:1.3.61"
// Kotlin Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.3'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-rx2:1.3.3'
implementation 'com.jakewharton.timber:timber:4.6.0'
// RxRelay
implementation 'com.jakewharton.rxrelay3:rxrelay:3.0.0'
// for Test
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.2.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.2.0'
testCompile 'org.powermock:powermock-api-mockito2:1.7.3'
testCompile 'org.powermock:powermock-module-junit4:1.7.3'
testCompile 'org.mockito:mockito-core:2.19.0'
androidTestCompile 'org.mockito:mockito-android:2.19.0'
compile 'com.ethanhua:skeleton:1.0.0'
//flexbox
implementation 'com.google.android:flexbox:1.0.0'
// runtime permission
implementation "com.github.hotchemi:permissionsdispatcher:3.3.1"
kapt "com.github.hotchemi:permissionsdispatcher-processor:3.3.1"
// JTS
implementation 'org.locationtech.jts:jts-core:1.17.1'
// デバッグ用
debugImplementation 'com.facebook.stetho:stetho:1.5.1'
def nav_version = "2.3.3"
// Java language implementation
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
// Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// Feature module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
// Jetpack Compose Integration
implementation "androidx.navigation:navigation-compose:1.0.0-alpha05"
}
Could you please tell me how to solve this problem.
Thanks
[1]: https://developer.android.com/guide/navigation/navigation-getting-started?hl=ja

R8 warning "Missing class: javax.swing.JFrame", how to get ride of Swing?

Recently I noticed that when I compile my app in release mod, R8 log the following warning message: Missing class: javax.swing.JFrame along with others Swing/Java desktop classes like Missing class: java.awt.event.WindowAdapter or Missing class: java.applet.Applet.
Unless I'm wrong, this have nothing to do in my Android application. How can I find where this come from?
I tried to check my app dependencies using ./gradlew app:dependencies but found nothing relevant since those classes come from the JRE.
My dependencies list as requested:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxjava:2.2.19"
implementation "joda-time:joda-time:2.10.6"
implementation "org.greenrobot:eventbus:3.2.0"
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.3"
implementation("com.crashlytics.sdk.android:crashlytics:2.10.1#aar") {
transitive = true
}
implementation "xom:xom:1.3.5"
implementation "io.requery:requery-android:1.6.1"
implementation "io.requery:requery-jackson:1.6.1"
kapt "io.requery:requery-processor:1.6.1"
implementation "com.squareup.okhttp3:okhttp:4.7.2"
implementation "com.squareup.okhttp3:logging-interceptor:4.7.2"
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-scalars:2.9.0"
implementation "com.squareup.retrofit2:converter-jackson:2.9.0"
implementation "com.fasterxml.jackson.core:jackson-databind:2.11.0"
implementation "com.google.android.material:material:1.1.0"
implementation "androidx.appcompat:appcompat:1.1.0"
implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.gridlayout:gridlayout:1.0.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation("com.mikepenz:materialdrawer:6.1.2") {
transitive = true
}
implementation "com.balysv.materialmenu:material-menu:2.0.0"
implementation "com.airbnb.android:lottie:3.4.0"
implementation "com.github.rey5137:material:1.3.0"
implementation "com.github.sevar83:indeterminate-checkbox:1.0.5#aar"
implementation "com.github.woxthebox:draglistview:1.7.1"
implementation "me.philio:pinentryview:1.0.6"
testImplementation "org.robolectric:robolectric:4.3.1"
implementation "org.robolectric:annotations:4.3.1"
implementation "org.robolectric:shadowapi:4.3.1"
kaptTest "com.google.auto.service:auto-service:1.0-rc6"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.6.2"
testImplementation "androidx.test:runner:1.2.0"
testImplementation "androidx.test:core:1.2.0"
testImplementation "org.mockito:mockito-core:3.3.3"
kaptAndroidTest "org.mockito:mockito-android:3.3.3"
}

Type com.google.android.gms.common.internal.zzf is referenced as an > interface from

I migrated my android Application to AndroidX (From menu Refactor-> Migrate to androidX), Now When I run the application it's working fine but when I try to generate signed .apk file I am getting an error like
Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzcdb.
Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzii.
Type com.google.android.gms.common.internal.zzf is referenced as an interface from com.google.android.gms.internal.zzcms.
Here is the List of dependencies I am using on my application,
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:29.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation('com.android.support:support-annotations:29.0.0')
implementation "com.android.support:design:29.0.0"
implementation 'com.android.support:support-v4:29.0.0'
implementation "com.google.android.material:material:1.0.0"
implementation 'com.google.android:flexbox:0.3.2'
implementation 'com.android.support:multidex:1.0.3'
implementation 'me.relex:circleindicator:1.2.2#aar' //For view pager circle
implementation 'com.jakewharton:butterknife:10.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.ybq:Android-SpinKit:1.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:okhttp:4.2.2'
implementation 'com.squareup.retrofit2:converter-gson:2.6.2'
implementation('com.squareup.retrofit2:retrofit:2.6.2') {
exclude module: 'okhttp'
}
implementation project(":photoview")
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.firebase:firebase-messaging:20.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.android:flexbox:0.3.2'
implementation('com.crashlytics.sdk.android:crashlytics:2.10.1#aar') {
transitive = true;
}
}
This is likely the cause of your problem:
implementation 'com.google.android.gms:play-services:12.0.1'
In fact, this dependency is very out of date. You should actually just remove it completely and let firebase-messaging just pull in what it needs.
If you need to use any specific play-services library, you should use one of the new, more granular ones listed here:
https://developers.google.com/android/guides/releases

All gms/firebase libraries must use the exact same version

I've made sure that the Firebase libraries are using the same version. However, it's saying:
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 15.0.0, 12.0.1. Examples include com.google.android.gms:play-services-ads-identifier:15.0.0 and com.google.android.gms:play-services-auth:12.0.
Gradle file:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
// Android Support
implementation "com.android.support:appcompat-v7:$androidSupportVersion"
implementation "com.android.support:customtabs:$androidSupportVersion"
implementation "com.android.support:support-v4:$androidSupportVersion"
implementation "com.android.support:design:$androidSupportVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:cardview-v7:$androidSupportVersion"
// Google Play & Firebase
implementation "com.google.android.gms:play-services-location:15.0.0"
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.firebaseui:firebase-ui:3.3.0'
// Dagger
implementation "com.google.dagger:dagger:$daggerVersion"
annotationProcessor "com.google.dagger:dagger-compiler:$daggerVersion"
// Network
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.retrofit2:adapter-rxjava:$retrofitVersion"
implementation "com.squareup.okhttp3:okhttp:$okHttpVersion"
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okHttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okHttpVersion"
implementation "com.facebook.stetho:stetho:$stethoVersion"
implementation "com.facebook.stetho:stetho-okhttp3:$stethoVersion"
implementation "com.squareup.retrofit2:converter-scalars:$retrofitVersion"
// RX
implementation 'com.google.code.gson:gson:2.8.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
// Misc
implementation 'com.github.amarjain07:StickyScrollView:1.0.2'
implementation 'com.yakivmospan:scytale:1.0.1'
implementation "com.jakewharton:butterknife:$butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion"
implementation 'com.github.jkwiecien:EasyImage:2.0.3'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.ganfra:material-spinner:2.0.0'
implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
implementation("com.github.hotchemi:permissionsdispatcher:$permissonDispatcherVersion") {
exclude module: "support-v13"
}
annotationProcessor "com.github.hotchemi:permissionsdispatcher-processor:$permissonDispatcherVersion"
implementation 'com.facebook.rebound:rebound:0.3.8'
implementation 'com.github.stfalcon:chatkit:0.2.2'
implementation 'nl.dionsegijn:konfetti:1.1.0'
implementation group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.56'
implementation 'com.android.support:multidex:1.0.3'
}
Check your transitive dependencies.
Simply run
gradlew [module]:dependencies
This will print a list for all dependencies and their dependencies.
Probably one of your "top level dependencies" includes a older version.
A solution would be to exclude these by saying:
implementation("com.example.m:m:1.0") {
exclude group: "org.unwanted", module: "x"
}

Style Base.Theme.AppCompat multiple implementation Android studio 3.1.1

Since the last update I'm getting some error in my styles.xml
The error, more specifically, is
Cannot resolve symbol Base
Cannot resolve symbol Base.Theme
With a multiple implementations tooltip (on ctrl + click)
And those are the possible implementation it suggest to me.
I would have ignored this, since my app is compiling and running anyway, but this is causing some annoying problems with my preview rendering and I hate it (for example I can't click a preview element to go to the code).
I think the problem might be in some of my implementations any of them probably use an old version, but they are all updated and I don't really understand why it was working before.
Any idea of the problem? Here are my dependencies
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.github.thorbenprimke:realm-recyclerview:0.9.25'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.android.gms:play-services-location:12.0.1'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.2'
implementation 'com.google.android.gms:play-services-vision:12.0.1'
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.okhttp3:okhttp:3.9.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.github.recruit-lifestyle:WaveSwipeRefreshLayout:1.6'
implementation 'nl.dionsegijn:konfetti:1.1.0'
implementation 'me.itangqi.waveloadingview:library:0.3.5'
implementation 'com.github.pratikbutani:MultiSelectSpinner:c3051c6922'
implementation 'com.github.BeppiMenozzi:TriStateToggleButton:1.1.4'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.1'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Try this downgrading dependencies of appcompact to 27.0.2
implementation 'com.android.support:appcompat-v7:27.0.2'

Categories

Resources