I have such a problem I can't figure out how to solve it. I have a task to make geofencing + firebase token. Geofencing works well even in the background, but if I add com.google.gms.google-services it stops my geofencing in the background, I tried different versions but nothing works. Maybe someone had the same problem, help what you can., thank you! Here is my build.gradle.
/// 1
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath 'com.google.gms:google-services:4.3.10' // Google Services plugin
// 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
}
/// 2
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
}
dependencies {
//common
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.7.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation("androidx.work:work-runtime-ktx:2.7.1")
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.alimuzaffar.lib:pinentryedittext:2.0.6'
implementation "org.jetbrains.kotlin:kotlin-reflect:1.5.0"
//network
implementation 'com.google.code.gson:gson:2.8.7'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.5'
//dagger
kapt "com.google.dagger:dagger-compiler:2.17"
implementation "com.google.dagger:dagger:2.17"
//moxy
implementation 'tech.schoolhelper:moxy-x:1.7.0'
implementation 'tech.schoolhelper:moxy-x-androidx:1.7.0'
kapt 'tech.schoolhelper:moxy-x-compiler:1.7.0'
implementation 'com.github.orangegangsters:swipy:1.2.3#aar'
//firebase
implementation platform('com.google.firebase:firebase-bom:30.0.1')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.firebase:firebase-messaging'
//locations
implementation "com.google.android.gms:play-services-location:18.0.0"
implementation 'com.google.android.gms:play-services-maps:18.0.0'
//billing
def billing_version = '4.1.0'
implementation "com.android.billingclient:billing-ktx:$billing_version"
implementation 'com.anjlab.android.iab.v3:library:2.0.3'
}
Related
Directions parts are not generated in Java (Generated) even though I have specified fragment actions in Android Studio and many time rebuild project[enter image description here][1]. So I can't use directions. What would be the reason?
Builde.graddle
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
def nav_version = "2.5.2"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
}
}
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
allprojects {
repositories {
google()
mavenCentral()
}
}
build.graddle[app]
plugins {
id 'com.android.application'
id("androidx.navigation.safeargs")
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.navigation:navigation-fragment:2.5.2'
implementation 'androidx.navigation:navigation-ui:2.5.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation platform('com.google.firebase:firebase-bom:30.4.0')
implementation 'com.google.firebase:firebase-database:20.0.6'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.android.gms:play-services-auth:20.3.0'
}
Not generated(screenshot)
I have a problem, Android Studio highlights by viewModels() as an error, but the code is successfully compiled and works. This problem occurs only in Activity, in Fragment there is no such error. The same will happen if I use by viewModel() (Koin) instead of by viewModels(). I’ve looked at a lot of decisions, but none of them helped me.
I tried:
Invalidate Caches
Restart IDE, PC...
Open a project on another PC
Tried this answer and this
Error
My dependencies (app):
implementation(project(":domain"))
implementation(project(":data"))
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
def koin_version= "3.2.1"
implementation "io.insert-koin:koin-android:$koin_version"
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.8.0-alpha01'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
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-ktx:1.5.3"
implementation 'com.my.target:mytarget-sdk:5.15.4'
def lottieVersion = "5.2.0"
implementation "com.airbnb.android:lottie:$lottieVersion"
implementation 'com.google.firebase:firebase-crashlytics-ktx:18.2.13'
implementation 'com.google.firebase:firebase-config-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation platform('com.google.firebase:firebase-bom:30.3.1')
implementation 'com.google.android.gms:play-services-auth:20.3.0'
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
implementation 'com.google.android.gms:play-services-location:20.0.0'
implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
Build gradle (project):
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
}
}
plugins {
id 'com.android.application' version '7.3.0' apply false
id 'com.android.library' version '7.3.0' apply false
id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
id 'org.jetbrains.kotlin.jvm' version '1.7.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have this issue also. AppCompatActivity is deriving from ComposeActivity but somehow Android Studio isn't getting this and showing it as an error.
I have integrated a firebase real-time database in my app and I am getting a
java.lang.NullPointerException: Firebase Database component is not present
when I try to create an instance of a firebase database with the code below,
FirebaseApp firebaseApp = FirebaseApp.initializeApp(this);
mFirebaseInstance = FirebaseDatabase.getInstance(firebaseApp);
I also tried this,
mFirebaseInstance = FirebaseDatabase.getInstance();
Every time getting error Firebase Database component is not present.
Below is project gradle file code:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
//classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.google.gms:google-services:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects{
repositories {
mavenCentral()
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Below are dependency which I have added
Dependencies :
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
//implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.material:material:1.0.0-rc01'
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'
// Firebase
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
implementation 'com.google.firebase:firebase-auth:18.0.0'
implementation 'android.arch.work:work-runtime:1.0.1'
// Firebase real time databse
implementation 'com.google.firebase:firebase-database:17.0.0'
// Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
// Link preview
implementation 'io.github.ponnamkarthik:richlinkpreview:1.0.9'
implementation 'org.jsoup:jsoup:1.10.2'
// Piccaso
implementation 'com.squareup.picasso:picasso:2.71828'
//AdMob
implementation 'com.google.android.gms:play-services-ads:18.0.0'
// Needed to fix a dependency conflict with FirebaseUI'
implementation 'androidx.arch.core:core-runtime:2.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
}
apply plugin: 'com.google.gms.google-services'
I also tried to change the database dependency version, change class path and update google-services.json file but I am still facing the same error.
I am trying to implement Phone Authentication using Firebase while signing in using a valid phone number I get the following log message.
2018-12-24 22:03:10.880 3021-3021/packagename W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms: com.google.firebase.auth.api.internal.zzal#b962d36
2018-12-24 22:03:12.391 3021-3021/packagename D/LoginActivity: com.google.android.gms.tasks.zzu#bcdfd40
These are my dependencies
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
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.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-config:16.1.2'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.firebase:firebase-storage:16.0.5'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.firebaseui:firebase-ui:2.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-location:16.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.google.android.gms:play-services-places:16.0.0'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1#aar') {
transitive = true
}
// Check for v11.4.2 or higher
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.8'
implementation 'com.squareup.okhttp3:okhttp:3.10.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:multidex:1.0.3'
}
apply plugin: 'com.google.gms.google-services'
build.gradle (Project level)
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'io.fabric.tools:gradle:1.26.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And I have added the recently downloaded google-services.json file into this project. Actually, this code was running perfectly before I don't know why now it's showing this error after I made a few UI changes & increased the project version number.
I had a similar problem today with an old device Moto E 2nd Generation. I figured out that I had to update Play Services before I make use of any Firebase services (Auth included).
Hope it works for you!
I wanted to monetize my app using admob.
When i used the admob option available in firebase it asked me to add the following dependency 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
but after the gradle build it gave me this error Failed to resolve: firebase-ads-15.0.0 so i used 'com.google.firebase:firebase-ads:12.0.1' which works great but with this one i can't see the ads. These are my dependencies :
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.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'
implementation 'com.daimajia.easing:library:2.0#aar'
implementation 'com.daimajia.androidanimations:library:2.3#aar'
implementation 'com.google.android.gms:play-services:12.0.1'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:12.0.1'
//implementation 'com.google.firebase:firebase-ads:12.0.1'
//implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
}
This is my project level gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
//classpath 'com.google.gms:google-services:4.0.1'
classpath 'com.google.android.gms:strict-version-matcher-plugin:1.0.0'
classpath 'com.google.gms:google-services:4.1.0'
// 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
}
Firebase core and ads compile version should same
Try this version 16.0.4
It looks like this :
implementation com.google.firebase:firebase-core:16.0.4
implementation 'com.google.firebase:firebase-ads:16.0.4'
change line :
implementation 'com.google.firebase:firebase-ads:15.0.1:15.0.0'
to
implementation 'com.google.firebase:firebase-ads:15.0.1'