After I updated to the newest plugin for kotlin I get this build error in my project
Caused by: org.gradle.internal.metaobject.AbstractDynamicObject$CustomMessageMissingMethodException: Could not find method 1.8() for arguments [1.8] on object of type org.jetbrains.kotlin.gradle.dsl.KotlinJvmOptionsImpl.
My gradle is,
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.71'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
def nav_version = "2.1.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Other file is
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
compileSdkVersion 28
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8" JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.example.barrechat191"
minSdkVersion 24
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
// To inline the bytecode built with JVM target 1.8 into
// bytecode that is being built with JVM target 1.6. (e.g. navArgs)
}
dependencies {
def lifecycle_version = "2.1.0"
def nav_version = "2.1.0"
def paging_version = "2.1.1"
implementation 'com.luckycatlabs:SunriseSunsetCalculator:1.2'
//Page Lib implementation and RecyclerView
implementation "androidx.paging:paging-runtime-ktx:$paging_version"
// For Kotlin use paging-runtime-ktx
implementation 'com.android.support:recyclerview-v7:28.0.0'
//Implement Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.2.1'
implementation 'androidx.navigation:navigation-ui-ktx:2.2.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
//Implement constraintLayout
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
// ViewModel and LiveData
implementation "androidx.lifecycle:lifecycle-extensions:$lifecycle_version"
// alternatively - just ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
// For Kotlin use lifecycle-viewmodel-ktx
// alternatively - just LiveData
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
// alternatively - Lifecycles only (no ViewModel or LiveData). Some UI
// AndroidX libraries use this lightweight import for Lifecycle
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0'
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.2.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
//Kotlin Coroutine support for ViewModel
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0-alpha01'
//Coroutine support for LiveData
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-alpha01'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-alpha01'
//Dependency Injection
api 'com.google.dagger:dagger:2.25.2'
annotationProcessor 'com.google.dagger:dagger-compiler:2.25.2'
//*******************************************
//************* A W S ******************
//*******************************************
// Mobile Client for initializing the SDK
implementation('com.amazonaws:aws-android-sdk-mobile-client:#aar') { transitive = true }
// Cognito UserPools for SignIn
implementation 'com.android.support:support-v4:28.0'
implementation('com.amazonaws:aws-android-sdk-auth-userpools:#aar') { transitive = true }
// Sign in UI Library
implementation 'com.android.support:appcompat-v7:28.0'
implementation('com.amazonaws:aws-android-sdk-auth-ui:#aar') { transitive = true }
//******************************************
//************ GOOGLE MAPS ****************
//******************************************
implementation name: 'maps-sdk-3.0.0-beta', ext: 'aar'
implementation 'com.google.android.gms:play-services-basement:17.2.1'
implementation 'com.google.android.gms:play-services-base:17.2.1'
implementation 'com.google.android.gms:play-services-gcm:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
//******************************************
//**************** ROOM ********************
//******************************************
def room_version = "2.2.3"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "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.google.android.gms:play-services-maps:17.0.0'
/**
*
* TESTING ->
*
*/
testImplementation "androidx.room:room-testing:$room_version"
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.2.0'
implementation "com.github.drfonfon:android-kotlin-geohash:1.0"
}
Not sure what could be going wrong here. Everything worked fine until recent upgrade. Any ideas as to how to fix this issue?
I've tried going through and making sure everything was in sync and the correct version. But it still throws the same build error.
Try to use
android {
...
kotlinOptions {
jvmTarget = '1.8'
}
...
}
looks a bit strange
jvmTarget = "1.8" JavaVersion.VERSION_1_8
Related
I am using the Android canary 13(Bubble Bee). My problem is that I am unable to resolve any third part library. I have tried adding multiple different libraries but cannot resolve them during building project. When I sync the project after adding the library the project synced successfully by downloading the dependency but in the project that library cannot resolve and when I try to build the project it says as mention in the image
Below is the code of of build.gradle(app) file.
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'androidx.navigation.safeargs'
id 'com.google.gms.google-services'
id 'kotlin-kapt'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.ra.rightads"
minSdk 21
targetSdk 31
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'
}
dataBinding {
enabled = true
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
def nav_version = "2.3.5"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Navigation dependencies
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
implementation "androidx.navigation:navigation-compose:2.4.0-alpha10"
//Firebase dependencies
implementation "com.google.firebase:firebase-core:19.0.2"
implementation "com.google.firebase:firebase-auth:21.0.1"
implementation "com.google.firebase:firebase-firestore:23.0.4"
implementation "com.google.android.gms:play-services-auth:19.2.0"
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.firebase:firebase-database:20.0.2'
implementation 'com.google.firebase:firebase-analytics:19.0.2'
implementation 'com.google.firebase:firebase-storage:20.0.0'
//Google material dependencies
implementation 'com.google.android.material:material:1.4.0'
// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.1.0'
// Okhttp
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
// Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
//Viewpager
implementation 'androidx.viewpager2:viewpager2:1.0.0'
//Hilt dependency
implementation("com.google.dagger:hilt-android:2.38.1")
//Multidex
implementation 'com.android.support:multidex:1.0.3'
//Kapt
kapt 'com.github.bumptech.glide:compiler:4.11.0'
// sdp and ssp for dp and sp values
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
// Image Cropper
// implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
}
Here is the code of my project level build.gradle file.Image cropper is the library I am currently trying to add.
// Top-level build file where you can add configuration options common to all sub-
projects/modules.
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com'
}
maven { url 'https://jitpack.io' }
}
dependencies {
def nav_version = "2.3.5"
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.google.gms:google-services:4.3.10'
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath('com.android.support:multidex:1.0.3')
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I need help and I need to resolve this error. Your help will be appreciated.
From looking at that project's page on GitHub, I see that it is no longer maintained. And since JCenter is shut down, you can't easily get the library using Maven/Gradle.
Someone has forked it and continues to develop it, so you can use that library instead.
Replace jcenter() with maven { url 'https://jitpack.io' } and replace 'com.theartofdev.edmodo:android-image-cropper:2.8.0' with 'com.github.CanHub:Android-Image-Cropper:3.3.5'.
today I started to experience some weird behavior in Android Studio 2020.3.1.
I get Unresolved Reference errors for all methods from Kotlin coroutines. I cannot narrow down this issue to any specific change I made. The code still compiles and my App works fine.
The only change that might be connected to this issue is that I created a new git branch a day before (everything worked fine though).
My build.gradle file looks like this:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 31
defaultConfig {
minSdkVersion 24
targetSdkVersion 31
versionCode 13
versionName "1.5.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
kapt {
arguments {
arg("room.schemaLocation", "$projectDir/schemas".toString())
}
}
kotlinOptions {
jvmTarget = '1.8'
}
compileOptions {
targetCompatibility = "8"
sourceCompatibility = "8"
}
}
buildFeatures {
viewBinding true
}
packagingOptions {
exclude 'META-INF/atomicfu.kotlin_module'
}
sourceSets { main { java.srcDirs = ['src/main/java', 'src/main/java/utilities'] } }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-reflect:1.5.31"
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.5.0-alpha05'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation "androidx.viewpager2:viewpager2:1.0.0"
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// Logcat
implementation 'com.squareup.logcat:logcat:0.1'
// Room components (SQL Wrapper)
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
implementation "androidx.room:room-ktx:$rootProject.roomVersion"
implementation "androidx.room:room-rxjava3:$rootProject.roomVersion"
kapt "androidx.room:room-compiler:$rootProject.roomVersion"
androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
// Paging
implementation "androidx.paging:paging-runtime-ktx:$rootProject.pagingVersion"
implementation "androidx.paging:paging-rxjava2-ktx:$rootProject.pagingVersion"
// Fragment
implementation "androidx.fragment:fragment-ktx:$fragment_version"
// Lifecycle components
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" // ViewModel
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" // LiveData
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" // Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version" // Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" // Annotation processor"
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version" // optional - helpers for implementing LifecycleOwner in a Service
implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version" // optional - ProcessLifecycleOwner provides a lifecycle for the whole application process
implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version" // optional - ReactiveStreams support for LiveData
testImplementation "androidx.arch.core:core-testing:$arch_version" // optional - Test helpers for LiveData
// RxJava
implementation 'io.reactivex.rxjava3:rxandroid:3.0.0'
implementation 'io.reactivex.rxjava3:rxjava:3.0.2'
implementation 'io.reactivex.rxjava3:rxkotlin:3.0.0'
// ViewModel Kotlin support
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.archLifecycleVersion"
// Coroutines
// api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$rootProject.coroutines"
// api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0'
implementation 'androidx.core:core-ktx:1.7.0'
// Location
implementation 'com.google.android.gms:play-services-location:18.0.0'
// Apache common math
implementation 'org.apache.commons:commons-math3:3.6.1'
// CameraX core library using the camera2 implementation
// The following line is optional, as the core library is included indirectly by camera-camera2
implementation("androidx.camera:camera-core:$rootProject.camerax_version")
implementation("androidx.camera:camera-camera2:$rootProject.camerax_version")
// If you want to additionally use the CameraX Lifecycle library
implementation("androidx.camera:camera-lifecycle:$rootProject.camerax_version")
// If you want to additionally use the CameraX View class
implementation("androidx.camera:camera-view:1.0.0-alpha30")
// If you want to additionally use the CameraX Extensions library
implementation("androidx.camera:camera-extensions:1.0.0-alpha30")
// FireBase
implementation platform('com.google.firebase:firebase-bom:28.4.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation 'com.google.firebase:firebase-crashlytics-ktx'
}
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.7.1'
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
ext {
roomVersion = '2.3.0'
pagingVersion = '3.0.1'
archLifecycleVersion = '2.2.0'
androidxArchVersion = '2.0.0'
coroutines = '1.2.0'
lifecycle_version = '2.4.0'
arch_version = '2.1.0'
fragment_version = '1.3.6'
camerax_version = "1.0.2"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Things I have tried to resolve this:
Invalidated caches and restarted Android Studio
Sync gradle files again
Deleted .idea and .gradle folders
Switched to another git branch that worked fine before and where no changes were made
Restarted my PC
Now I am out of ideas of what to try. If anyone has an idea what the issue could be, I would be really grateful.
Edit:
If I edit kotlinx implementation in the build.gradle file to:
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2-native-mt'
the errors disappear, however, I do not understand why.
This question already has an answer here:
Why does case matter in gradle task method names?
(1 answer)
Closed last month.
I am not able to add the GitHub repository of Youtube video extractor for exoplayer, implementing in android studio project.
build.gridle(abc app)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.google.gms:google-services:4.3.0'
// 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
}
build.gridle(app)
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.abc"
minSdkVersion 20
targetSdkVersion 30
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
// multiDexEnabled true
//useProguard true
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.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation "androidx.recyclerview:recyclerview-selection:1.1.0-rc03"
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.android.support:multidex:1.0.3'
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 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation ('com.squareup.retrofit2:retrofit:2.1.0') {
// exclude Retrofit’s OkHttp dependency module and define your own module import
exclude module: 'okhttp'
}
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
implementation 'com.squareup.okhttp3:okhttp:3.4.1'
implementation 'com.payumoney.core:payumoney-sdk:7.4.4'
implementation 'com.payumoney.sdkui:plug-n-play:1.6.0'
// Import the Firebase BoM
implementation platform('com.google.firebase:firebase-bom:26.6.0')
// Declare the dependency for the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.android.support:multidex:1.0.3'
//Adding exoplayer dependencies
implementation 'com.google.android.exoplayer:exoplayer:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-core:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-dash:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-hls:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:r2.4.0'
implementation 'com.google.android.exoplayer:exoplayer-ui:r2.4.0'
//Youtube extractor
Implementation 'com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0' // getting error in this line
}
When I'm trying to add the "Implementation 'com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0'", I don't know why showing the below error -
unexpected token: com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0
Could not compile build file 'C:\Users\Rupesh\AndroidStudioProjects\abc\app\build.gradle'.
> startup failed:
build file 'C:\Users\Rupesh\AndroidStudioProjects\abc\app\build.gradle': 84: unexpected token: com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0 # line 84, column 20.
Implementation 'com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0'
Use i instead of I in implementation.
The correct line should be
implementation 'com.github.HaarigerHarald:android-youtubeExtractor:v1.7.0'
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..
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.