Manifest merger failed : Attribute application#appComponentFactory updating Firebase libraries - java

I am trying to add firebase in my project but when I implement 'com.google.firebase:firebase-messaging:19.0.0' and 'com.google.firebase:firebase-core:17.0.0'.
build.gradle(here is the error)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.user.mikripoli"
minSdkVersion 15
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "2g"
}
}
dependencies {
implementation 'com.roughike:bottom-bar:2.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.flaviofaria:kenburnsview:1.0.7'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.github.chrisbanes:PhotoView:2.1.4'
implementation 'com.google.firebase:firebase-messaging:19.0.0'
implementation 'com.google.firebase:firebase-core:17.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'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation "com.google.android.gms:play-services-location:17.0.0"
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-base:17.0.0'
implementation 'com.github.ahmedshaban1:EasySlider:1.0.0'
implementation 'com.liangfeizc:SlidePageIndicator:1.1.0#aar'
implementation 'me.relex:circleindicator:1.2.2#aar'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'
}
the other gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The error that show about com.android.support:support-v4:28.0.0:
Dependencies using groupId com.android.support and androidx.* can not
be combined but found
IdeMavenCoordinates{myGroupId='com.android.support',
myArtifactId='cardview-v7', myVersion='28.0.0', myPacking='aar',
myClassifier='null'} and
IdeMavenCoordinates{myGroupId='androidx.coordinatorlayout',
myArtifactId='coordinatorlayout', myVersion='1.0.0', myPacking='aar',
myClassifier='null'} incompatible dependencies
Inspection info:There are some combinations of libraries, or tools and
libraries, that are incompatible, or can lead to bugs. One such
incompatibility is compiling with a version of the Android support
libraries that is not the latest version (or in particular, a version
lower than your targetSdkVersion).
Also when I build the apk it shows this error:
Manifest merger failed : Attribute application#appComponentFactory
value=(android.support.v4.app.CoreComponentFactory) from
[com.android.support:support-compat:28.0.0]
AndroidManifest.xml:22:18-91 is also present at
[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86
value=(androidx.core.app.CoreComponentFactory). Suggestion: add
'tools:replace="android:appComponentFactory"' to element
at AndroidManifest.xml:13:5-354:19 to override.
adding tools:replace="android:appComponentFactory" doesn't work though

With new release, libraries are migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries.
The updated libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.
Method-1 :
add this two in your gradle.properties File, without updating anything
android.useAndroidX=true
android.enableJetifier=true
Method-2
if Method-1 doesn't solve your problem
do one thing
if you are using android studio version 3.2 or higher
go to Refactor>Migrate to AndroidX...

According to the firebase site to solve this issue:
Update your app to use Jetpack (AndroidX), you can do this by adding these two lines: android.useAndroidX=true and android.enableJetifier=true into file gradle.properties in the project root directory. Or you can do another method
Upgrade com.android.tools.build:gradle to v3.2.1 or later (in project build.gradle file)
Upgrade compileSdkVersion to 28 or later (in project build.gradle file)

Either downgrade those Firebase dependencies - or migrate to androidx.
The Jetifier is rather useless, because having control over the own dependencies.

You are using both support libraries and androidx libraries and you can't do it.
Cloud Messaging version 19.0.0 is in the June release. Check the official release notes of Firebase Libraries:
This release is a MAJOR version update and includes breaking changes.
With this release, libraries are migrated from the Android Support Libraries to the Jetpack (AndroidX) Libraries.
The updated libraries will not work unless you make the following changes in your app:
Upgrade com.android.tools.build:gradle to v3.2.1 or later.
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX); follow the instructions in Migrating to AndroidX.

28.0.0 was the last version of the original support libraries and these are no longer maintained. All functionality which was present in the support libraries is now a part of the AndroidX namespace and Google recommends that you move to AndroidX.
In Android Studio 3.2 and higher you can migrate by doing a Refactor->Migrate to AndroidX
However note that there may be some changes that you may have to do manually if you've specialized your configuration.
Here's a video on the topic and the official documentation

Try this and sync your project, if this can help you
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'

Related

How to fix 'ERROR: Failed to resolve: androidx'?

i back to work again to complete my application but when the application start syncing it gave me
Failed to resolve: androidx Affected Modules: href="openFile:D:/.android/Step View/Application/Source Code/app/build.gradle">app
I see a question like this but it didn't works for me. sorry for my bad english.
this is my gradle. app
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven {
url 'https://maven.google.com'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.xcoder.stepview"
minSdkVersion 17
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.connection_light.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id : '6a2c7692-81ec-4d12-b973-6b78f71f380e',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.github.kittinunf.fuel:fuel-android:1.12.1'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.github.bassaer:chatmessageview:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.github.markushi:circlebutton:1.1'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'commons-io:commons-io:2.5'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.connection_light:runner:1.1.1'
androidTestImplementation 'androidx.connection_light.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
In my case it was caused by a typo in build.gradle:
//androidTestImplementation 'androidx .test.espresso:espresso-core:3.2.0' // wrong!
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
I found the error by running the Gradle wrapper from the command line with the stacktrace option:
./gradlew clean build --stacktrace
Output:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException:
Could not find androidx. test.espresso:espresso-core:3.2.0.
Try to update all com.android* to the available com.androidx* versions that you can.
Make sure you have...
android.enableJetifier=true
android.useAndroidX=true
Added to your gradle.properties.
Or you could just do
With Android Studio 3.2 and higher, you can quickly migrate an existing project
to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
https://developer.android.com/jetpack/androidx/migrate
You are using both support library and androidx library in one project, that's the issue.
Change the support libraries to the preferred AndroidX library.
and also you can Migrate to AndroidX from Android Studio itself
Simply go to Refactor > Migrate to AndroidX > Migrate
add below code in gradle.properties file
android.enableJetifier=true
android.useAndroidX=true
more info for migration check this
for me it was
implementation 'androidx.appcompat:appcompat:1.1.0'
which must be
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
that means check versions and implement the last ones for each androidx you have.
you most upgrade all base library
change it
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
to
implementation 'androidx.appcompat:appcompat:1.+'
and
androidTestImplementation 'androidx.connection_light:runner:1.1.1'
to
androidTestImplementation 'androidx.test:runner:1.+'
and
androidTestImplementation 'androidx.connection_light.espresso:espresso-core:3.1.1'
to
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'

Failed to resolve: com.google.firebase:firebase-core:16.0.1

I'm trying to add firebase cloud storage to my app. Below is the app build.gradle. But it says:
Failed to resolve: com.google.firebase:firebase-core:16.0.1.
Why? There is no firebase-core in the dependencies at all.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.louise.udacity.mydict"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
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.google.cloud:google-cloud-storage:1.31.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
}
apply plugin: 'com.google.gms.google-services'
From the docs:-
Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.
Add:
implementation 'com.google.firebase:firebase-core:16.0.1'
and in top level gradle file use the latest version of google play services:
classpath 'com.google.gms:google-services:4.0.2'
https://firebase.google.com/support/release-notes/android
https://bintray.com/android/android-tools/com.google.gms.google-services
Note:
You need to add the google() repo in the top level gradle file, as specified in the firebase docs and also it should be before jcenter():
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
https://firebase.google.com/docs/android/setup
As #Peter Haddad mentioned above,
To fix this issue I followed Google firebase integration guidelines and did the following changes in my app/build.gradle and project/build.gradle
Follow below mentioned link if you have any doubts
https://firebase.google.com/docs/android/setup
changes in app/build.gradle
implementation 'com.google.android.gms:play-services-base:15.0.2'
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.4.0"
Changes in Project/build.gradle
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.2.0'// // google-services plugin it should be latest if you are using firebase version 16.0 +
}
allprojects {
repositories {
google()// add it to top instead of bottom or somewhere in middle
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com'
}
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Add maven { url "https://maven.google.com" } to your root level build.gradle file
repositories {
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}
Since May 23, 2018 update, when you're using a firebase dependency, you must include the firebase-core dependency, too.
If adding it, you still having the error, try to update the gradle plugin in your gradle-wrapper.properties to 4.5 version:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
and resync the project.
I get the same issue and i solved it by replacing :
implementation 'com.google.firebase:firebase-core:16.0.1'
to
implementation 'com.google.firebase:firebase-core:15.0.2'
and everything solved and worked well.
What actually was missing for me and what made it work then was downloading'Google Play services' and 'Google Repository'
Go to: Settings -> Android SDK -> SDK Tools -> check/install Google Play services + repository
Hope it helps.
I was able to solve the issue by following these steps-
1.) This error occurs when you didn't connect your project to firebase.
Do that from Tools->Firebase if you are using Android studio version 2.2 or above.
2.) Make sure you have replaced the compile with implementation in dependencies in app/build.gradle
3.) Include your firebase dependency from the firebase docs. Everything should work fine now
This is rare, but there is a chance your project's gradle offline mode is enable, disable offline mode with the following steps;
In android studio, locate the file tab of the header and click
In the drop own menu, select settings
In the dialog produced, select "Build, Execution, Deploy" and then select "Gradle"
Finally uncheck the "offline work" check box and apply changes
If this doesn't work leave a comment describing your Logcat response and i'll try to help more.
In my case it was resolved by changing the compileSdkVersion and targetSdkVersion from 26 to 27
If you use Firebase in a library module, you need to apply the google play services gradle plugin to it in addition to the app(s) module(s), but also, you need to beware of version 4.2.0 (and 4.1.0) which are broken, and use version 4.0.2 instead.
Here's the issue: https://github.com/google/play-services-plugins/issues/22
if you are using
compileSdkVersion 23
in app-level gradle, and
classpath 'com.android.tools.build:gradle:2.1.0'
in project-level gradle
and you have added the
google-services.json file to your project.
you need to add just below code
maven {
url "https://maven.google.com"
}
at below of jcenter() in repositories blocks in project-level gradle file
here are my gradle files:
project-level gradle file:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and app-level gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.moslem.amazonlikeapp"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
Just add below code and update all firebase versions that will work
implementation 'com.google.firebase:firebase-core:17.2.0'
If you receive an error stating the library cannot be found, check the Google maven repo for your library and version. I had a version suddenly disappear and make my builds fail.
https://maven.google.com/web/index.html
Go to
Settings -> Android SDK -> SDK Tools ->
and make sure you install Google Play Services

Using Navigation with AndroidX [duplicate]

I am using Android Studio version
Android Studio 3.2 Canary 14
Build #AI-181.4668.68.32.4763614, built on May 4, 2018
JRE: 1.8.0_152-release-1136-b02 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.11.6
While investigating the new Architectural navigation components android.arch.navigation I have encountered this build failure.
AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.os.ResultReceiver$1","sources":[{}],"tool":"D8"}
:app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives: ...
...
Program type already present: android.support.v4.os.ResultReceiver$1
My app gradle build resembles:-
apply plugin: 'com.android.application'
apply plugin: "androidx.navigation.safeargs"
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "com.research.frager"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
def nav_version = "1.0.0-alpha01"
implementation "android.arch.navigation:navigation-fragment:$nav_version"
implementation "android.arch.navigation:navigation-ui:$nav_version"
// optional - Test helpers
androidTestImplementation "android.arch.navigation:navigation-testing:$nav_version"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha2'
}
and project level gradle build:-
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have tried refactoring to AndroidX, however I get a message stating No usages found in project, so why is this "v4" class still being mentioned?
I've been looking at this issue and I have sorted the main issue here by excluding the support package when adding the dependency to the library, doing this:
implementation("android.arch.navigation:navigation-fragment:$nav_version") {
exclude group: 'com.android.support'
}
That would allow you to run the application. However, this artifact is using the support artifacts rather than the androidx artifacts. Looking at the documentation, we can see that NavHostFragment is extending support.v4.Fragment
https://developer.android.com/reference/androidx/navigation/fragment/NavHostFragment
So, in short, you are presented with three options, as far as I can see. The first one is to drop the androidx artifacts and use the support ones which eventually depends on how big your app is.
The second option is to drop the navigation library and go back to the classic way of dealing with navigation which, I guess, is probably undesirable for you.
The third option is to implement a navigation host of your own which I don't know how much work it would be.
This response will remain accurate until Google releases the androidx version of the library which I am surprised they haven't already.
Hope that was helpful.

Error:Execution failed for task ':app:preDebugAndroidTestBuild' , when tried to run java program in android studio

Getting the below error at the time of running java program in android studio.
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
Any solution please. ?
Use implementation 'com.android.support:appcompat-v7:27.1.1'
instead of implementation 'com.android.support:appcompat-v7:26.1.0' and change compileSdkVersion 26 to 27
thanks to #Ganesh Bhat and Chad Bingham
For those who still facing the problem, above answer did not help me in android studio 2.2 Preview.
This fixed my issue.
add this to your gradle file.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.1.1'
}
}
Reference:
https://github.com/JakeWharton/u2020/blob/05a57bf43b9b61f16d32cbe8717af77cd608b0fb/build.gradle#L136-L140
Android support library error after updating to 23.3.0
Resolved versions for app (22.0.0) and test app (21.0.3) differ
update
- if the previous answer doesn't work :
you should update the compileSdkVersion and appcompat to the latest update till now compileSdkVersion is 27 ,
also appcompat is 27.1.1 and 28.0.0-alpha1 is a pre-release version
thus
change
compileSdkVersion 27
and
implementation 'com.android.support:appcompat-v7:26.1.0'
to latest update
implementation 'com.android.support:appcompat-v7:27.1.1'
you can check the latest updates from this link :
https://developer.android.com/topic/libraries/support-library/revisions
I answered before some minutes same question Reference. If you are not going to implement testing code, then remove junit from your app.
There are lot of other questions related to this.
Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ
Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ
Add this to your app gradle file
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.1.0'
}
}
Add these lines within your app dependencies braces,
android{
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
}
Latest is 27.1.1 upto this date.
AS configuration version:
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.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'**
Modify:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.0.0-beta1'
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'**
Well, I too faced the same problem here is how I fixed it
Goto app level Gradle file
There you will find what are all the config's you have set up. In my case here
android{
**compileSdkVersion 26**
defaultConfig {
applicationId "com.xxxxxxxxxxx.yyyyyyyy.zzz"
minSdkVersion 19
**targetSdkVersion 26**
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:26.1.0'**
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
So here just change the compileSdkVersion & targetSdkVersion from 26 to 27
and
from dependencies change support appcomat
from implementation 'com.android.support:appcompat-v7:26.1.0'
to implementation 'com.android.support:appcompat-v7:27.1.1'
android {
**compileSdkVersion 27**
defaultConfig {
applicationId "com.xxxxxxxxxxx.yyyyyyyy.zzz"
minSdkVersion 19
**targetSdkVersion 27**
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:27.1.1'**
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
Got Fixed !!!
Hello guys I had the same problem for solving this problem u need to change you appcompat in your app bulid gradle to
implementation 'com.android.support:appcompat-v7:27.1.1'
then it should ask you to instal it if u have'nt installed if still errore didnt solved change your sdkversions it will help alot because if u change the appcompact
to 27.1.1 u need to change your sdkversion to 27 as well i suggest all of u to update your android studio and the sdk to the lastest
Try below change if it helps you
com.android.support:appcompat-v7:26.1.0
to
com.android.support:appcompat-v7:27.1.1
Error:
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app
(27.1.1) differ. See
https://d.android.com/r/tools/test-apk-dependency-conflicts.html for
details.
This is due to there is no dependency added to your App build.gradle or might be its an old version. So, add a dependency for annotation support.
implementation 'com.android.support:support-annotations:27.1.1'
Here I have added annotation version 27.1.1 to solve your error if this is mismatched with different version then change it to the required version.
I found this very easy.
We will use update and use same version for all modules.
1. Go to project level build.gradle, use global variables
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlinVersion = '1.2.61'
ext.global_minSdkVersion = 16
ext.global_targetSdkVersion = 28
ext.global_buildToolsVersion = '28.0.1'
ext.global_supportLibVersion = '27.1.1'
}
2. Go to app level build.gradle, and use global variables
app level build.gradle
android {
compileSdkVersion global_targetSdkVersion
buildToolsVersion global_buildToolsVersion
defaultConfig {
minSdkVersion global_minSdkVersion
targetSdkVersion global_targetSdkVersion
}
...
dependencies {
implementation "com.android.support:appcompat-v7:$global_supportLibVersion"
implementation "com.android.support:recyclerview-v7:$global_supportLibVersion"
// and so on...
}
some library/module build.gradle
android {
compileSdkVersion global_targetSdkVersion
buildToolsVersion global_buildToolsVersion
defaultConfig {
minSdkVersion global_minSdkVersion
targetSdkVersion global_targetSdkVersion
}
...
dependencies {
implementation "com.android.support:appcompat-v7:$global_supportLibVersion"
implementation "com.android.support:recyclerview-v7:$global_supportLibVersion"
// and so on...
}
The solution is to make your versions same as in all modules. So that you don't have conflicts.
Tips for future
I felt when I have updated versions of everything- gradle, sdks,
libraries etc. then I face less errors. Because developers are working
hard to make it easy development on Android Studio.
Always have **latest but stable versions** Unstable versions are alpha, beta and rc, ignore them in developing.
I have updated all below in my projects, and feel flawless coding.
Update Android Studio (Track release)
Project level build.gradle - classpath 'com.android.tools.build:gradle:3.2.0' (Track android.build.gradle release & this)
Have updated buildToolVersion (Track buildToolVersion release)
Have latest compileSdkVersion and targetSdkVersion Track platform release
Have updated library versions, because after above updates, its necessary. (#See How to update)
Happy coding! :)
its important to take a look at this too, in your gradle
targetSdkVersion 27
compileSdkVersion 27
buildToolsVersion '27.0.3'
Go to settings>editor> Then check those two boxes as displayed in the image. It should solve it without any issue.
Add This Code to the bottom of build.gradle at app level. It will work...
configurations.all {
resolutionStrategy.eachDependency{
DependencyResolveDetails details ->
def requested=details.requested
if(requested.group=="com.android.support"){
if(!requested.name.startsWith("multidex")){
details.useVersion("26.0.1")
}
}
}
}

FireBase Error: cannot access zzanb class file for com.google.android.gms.internal.zzanb not found

UPD. I have read these question and answer (Class file for com.google.android.gms.internal.zzaja not found). But I doesnt understand what strings i need to add or remove in my project.
Because I havent this and other strings in my code:
compile 'com.google.android.gms:play-services-location:9.2.0'
I develop an android app with use of FireBase. And when I want to build my project I have an error:
Error:(39, 25) error: cannot access zzanb
class file for com.google.android.gms.internal.zzanb not found
The error was caused by invoking statement: FirebaseAuth.getInstance().getCurrentUser();
Projects build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Modules build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "xxx.yyy.zzz"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.1.0'
compile 'com.google.firebase:firebase-core:10.0.1'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:25.1.0'
compile 'com.firebaseui:firebase-ui:0.6.0'
compile 'com.android.support.test.espresso:espresso-core:2.2.2'
}
apply plugin: 'com.google.gms.google-services'
Please, help me to solve that error)
P.S I have already read that question (Firebase Error cannot access zzanb after using play-services-xxx:9.8.00), but i didnt understand anything, what i need to add or remove from my build.gradle files in my situation.
You're mixing libraries from old and new Firebase released. Everything from Firebase that you use should be in parity. This line is reference an library from a very old Firebase release (before it became the Firebase platform at Google):
compile 'com.firebaseui:firebase-ui:0.6.0'
If you want to use the Firebase-UI library, you should use the new version of it that matches the version of the main client library you're using. You're using 10.0.1, so according to the table on the Firebase-UI github I just linked, you want this dependency:
compile 'com.firebaseui:firebase-ui:1.1.1'
Always make sure your Firebase-UI library matches the core Firebase SDK you're using.
It looks like in your case Doug's fix resolved your issue, but we recently encountered the same problem with a different root cause.
In our case, we had configured our IDE project to use JDK8 but failed to check which version of the JDK was in use in the terminal. Because React Native runs Gradle from the command line when you type 'react-native run-android' Gradle was attempting to build using JDK10 which caused obvious issues since Android currently only supports up to JDK8. Once we configured the terminal to use JDK8 the issue was resolved.
TL;DR: Check what version of the JDK you are using in the terminal.
Getting following error:
error: cannot access zza
class file for com.google.android.gms.common.internal.safeparcel.zza not found
dependencies {
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.android.support:support-v4:28.0.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.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
/* implementation 'com.google.firebase:firebase-core:9.2.0' // this line must be included to integrate with Firebase
implementation 'com.google.firebase:firebase-messaging:10.2.1' // this line must be included to use FCM*/
//implementation 'com.google.android.gms:play-services:10.2.1'
implementation 'com.google.android.gms:play-services-maps:10.2.1'
implementation 'com.google.firebase:firebase-core:10.2.1'
implementation 'com.google.firebase:firebase-messaging:10.2.1'
}

Categories

Resources