Execution failed for task ':app:compileDebugJavaWithJavac'. error - java

Error:
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Failed to calculate the value of task ':app:compileDebugJavaWithJavac' property 'options.generatedSourceOutputDirectory'.
Querying the mapped value of map(java.io.File property(org.gradle.api.file.Directory, property(org.gradle.api.file.Directory, fixed(class org.gradle.api.internal.file.DefaultFilePropertyFactory$FixedDirectory, C:\Users\saura\AndroidStudioProjects\FutsalNepal\app\build\generated\ap_generated_sources\debug\out))) org.gradle.api.internal.file.DefaultFilePropertyFactory$ToFileTransformer#63c94fba) before task ':app:compileDebugJavaWithJavac' has completed is not supported
Here is my build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
android {
compileSdkVersion 32
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.androiddevs.mvvmnewsapp"
minSdkVersion 21
targetSdkVersion 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 = JavaVersion.VERSION_1_8.toString()
}
}
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.2.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'
implementation 'com.google.android.material:material:1.3.0-alpha03'
// Architectural Components
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
// Room
implementation "androidx.room:room-runtime:2.2.5"
kapt "androidx.room:room-compiler:2.2.5"
// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.2.5"
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.5'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.5'
// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation "com.squareup.okhttp3:logging-interceptor:4.5.0"
// Navigation Components
implementation "androidx.navigation:navigation-fragment-ktx:2.2.1"
implementation "androidx.navigation:navigation-ui-ktx:2.2.1"
implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0-rc02'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0-rc02'
// Glide
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'
}
Here is my settings.gradle:
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "Futsal Nepal"
include ':app'

Related

"error: package com.google.firebase.iid does not exist" After updating Firebase Crashlytics dependency

I have updated my Firebase Crashlytics from
implementation 'com.google.firebase:firebase-crashlytics:17.1.1'
to
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
Now I am getting this error:
error: package com.google.firebase.iid does not exist
When I try to import this:
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
This is my project level build.gradle file:
buildscript {
ext {
kotlin_version = '1.3.72'
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.google.gms:google-services:4.3.4'
classpath 'com.google.firebase:perf-plugin:1.3.4'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.20" }
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my app level build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 30
defaultConfig {
applicationId "..."
minSdkVersion 16
targetSdkVersion 30
versionCode ...
versionName "..."
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
//shrinkResources true NOT SUPPORTED FOR DYNAMIC MODULES
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
multiDexEnabled true
}
debug {
multiDexEnabled true
}
}
dynamicFeatures = [":premium", ':tutorial']
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.2.0'
api 'com.google.android.material:material:1.2.1'
api 'androidx.constraintlayout:constraintlayout:2.0.4'
api 'com.google.android.play:core:1.8.3'
api 'com.google.firebase:firebase-analytics:18.0.0'
api 'com.google.firebase:firebase-perf:19.0.10'
api 'com.google.firebase:firebase-invites:17.0.0'
api 'com.google.firebase:firebase-firestore:22.0.0'
api 'androidx.legacy:legacy-support-v4:1.0.0'
api 'com.google.firebase:firebase-config:20.0.1'
implementation 'com.google.firebase:firebase-appindexing:19.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api 'androidx.navigation:navigation-fragment:2.3.1'
api 'androidx.cardview:cardview:1.0.0'
api 'androidx.recyclerview:recyclerview:1.1.0'
api 'androidx.preference:preference:1.1.1'
implementation 'com.google.firebase:firebase-crashlytics:17.3.0'
androidTestImplementation 'androidx.test:rules:1.3.0'
api 'com.google.firebase:firebase-auth:20.0.1'
api 'com.google.zxing:core:3.3.3'
api 'com.android.billingclient:billing:3.0.1'
//api 'com.facebook.android:facebook-android-sdk:5.15.3'
implementation 'com.google.android.gms:play-services-ads-lite:19.5.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.multidex:multidex:2.0.1'
implementation 'com.google.android.datatransport:transport-runtime:2.2.5'
}
The error doesn't happen with firebase crashlytics dependency version 17.1.1 and below.
I have already tried:
Rebuilding Project
Cleaning Project
Invalidating Cache and Restarting
The solution to this problem was that FirebaseInstanceId was depreciated. This means that it was removed from the library.
You can find more information about it here: https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId

Errors after Firebase update from 16.0.7 to 17.2.0

I have implementation 'com.google.firebase:firebase-core:16.0.7' and it works great!
After update to implementation 'com.google.firebase:firebase-core:17.2.0' I have so many problems:
Module: app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 28
defaultConfig {
applicationId "free.success.kneu"
minSdkVersion 19
targetSdkVersion 28
versionCode 223
versionName "2.2.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
multiDexEnabled true
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:multidex:1.0.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'
implementation 'org.jsoup:jsoup:1.11.3'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
Project
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
flatDir {
dirs 'libs'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

How to resolve firebase build faild error?

I tried making a chatapp with firebase, but when i try to run the app on an emulator i get this "Error: Type com.google.firebase.FirebaseApp$zza is referenced as an interface from com.google.android.gms.internal.zzbkv$3."
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.firebasechat"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.7'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'com.firebaseui:firebase-ui:1.1.1'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}
apply plugin: 'com.google.gms.google-services'
classpath 'com.google.gms:google-services:4.0.1'
check declare plugin in gradle module. and define classpath to project gradle

Adding firebase is conflicting with google play services

Since adding Firebase to my application so I can send push notifications to users through appcenter I have encountered a number of problems.
I am currently experiencing a possible merging issue between two libraries.
Failed to notify dependency resolution listener.
The library com.google.android.gms:play-services-basement is being
requested by various other libraries at [[15.0.1,15.0.1]], but
resolves to 16.0.1. Disable the plugin and check your dependencies
tree using ./gradlew :app:dependencies.
As you can see here I do not have any specific dependencies for play-services-basement...
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'io.realm:realm-gradle-plugin:5.3.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
realm {
syncEnabled = true
}
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "com.xxxxsoftware.xxxx.xxxx"
minSdkVersion 16
targetSdkVersion 28
versionCode 36
versionName "2.8.17"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
lintOptions {
checkReleaseBuilds false
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation('com.crashlytics.sdk.android:crashlytics:2.9.4#aar') {
transitive = true
}
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 fileTree(include: ['*.jar'], dir: 'libs')
def appCenterSdkVersion = '1.9.0'
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
implementation "com.microsoft.appcenter:appcenter-push:${appCenterSdkVersion}"
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:appcompat-v7:28.0.0'
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.android.support:support-vector-drawable:28.0.0'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.github.barteksc:android-pdf-viewer:2.0.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'
implementation 'com.github.delight-im:Android-SimpleLocation:v1.0.1'
implementation 'io.nlopez.smartlocation:library:3.3.3'
implementation 'io.realm:android-adapters:3.0.0'
implementation 'androidmads.library.qrgenearator:QRGenearator:1.0.3'
implementation 'com.journeyapps:zxing-android-embedded:3.1.0#aar'
implementation 'com.github.pwittchen:reactivenetwork-rx2:2.0.0'
}
I have ran the command ./gradlew :app:dependencies and it prints out:
* What went wrong:
Project 'app' not found in root project 'ChimePassportAndroid'.
In order to use Firebase messaging, you need to add in your build.gradle file the corresponding dependency like this:
implementation 'com.google.firebase:firebase-messaging:17.3.4'
And your problem will be solved.

After updating to latest Firebase I am getting error "Unable to merge dex"

I am currently working on application, after updating to latest firebase I am get error "Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex"
build.gradle(Project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.0'
defaultConfig {
applicationId "com.example.vishalverma.androideatitserver"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
}
dependencies {
implementation ('com.github.jd-alexander:android-flat-button:v1.1')
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//Support library
implementation 'com.android.support:appcompat-v7:27+'
implementation 'com.android.support:mediarouter-v7:27+'
implementation 'com.android.support:design:27+'
implementation 'com.android.support:cardview-v7:27+'
implementation 'com.android.support:animated-vector-drawable:27+'
implementation 'com.android.support:recyclerview-v7:27+'
//Firebase
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.2'
//Location
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.jaredrummler:material-spinner:1.2.4'
testImplementation 'junit:junit:4.12'
implementation 'info.hoang8f:fbutton:1.0.5'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
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'

Categories