Why AppCompatActivity not exist after implement firebase - android

After implement Firebase on my two projects, AppCompatActivity along with import androidx.appcompat.app.AppCompatActivity and import android.support.v7.app.AppCompatActivity are not found.
I've been looking for five hours. And even after removing the implementation it doesn't work.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.company.pc.livium"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.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:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.anjlab.android.iab.v3:library:1.0.44'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}

Go to Refactor -> Migrate to AndroidX… and migrate your project to AndroidX.
AppCompat is deprecated, your build.gradle should look something like this under depenedencies {}:
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core:1.0.2'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

You can try:
1. Build -> Clean project than Build -> Rebuild Project
if that doe not help
2. File -> Invalidate Caches/Restart (Take a few minutes to perform)

Related

Assistance with android studio gradle

This is my first post but I need some help,
This is my error :
error: package android.support.design.widget does not exist
import android.support.design.widget.FloatingActionButton;
This is my gradle codes
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.example.weatherviewerappeliasshahsamand"
minSdkVersion 23
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
implementation 'com.google.android.material:material:1.2.0-alpha06'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
}
You have both support library and androidx library in your project...I think this must be issue.
You can use:
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
Instead of:
implementation 'com.android.support:appcompat-v7:28.0.0'
And you can replace your other support library codes and use androidx Library
You have migrated some of the dependencies to AndroidX but still some of the dependencies doesn't seems to match with android X .You will have to replace some of your dependencies to the latest version:
Replace
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:gridlayout-v7:28.0.0'
with
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
Now as the error message please replace the widgets to androidx or Migrate by
Refactor > Migrate to AndroidX > Migrate

android gradle error: libraries must use the exact same version specification.found version 28.0.0

This is app level dependency.I have been trying to add firebase to my app.but it shows an error
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rachitshah.fireapp"
minSdkVersion 15
targetSdkVersion 28
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'])
error in this line
implementation 'com.android.support:appcompat-v7:28.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'
this is firebase dependency.
implementation 'com.google.firebase:firebase-core:16.0.1'
When you add firebase dependency in gradle file by adding
implementation 'com.google.firebase:firebase-core:16.0.1'
Then there are 2 libraries have been added in your app as well
com.android.support:support-media-compat:26.1.0
com.android.support:support-v4:26.1.0
Their versions are different from versin 28.0.0 that why the error occurs.
To fix this error, change your gradle file
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
// Add this line
implementation 'com.android.support:support-v4:28.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.google.firebase:firebase-core:16.0.1'
}
check out this post
android manifest merger failed, gms play services / firebase
You probably imported a library that does not use the specified version 28. So either remove the specification or make sure they are all on the same version

How do i fix Authentication error android app

image
Hi, how do i fix Firebase authentication error - "failed to resolve: firebase-auth-15.0.0"
`apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.anton1111.azot2.antonio_chat"
minSdkVersion 17
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
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.firebase:firebase-auth:16.0.1'
}`
you have the same implementation twice at your dependencies
implementation 'com.google.firebase:firebase-auth:16.1.0'
and
implementation 'com.google.firebase:firebase-auth:16.0.1'
remove the last one and just let firebase-auth:16.1.0
The one you posted in your photo has two versions, and that is causing the error
implementation 'com.google.firebase:firebase-auth:16.0.1:15.0.0' <--- 16.0.1 and 15.0.0
delete one version and just use the latest one
implementation 'com.google.firebase:firebase-auth:16.1.0'
The stable version for gradle on Firebase website is:
implementation 'com.google.firebase:firebase-auth:16.0.5'
You should give it a try to see if this works.
Latest stable version for gradle on FireBAse is:
implementation 'com.google.firebase:firebase-auth:16.0.5'
You should give it and for more details please see link

All com.android.support libraries must use the exact same version specification using firebase

so i recently added the firebase database dependencies to my gradle and i got this message after sync
'all com.android.support libraries must use the same exact version
specification(mixing versions can lead to runtime crashes). Found
versions 28.0.0-rc02, 26.1.0. Examples include
com.android.support:animated-vector-drawable:28.0.0-rc02 and
com.android.support:support-v4:26.1.0'
my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "..."
minSdkVersion 21
targetSdkVersion 28
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:28.0.0-rc02'
implementation 'com.android.support:support-media-compat:28.0.0-rc02'
implementation 'com.android.support:animated-vector-drawable:28.0.0-rc02'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database: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'
}
apply plugin: 'com.google.gms.google-services'
what changes should i make to stop getting this error message?
JUST A SUGGESTION
I suggest, for now, you should use v7:27 instead of v7:28. As there are many unanswered questions about this version. I too fallback to previous version, and until it is stable then, you can update it.
So you can try this:
Change your sdkVersion to 27
android {
compileSdkVersion 27
defaultConfig {
targetSdkVersion 27
}
...
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database: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'
}

Gradle Issue Android Studio

I am having issues with gradle in my android application.
android {
compileSdkVersion 27
defaultConfig {
applicationId "za.co.gtsolutions.vivachoc"
minSdkVersion 15
targetSdkVersion 27
versionCode 2
versionName "1.5"
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.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
implementation 'com.github.bumptech.glide:glide:4.6.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.stripe:stripe-android:6.1.2'
implementation 'com.google.code.gson:gson:2.8.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'testfairy:testfairy-android-sdk:1.+#aar'
testImplementation "org.robolectric:robolectric:3.8"
implementation 'com.facebook.android:facebook-login:4.32.0'
android {
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
compile 'com.android.support:cardview-v7:27.1.1'
compile 'com.android.support.test.espresso:espresso-contrib:3.0.1'
}
I get the following error: all com.android.support libraries should use the same version and my application will not run because of this. I have changed the minimumSDK Version and targetVersion to apply to the project that i am working on.
I am totaly lost on what the issue could be ?
use 27.0.2 instead of 27.1.1 like below
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support:cardview-v7:27.0.2'
The answer after sometime is guided by the following answer: All com.android.support libraries must use the exact same version specification was the following:
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:animated-vector-drawable:27.1.1'
implementation "com.android.support:customtabs:27.1.1"
The application needs to use the customtabs library which was missing

Categories

Resources