dependencies gradle android studio - android

good evening, i am starting in android but the projects that I have downloaded to base myself on most of them throw me errors in the grandle does anyone know why I get error in almost all dependencies? already try to "update" them to their latest version in the gradle file, the project download it from git hub.
build. gradle (Proyect)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.google.gms:google-services:4.3.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bigohealth"
minSdkVersion 22
targetSdkVersion 28
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 = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-firestore:17.1.2'
//implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
//androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def lifecycle_version = "2.0.0"
def room_version = "2.2.0-alpha02"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
annotationProcessor "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.github.christophesmfvvFet:android_maskable_layout:v1.3.1'
implementation 'com trrf r.squareup.retrofit2:adapter-rxjava2:2.6.0'
implementation 'de. , tk./;cx v/8.c8x8hdodenhof:circleimageview:3.1.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
implementation 'com.squareup.retrofit2:converter-scalars:2.6.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.firebase:firebase-messaging:20.3.0'
implementation 'com.android.volley:volley:1.1.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics'
}
apply plugin: 'com.google.gms.google-services'

Can you check, if you are under proxy and your android studio is able to connect to internet? Go to file>settings>type 'proxy' > in proxy settings there is a check connection button which will test if android studio is able to connect.
if there is a proxy, then provide the details and check again.
also make sure you do not have offline mode in your gradle settings turned on. Refer following screenshot:
Also your build tools are 4.0.1. Hope you should have the latest android studio too..

Related

InvalidPluginRequestException Gradle AndroidStudio

I have imported existing android project after 2 months, and when it started to sync the gradle, it gave some strange error, because earlier the project was working properly.
The error is Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin 'com.android.application' is already on the script classpath.
below is my gradle file :
build.gradle (:app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.quickshop"
minSdkVersion 21
targetSdkVersion 30
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
}
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.hbb20:ccp:2.5.0'
implementation 'com.steelkiwi:badge-holder-view:1.1.0'
implementation 'com.mikhaellopez:circularimageview:4.2.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
implementation 'me.himanshusoni.quantityview:quantity-view:1.2.0'
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
implementation 'com.github.MindorksOpenSource:EditDrawableText:2.0'
implementation 'com.razorpay:checkout:1.6.6'
implementation 'in.shadowfax:proswipebutton:1.2.2'
implementation 'com.google.firebase:firebase-auth:20.0.4'
implementation 'com.google.firebase:firebase-core:17.2.1'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-config:19.0.3'
implementation 'com.google.firebase:firebase-messaging'
implementation platform('com.google.firebase:firebase-bom:26.8.0')
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.6.0'
implementation 'com.google.firebase:firebase-storage:19.2.1'
implementation 'cc.cloudist.acplibrary:library:1.2.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.3.2'
implementation 'androidx.navigation:navigation-ui:2.3.2'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:3.0.1"
classpath 'com.google.gms:google-services:4.3.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
settings.gradle
include ':app'
rootProject.name = "QuickShop"
I tried to find solution for this, but didnt find a proper solution that can resolve this issue, can anyone please help me with this and this new gradle plugin invocation.
android version : Android Studio Arctic Fox | 2020.3.1 Patch 3,
gradle version : 4.1,
Android gradle plugin version : 3.0.1

Android studio could not resolve retrofit2 converter scalars 2.5.0

Android studio displays this strange error whenever I add some dependency to the grade file. It was working perfectly earlier. Further it displays no cached version of retrofit2 scalars available for offline mode.
Currently I tried almost all options from uninstalling and reinstalling android studio but no luck. I am running out of time so please help me resolve this.
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.protabler"
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(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.navigation:navigation-fragment:2.0.0'
implementation 'androidx.navigation:navigation-ui:2.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
implementation 'androidx.preference:preference:1.1.0-alpha05'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'de.hdodenhof:circleimageview:3.0.1'
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
// 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
}

Why does Firebase.auth.currentUser becomes invalid when I insert implementation 'com.google.firebase:firebase-admin:6.13.0' into Gradle?

Why does val user = Firebase.auth.currentUser (which .currentUser) become invalid when I insert implementation 'com.google.firebase:firebase-admin:6.13.0' into Gradle?
Before importing implementation 'com.google.firebase:firebase-admin:6.13.0':
After importing implementation 'com.google.firebase:firebase-admin:6.13.0', auth's method become admin's method. It seems Firebase-admin conflicts with FirebaseAuth. Why?
File build.gradle (Module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions' apply plugin: 'com.google.gms.google-services' apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.squall.searchdesigner"
minSdkVersion 21
targetSdkVersion 30
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 = 1.8
targetCompatibility = 1.8
}
kotlinOptions {
jvmTarget = "1.8"
}
dataBinding {
enabled = true
} }
dependencies {
implementation 'androidx.recyclerview:recyclerview:1.2.0-alpha03'
def room_version = "2.2.5"
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.3.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-auth-ktx:19.3.1'
implementation 'com.google.firebase:firebase-firestore:21.4.3'
implementation 'com.google.firebase:firebase-storage:19.1.1'
// FirebaseUI for Cloud Firestore
implementation 'com.firebaseui:firebase-ui-firestore:6.1.0'
// FirebaseUI for Firebase Auth
implementation 'com.firebaseui:firebase-ui-auth:6.2.1'
// FirebaseUI for Cloud Storage
implementation 'com.firebaseui:firebase-ui-storage:6.1.0'
implementation 'com.facebook.android:facebook-login:5.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//lifecycle
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.2.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0"
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.2.0'
//navigation
implementation "androidx.navigation:navigation-fragment-ktx:2.2.2"
implementation "androidx.navigation:navigation-ui-ktx:2.2.2"
//Firebase cloud message
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.google.firebase:firebase-messaging-directboot:20.2.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.google.android.material:material:1.1.0'
//Room
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
// For Kotlin use kapt instead of annotationProcessor
// optional - Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room_version"
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'jp.wasabeef:picasso-transformations:2.2.1'
//coroutine
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7'
//Firebase Coroutine dependency:
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.6'
//Firebase firestore extension
implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.fragment:fragment-ktx:1.2.5'
//Facebook SDK
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation 'com.google.firebase:firebase-admin:6.13.0'
implementation 'com.google.firebase:firebase-functions-ktx:19.0.2' }
build.gradle(Project:)
buildscript {
ext.kotlin_version = '1.3.72'
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.3'
// 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
}
CurrentUser only exists in the Firebase Android SDK. You cannot use both Android SDK and Admin SDK together. They have conflicting packages/classes. Specifically, you cannot use the Admin SDK in an Android or any client-side application.

How to resolve 'com.github.d-max:spots-dialog:0.7#aar'

I have done all the solution but none of them worked. Whenever I add this library in my project. I face error like
unable to resolve this library (disable offline work option)).
After disabling it, the error come
No cached version available in offline mode(Enable offline work option)).
How I resolve it pls help
This is my gradle file(module app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.amazone_ecommerce"
minSdkVersion 21
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(include: ['*.jar'], dir: 'libs')
api 'com.google.firebase:firebase-messaging:17.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.5.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.github.jd-alexander:android-flat-button:v1.1'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'io.paperdb:paperdb:2.1'
implementation 'com.github.rey5137:material:1.2.4'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.firebaseui:firebase-ui-database:1.2.0'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'com.cepheuen.elegant-number-button:lib:1.0.2'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
implementation 'com.github.mancj:MaterialSearchBar:0.7.1'
implementation 'com.stepstone.apprating:app-rating:2.0.0'
implementation 'com.squareup.retrofit2:retrofit-converters:2.5.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.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'
}
apply plugin: 'com.google.gms.google-services'
This is my gradle file(root level)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.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 {
maven { url 'https://jitpack.io' }
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
You should try this as it's stated in the documentation:
dependencies {
implementation 'com.github.d-max:spots-dialog:1.1#aar'
}
That's a newer version of the lib. I think this should solve your problem.
Best

"Unable to merge dex" Android Studio 3.0

I read a lot other topics, but none of them helped me.
I wrote this project 2 months ago and at that time everything worked fine. Now I opened it again and it writes:
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Here is my app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.szabo.organizer"
minSdkVersion 21
buildToolsVersion "27.0.2"
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
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.0'
implementation 'com.android.support:customtabs:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.facebook.android:facebook-login:4.29.0'
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.github.bumptech.glide:glide:4.5.0'
implementation 'com.google.android.gms:play-services-auth:12.0.0'
implementation 'com.google.android.gms:play-services-maps:12.0.0'
implementation 'com.google.firebase:firebase-database:12.0.0'
implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.google.firebase:firebase-auth:12.0.0'
implementation 'com.google.firebase:firebase-core:12.0.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.5.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'
}
apply plugin: 'com.google.gms.google-services'
and the project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
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
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I changed all "compile" to "implementation", I deleted .gradle directory, I tried clean project and rebuild, I tried Invalidate and restart.
Use this
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
implementation 'com.google.android.gms:play-services-auth:12.0.1'
implementation 'com.google.android.gms:play-services-maps:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-storage:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.firebase:firebase-core:12.0.1'
Instead of this
implementation 'com.firebaseui:firebase-ui-database:3.2.1'
implementation 'com.google.android.gms:play-services-auth:12.0.0'
implementation 'com.google.android.gms:play-services-maps:12.0.0'
implementation 'com.google.firebase:firebase-database:12.0.0'
implementation 'com.google.firebase:firebase-storage:12.0.0'
implementation 'com.google.firebase:firebase-auth:12.0.0'
implementation 'com.google.firebase:firebase-core:12.0.0'

Categories

Resources