Can't import Firebase library to AndroidStudio - android

I can't import the "import com.google.firebase.auth.FirebaseAuth;" for my Android Studio.
I checked everything already. All build gradle are setted with the latest Firebase version.
The only import that allows me to do is "FirebaseAuthException" and "FirebaseUser"
Someone help me. thank you.
Project Build.Gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Build.gradle(Module:app)
repositories {
maven {
url "https://maven.google.com"
}
maven { url "https://jitpack.io" }
}
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.rick.teddyfy"
minSdkVersion 23
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'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
//Design layout
compile 'com.android.support:design:26.1.0'
compile 'com.github.ittianyu:BottomNavigationViewEx:1.2.3'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//firebase authentication
'com.google.firebase:firebase-auth:10.2.6'
}
apply plugin: 'com.google.gms.google-services'

The dependency has syntax errors, it should be like this:
compile 'com.google.firebase:firebase-auth:10.2.6'

Related

support media compact 25.4.0 file not found error

One of my old project I am getting following error.
as 25.4.0 jar file not present how to solve this without upgradition of project compile, build tool version as other developers also working on this project.
Could not find support-media-compat.jar (com.android.support:support-media-compat:25.4.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-media-compat/25.4.0/support-media-compat-25.4.0.jar
Only for my Android studio I am getting this issue for other team mates there project is working fine
here is my gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.27.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url "http://dl.bintray.com/lukaville/maven"
}
}
android {
compileSdkVersion 25
buildToolsVersion "25"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.m.p"
minSdkVersion 16
targetSdkVersion 26
versionCode 5
versionName "1.4"
multiDexEnabled true
}
buildTypes {
/*release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}*/
}
dexOptions {
javaMaxHeapSize "2g"
}
configurations {
all*.exclude module: 'gson'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true
}
compile project(':commons')
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.4.0'
compile 'com.android.support:support-media-compat:25.3.1'
compile 'com.android.support:design:25.4.0'
compile 'com.android.support:cardview-v7:25.0.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.roomorama:caldroid:3.0.1'
compile 'com.github.lsjwzh.RecyclerViewPager:lib:v1.1.2'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.google.android.gms:play-services-location:9.8.0'
compile 'com.google.maps.android:android-maps-utils:0.4.4'
compile 'com.github.jrvansuita:CheckNewAppVersionAvailable:v1.0.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'uk.co.chrisjenx:calligraphy:2.3.0'
// compile 'com.github.PhilJay:MPAndroidChart:v2.2.4'
compile 'com.github.PhilJay:MPAndroidChart:v3.0.2'
// compile 'com.github.PhilJay:MPAndroidChart:v3.1.0'
compile 'com.github.barteksc:android-pdf-viewer:2.0.3'
}
and here is my common library which include inside project
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
}
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.0.0'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.2.4'
}
You messed up your build.gradle(project), I recommend you revert it back to its or default form.
You usually make changes on build.gradle(module) and let it sync.
I found some lines of code that shouldn't belong on the build.gradle(project).
build.gradle(Project) should look like this.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module) should look like this.
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
defaultConfig {
applicationId "com.example.barcodescanner"
minSdkVersion 17
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(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.gms:play-services-vision:18.0.0'
implementation 'com.android.support:design:29.0.0'
implementation 'com.google.firebase:firebase-auth:19.0.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.google.firebase:firebase-database:19.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
compile is replace by implementation
inside the build.gradle of project, label add
allprojects {
repositories {
google()
jcenter()
}
}
And update your dependency to the latest version as google play store is not allowing to upload the app which is targeting the SDK version less then oreo (8.0+).
Replace compile to implementation.

Update SDK: Failed to resolve: com.android.support:appcompat-v7

I'm using Android Studio 2.3.3 and updated my SDK version and now I'm using API 27 but I encountered the following error:
Also I install repository and sync project but This error occurred:
This code is gradle.build (project):
// 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.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Also this code is gradle.build (Module:app )
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.0'
defaultConfig {
applicationId "comp.packk.ir"
minSdkVersion 14
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 {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:27.1.1'
}
What is the solution?
implementation or compile 'com.android.support:appcompat-v7:27.1.1'
implementation or compile 'com.android.support:cardview-v7:27.1.1'
implementation or compile 'com.android.support:design:27.1.1'

Gradle sync failed || Android Studio

I get the error message Gradle sync failed. I already searched for solutions on stackoverflow and found similar problems but the solution there could not solve my problem:
Example-->
syncing android gradle appcompat 27.0.1
build Gradle//Project is like this-->:
buildscript {
repositories {
jcenter()
maven { url "http://jcenter.bintray.com"}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
mavenCentral()
jcenter{ url "http://jcenter.bintray.com/" }
maven {
//url "https://jitpack.io"
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and the build gradle module is like this-->:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "hibo.testxml"
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')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:27.3.1'
// FireBase
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
testCompile 'junit:junit:4.12'
}//Add this line
apply plugin: 'com.google.gms.google-services'
I hope somone can help me solve this problem.
ps:thanks in advance :D
By The way your problem is that you are using different versions for build tools and in dependencies.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "hibo.test"
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')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:27.0.3'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:25.3.1'
// FireBase
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
testCompile 'junit:junit:4.12'
}//Add this line
apply plugin: 'com.google.gms.google-services'
Now use this in your gradle. May be you have not 27.0.3 install. Then an error will come in gradle Console. Then install these tools by clicking the error.

Got Error during adding picasso dependencies com.squareup.picasso:picasso:2.5.2

I trying to add picasso dependencies even any dependencies but got Error:
Error:(26, 13) Failed to resolve: com.squareup.picasso:picasso:2.5.2
Show in File Show in Project Structure dialog
whats the problem & any solution?
my build.gradle (module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.dr.myapplication"
minSdkVersion 18
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')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.synnapps:carouselview:0.1.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.android.volley:volley:1.0.0'
compile 'com.google.code.gson:gson:2.8.2'
compile 'junit:junit:4.12'
}
my build.gradle(project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Issues with updating my app version in gradle file

So I was using API 25 which is Nougat version, and I wanted to update my app to Version ApI27 which is newly out these days. but whenever I update to 27.0.1, this Error:
"Error:Failed to resolve: com.android.support:appcompat-v7.27.0.1"
keeps occurring. I don't know what I've done wrong and I'm struggling all day to find the resolution. Thank you very much for your time and assistance in this matter.
Oh, and I'm sure that I've downloaded SDK Versions and all the files that are needed already in SDK manager.
My Gradle File(Module App):
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.1'
defaultConfig {
applicationId "org.poream.dejaview"
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 'com.google.firebase:firebase-storage:11.6.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:design:27.0.1'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.android.support:appcompat-v7.27.0.1'
compile 'com.android.support:design:27.0.1'
compile 'com.google.android.gms:play-services-maps:11.6.0'
compile 'com.android.support:cardview-v7:27.0.1'
compile 'com.google.android.gms:play-services-location:11.6.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-database:11.6.0'
compile 'com.google.firebase:firebase-crash:11.6.0'
compile 'com.google.firebase:firebase-auth:11.6.0'
compile 'com.android.support:support-v4:27.0.1'
compile 'com.android.support:recyclerview-v7:27.0.1'
compile 'com.google.android.gms:play-services-auth:11.6.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
My Gradle File(Project):
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
jcenter()
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
There is a typo (the . instead of :)
compile 'com.android.support:appcompat-v7.27.0.1'
Use:
compile 'com.android.support:appcompat-v7:27.0.1'
Add maven { url 'https://maven.google.com/' } line in your project level build.gradle
repositories {
maven { url 'https://maven.google.com/' }
}

Categories

Resources