import com.firebase.ui.auth.AuthUI not working - authentication

ive being trying to write a loggin with google , phone and email activity, but the app is not importing : com.firebase.ui.auth.AuthUI
this is my app build gradle
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.stockmng"
minSdk 22
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation 'com.google.firebase:firebase-auth:21.1.0'
implementation 'com.google.firebase:firebase-firestore:24.4.1'
implementation 'com.google.firebase:firebase-database:20.1.0'
implementation 'com.firebaseui:firebase-ui-auth:6.2.1'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.android.gms:play-services-auth:20.4.0'
//apply plugin: 'com.android.application'
implementation 'com.github,MrNouri:DynamicSizes:1.0'
}
and my project gradle
buildscript {
repositories{
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://jitpack.io'}
}
dependencies {
classpath 'com.google.gms:google-services:4.3.14'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
i tried adding, changing updating the implentations in app build gradle,
i have permission.internet and ACCES_NETWORK_STATE added to the manifest.
a configured the api keys,and oAuth updated,
also adding in google maven and maven central in repository en the project gradel,
nothing works.

Related

The binary version of its metadata is 1.8.0, expected version is 1.6.0. Module was compiled with an incompatible version of Kotlin

C:/Users/LENOVO/.gradle/caches/transforms-2/files-2.1/2bcd0a6b95744b6f0ee26f9336bd22eb/jetified-annotation-jvm-1.6.0-beta01.jar!/META-INF/annotation.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.
buildscript {
ext.kotlin_version = '1.4.32'
ext.anko_version='0.10.8'
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.3'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// Add the dependency for the Performance Monitoring plugin
classpath 'com.google.firebase:perf-plugin:1.4.1'
}
}
This project contains a few incompatible or even dangerous things, that also lead you to the problem you're having:
jcenter() is not in service anymore, so it should be replaced by mavenCentral() or your dependencies will not be correctly resolved.
You specify both Kotlin 1.4.32 (no longer maintained) and 1.6.10 (no longer ideal, but still usable) and the classes will definitely not be compatible between them.
Some of your other dependencies might be even newer and use Kotlin 1.8.0, so your older runtimes won't be able to read their metadata.
Recently, I faced a similar issue on creating a new project in Android studio with Compose Material3 template.
So I upgraded below libraries/plugins solve my issue. I also attached my gradle files for reference.
kotlin version to 1.8.0
kotlinCompilerExtensionVersion '1.4.0'
compose_version to 1.3.1
build.gradle(app)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.hometech.anatomymuscles'
compileSdk 33
defaultConfig {
applicationId "com.hometech.anatomymuscles"
minSdk 23
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.4.0'
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose:1.6.1'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.compose.material3:material3:1.1.0-alpha05'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
}
build.gradle(project)
buildscript {
ext {
compose_version = '1.3.3'
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.0' apply false
}

Failed to resolve: androidx.compose.ui:ui-tooling and other modules

While building gradle I encounter a warning: Failed to resolve: androidx.compose.ui:ui-tooling
and recommends adding Google maven repository but this is already specified in settings.gradle. I tried different versions for compose_ui_version and kotlin compiler extension version. How can I resolve this issue?
buildscript {
ext {
compose_ui_version = "1.4.0-alpha05"
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.20' apply false
}
and app's build.gradle:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.bettehomes'
compileSdk 33
defaultConfig {
applicationId "com.example.bettehomes"
minSdk 25
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerVersion "1.7.20"
kotlinCompilerExtensionVersion "1.4.0-beta05"
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
def composeBom = platform("androidx.compose.compose-bom:2022.12.00")
implementation composeBom
androidTestImplementation composeBom
implementation 'com.google.maps.android:maps-compose'
implementation 'com.google.android.gms:play-services-maps'
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation 'androidx.activity:activity-compose'
implementation "androidx.compose.ui:ui-tooling"
implementation "androidx.compose.ui:ui-tooling-preview"
implementation 'androidx.compose.material3:material3'
// Android Studio Preview Support
debugImplementation "androidx.compose.ui:ui-tooling"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation "androidx.compose.ui:ui-test-junit4"
debugImplementation "androidx.compose.ui:ui-test-manifest"
}
Have you tried adding the following into the buildscript section inside your project level gradle file?
repositories {
mavenCentral()
}
I was having the same problem.
Eventually I tried to add the version explicitly like this:
implementation "androidx.compose.ui:ui-tooling-preview:1.3.2"
Notice that 1.3.2 is the version imported by the BOM version you are using.
Obviously it was still not working but at least now I got a more descriptive error message.
It turned out I need compileSdkVersion 33 (I was using 31).
Since I don't want to increment yet my compileSdkVersion, I will have to downgrade ui-tooling-preview to explicitly use version 1.1.1
I can see you are already using compileSdkVersion 33, however adding explicitly the version might help you get a more descriptive error message.

how do i correctly implement safeargs?

I am trying to follow a tutorial in order to implement and use a room database YouTube-link.
My problem is that my gradle files look so different compared to what is shown in the video that I have no idea where to put the id "navigation.safeargs.kotlin" and the
classpath "androidx.navigation-safe-args-gradle-plugin:2.3.0-rc01"
or anything else that I might need. I have tried a bunch of places but it never works and I couldn't really find an answer, so if anyone knows, pls help me out.
build.gradle(Project:...):
plugins {
id 'com.android.application' version '7.2.0' apply false
id 'com.android.library' version '7.2.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module:...):
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example. ..."
minSdk 26
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.4.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1'
implementation 'androidx.navigation:navigation-fragment-ktx:2.4.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.4.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 fileTree(dir: "libs", include: ["*.jar"])
// Room components
implementation "androidx.room:room-runtime:2.4.2"
kapt "androidx.room:room-compiler:2.4.2"
implementation "androidx.room:room-ktx:2.4.2"
androidTestImplementation "androidx.room:room-testing:2.4.2"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
implementation "androidx.lifecycle:lifecycle-common-java8:2.4.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.1"
// Kotlin components
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.21"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
}
settings.gradle(...):
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "..."
include ':app'
Go straight to the source IMO
Top-level build.gradle:
buildscript {
repositories {
google()
}
dependencies {
val nav_version = "2.4.2"
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version")
}
}
App/module build.gradle:
plugins {
id("androidx.navigation.safeargs")
// or for Kotlin-only projects
id("androidx.navigation.safeargs.kotlin")
}
So in your top-level file, you need google() in your repositories block, and the classpath in your dependencies block. If you don't have one of those blocks, just create it - they go inside the buildscript block, see? The nav_version val is just a variable so you can make all your Navigation components use the same version by referring to that, and the actual version number is only set in one place. You can just write the number in the dependency statement if you like - make sure all the Navigation components are using the same version though!
Stick the id("androidx.navigation.safeargs") line in your module's build file's plugins block. The order sometimes matters for some of these, so try it at the bottom. The syntax is a little different from how they look in your current file, but it's just another way of writing it - either's fine, you can mix and match
Use this one:
id 'androidx.navigation.safeargs.kotlin' version '2.4.0' apply false
In your build.gradle (project level) try adding:
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
id 'androidx.navigation.safeargs.kotlin' version '2.5.1' apply false
}
and in the build.gradle (module level) add:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'
}

Oboe AudioRecorder not running due to a deprecated option

I fail to run the OboeAudioRecorder with the most recent Android Studio update.
Could you please tell me what's wrong?
It is probably due to a librairy in conflict with other ones.
Error message:
Build file '/Users/*****/Documents/OboeAudioRecorder-master/app/build.gradle' line: 1
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> The option 'android.enablePrefab' is deprecated.
It was removed in version 4.1 of the Android Gradle plugin.
This property has been replaced by android.buildFeatures.prefab (DSL)
Gradle project:
to all sub-projects/modules. buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
allprojects {
repositories {
google()
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
Those lines are correctly built.
Gradle module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.oboeaudiorecorder"
minSdkVersion 23
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.18.1"
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
I've also applied all the necessary updates in order to have the correct versions of gradle and CMake.
Source code: https://github.com/reuniware/OboeAudioRecorder

Android Kotlin Two-Way databinding BR class error

I'am trying to do a basic android application using kotlin and two way data binding to show on a text view the changes in a edit text. But i'am getting this error :
w: [kapt] Incremental annotation processing requested, but support is disabled because the following processors are not incremental: android.databinding.annotationprocessor.ProcessDataBinding (DYNAMIC).
when i'am trying to do with one way data binding it is working well it show me the Contact class's name field successful
my codes:
build.gradle(Project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// 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:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
dataBinding{
enabled = true
}
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.mvvm.demo"
minSdkVersion 16
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
my Contact.kt
import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
class Contact( var Id:Int,
var Name:String,
var Email:String):BaseObservable() {
#Bindable
var _name: String = Name
set(value) {
field = value
notifyPropertyChanged(BR._name)
}
get() = field
}
unfortunately, this error has not yet been resolved. I hope the warning will be resolved in the next update. I've been waiting for updates since November because of this warning
source: https://issuetracker.google.com/issues/110061530#comment28