I have to migrate my project to AndroidX to support a certain third part library but when I try to migrate using Android Studio provided tool through Refactor > Migrate to AndroidX I always get this error
ERROR: Failed to resolve: cardview Affected Modules: app
here are my dependencies:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha02'
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.synnapps:carouselview:0.1.5'
implementation 'com.amitshekhar.android:android-networking:1.0.2'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.thoughtbot:expandablerecyclerview:1.3'
implementation 'com.robertlevonyan.view:MaterialChipView:1.2.5'
implementation 'com.github.tcking:giraffeplayer2:0.1.19-lazyLoad'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.1.0'
implementation 'com.github.sundeepk:compact-calendar-view:3.0.0'
implementation 'com.github.cdflynn:turn-layout-manager:v1.2'
implementation 'com.github.takusemba:multisnaprecyclerview:1.3.3'
implementation 'com.ramotion.cardslider:card-slider:0.3.0'
implementation 'com.ramotion.circlemenu:circle-menu:0.3.2'
// implementation 'com.github.halilozercan:BetterVideoPlayer:1.2.alpha1'
implementation 'com.github.ybq:Android-SpinKit:1.1.0'
implementation 'com.budiyev.android:circular-progress-bar:1.2.2'
implementation 'com.github.GrenderG:Toasty:1.3.1'
implementation 'fm.jiecao:jiecaovideoplayer:5.7'
implementation 'com.github.cdflynn:turn-layout-manager:v1.2'
implementation 'io.github.yavski:fab-speed-dial:1.0.6'
implementation 'com.github.yalantis:ucrop:2.2.2'
//animation library
implementation 'com.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
// implementation 'com.facebook.android:account-kit-sdk:4.37.0'
// implementation 'com.google.android.gms:play-services-auth:16.0.1'
}
Migrating to android x has weird bugs updating your android studio to newest version might solve it
also you can set android.enablejetifier to false in gradle.properties and you won't see this error but you should use androidx libraries
Related
I am using the Glide samples to add SVG support to my application (Glide uses AndroidSVG for parsing the SVG).
See
https://github.com/bumptech/glide/tree/v4.10.0/samples/svg
https://bigbadaboom.github.io/androidsvg/
I took Glide's sample and put it in a basic application and it works perfectly.
I then added the same changes into my existing product application which is quite large and now my application fails to compile. The error is
error: cannot access Exported
class file for oracle.javatools.annotations.Exported not found
cannot access Exported
I have no additional information from IntelliJ about this issue. I'm thinking it must be a conflicting dependency issue but I can not figure how to find out what.
I have searched the internet and StackOverflow and I can not see anything similar to this query.
Has anyone else seen an issue like this?
The working sample app's app build.gradle deps
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.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 "androidx.fragment:fragment:1.5.4"
// SVG SUPPORT
implementation 'com.caverock:androidsvg:1.2.1'
// GLIDE
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.github.bumptech.glide:annotations:4.10.0'
// Skip this if you don't want to use integration libraries or configure Glide.
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
My product application's dependencies
implementation group: 'commons-lang', name: 'commons-lang', version: '2.6'
// force specific version of dependency in 'constraints'
constraints {
implementation('commons-io:commons-io:2.4') {
because 'Must be 2.4 as later versions of commons-io break login on API < 27'
}
}
implementation 'com.android.volley:volley:1.2.1'
implementation 'commons-fileupload:commons-fileupload:1.4'
implementation 'org.apache.httpcomponents:httpmime:4.3.6'
implementation "com.google.android.exoplayer:exoplayer-ui:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-dash:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-core:$exoplayer_version"
implementation "com.google.android.exoplayer:exoplayer-smoothstreaming:$exoplayer_version"
implementation "com.google.android.exoplayer:extension-okhttp:$exoplayer_version"
implementation 'androidx.webkit:webkit:1.4.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
implementation 'androidx.annotation:annotation:1.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.google.guava:guava:29.0-android'
implementation "com.squareup.okhttp3:okhttp-urlconnection:$okhttp_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation 'com.squareup:otto:1.3.8'
implementation 'com.squareup.okio:okio:2.10.0'
implementation 'com.jakewharton:disklrucache:2.0.2'
implementation 'com.google.firebase:firebase-analytics:18.0.3'
implementation 'com.google.firebase:firebase-config:20.0.4'
implementation 'com.google.firebase:firebase-messaging:21.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'androidx.lifecycle:lifecycle-process:2.4.1'
implementation 'androidx.lifecycle:lifecycle-runtime:2.4.1'
implementation 'androidx.lifecycle:lifecycle-common-java8:2.4.1'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.github.bumptech.glide:annotations:4.10.0'
// The following is needed as we want to configure Glide to make use of SVGAndroid
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
// support for SVGs (https://bigbadaboom.github.io/androidsvg/)
implementation 'com.caverock:androidsvg-aar:1.3'
implementation 'org.apache.commons:commons-lang3:3.10'
implementation "io.reactivex.rxjava3:rxandroid:3.0.0"
implementation 'net.openid:appauth:0.11.1'
// and some additional deps of jars from our own code base
In my application I want build APK, but after some times show me below error :
Execution failed for task ':codecanyon:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':codecanyon:debugRuntimeClasspath'.
> Could not find interpolator-1.0.0.jar (androidx.interpolator:interpolator:1.0.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/interpolator/interpolator/1.0.0/interpolator-1.0.0.jar
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
When click on this URL : https://dl.google.com/dl/android/maven2/androidx/interpolator/interpolator/1.0.0/interpolator-1.0.0.jar
open URL but show me 404 error !
My dependencies :
dependencies {
implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'com.google.android.material:material:1.4.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.00'
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.webkit:webkit:1.4.0'
// loader
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
}
How can I fix it?
All of my code is working perfect when I have these dependencies
//noinspection GradleCompatible
implementation 'com.google.android.gms:play-services-places:11.0.4'
implementation 'com.google.android.gms:play-services-location:11.0.4'
implementation 'com.google.android.gms:play-services-maps:11.0.4'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-core:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4' }
but when I add
implementation 'com.google.android.gms:play-services-ads-identifier:15.0.1'
It shows me error that :-
Error:The library com.google.android.gms:play-services-basement is being requested by various other libraries at [[11.0.4,11.0.4]], but resolves to 15.0.1. Disable the plugin and check your dependencies tree using ./gradlew :app:dependencies.
I have already tried updating my gms library but when I do that I will need to make several changes to the code to meet the new release requirements. I am looking for a quick solution of solving it .
The current versions I am using are mentioned below :-
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:4.0.2'
Use following
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
instead of this
implementation 'com.google.android.gms:play-services-places:11.0.4'
implementation 'com.google.android.gms:play-services-location:11.0.4'
implementation 'com.google.android.gms:play-services-maps:11.0.4'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-core:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
I made a app find nearby place but i get this error
> Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.common.internal.zzbq" on path: DexPathList[[zip file "/data/app/vapelit.unikomapps.com.vapelitfinal-1/base.apk"
Here my gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
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'
compile 'com.synnapps:carouselview:0.1.5'
compile 'com.android.support:multidex:1.0.0'
implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.0'
implementation 'com.google.android.gms:play-services-auth:15.0.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
}## Heading ##
You need to implement this :
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
and add this in your gradle :
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.0'
}
}
}
}
and in your gradle you have to delete this :
implementation 'com.google.android.gms:play-services-maps:15.0.0'
and keep only this:
implementation 'com.google.android.gms:play-services-maps:16.0.0'
Happy Coding ;)
#Agam
In your gradle code your are using google map library with different version. So remove old version library and make sure you are using same version of all google play service library which are related to each other.
Try to update below line in your gradle file and remove google play service library which include all google play services file under one gradle library. For mode details about google play service visit on Google Play Service Version with Table 1:
implementation 'com.synnapps:carouselview:0.1.5'
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.android.gms:play-services-location:16.0.0'
I hope you will resolve your problem.
I have various Firebase libraries in my project, and it appears there is some sort of conflict causing the build to fail. Below is my build.gradle:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// Support library
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
// Firebase
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'
// Third party
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
implementation 'jp.wasabeef:recyclerview-animators:2.2.3'
implementation 'com.github.clans:fab:1.6.2'
implementation 'de.hdodenhof:circleimageview:2.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.github.PhilJay:MPAndroidChart:v2.2.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.android.support:multidex:1.0.3'
//
// implementation "android.arch.core:runtime:1.1.1"
// implementation "android.arch.core:common:1.1.1"
}
When I add the following, I am able to build successfully:
implementation "android.arch.core:runtime:1.1.1"
implementation "android.arch.core:common:1.1.1"
I posted a similar question here, and I posted my logging there for reference as well. My concern is the addition of the 2 dependencies above is only a temporary solution, as I would not want to publish my app with those dependencies. Any help appreciated!
To solve this, please change the following lines of code:
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.firebaseui:firebase-ui-database:4.2.0'
implementation "com.google.firebase:firebase-firestore:17.1.2"
implementation 'com.firebaseui:firebase-ui-firestore:4.0.1'
to
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.firebaseui:firebase-ui-database:4.2.1'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'
Make also sure to use ' instead of ".
It turns out, the issue was related to either the Firebase Database dependencies or the Firebase UI dependencies. I was able to resolve with the dependencies below:
// Firebase
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-appindexing:16.0.2'
implementation 'com.google.firebase:firebase-firestore:17.1.3'
implementation 'com.firebaseui:firebase-ui-firestore:4.2.1'