Failed Android build - unable to find Guava repository - android

I'm trying to compile an Android app and the Gradle build is failing. The project is in Java but does have Room code as well, which I believe is where the issue is arising from. The build is unable to find the Guava repository at www.google.com:guava:23.6-Android even though this file has been added as a dependency.
The initial result build fail looks like this:
Could not find com.google.guava:guava:23.6-android.
Required by:
project :App
The project-level build file:
buildscript {
repositories {
mavenCentral()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
The app level build file contains the following:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.nathan.digipizza"
minSdkVersion 19
targetSdkVersion 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
}
buildFeatures {
dataBinding true
}
}
dependencies {
implementation 'com.google.guava:guava:26.3-android'
def room_version = "2.3.0"
implementation 'androidx.appcompat:appcompat:1.4.0-rc01'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.material:material:1.5.0-alpha05'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'androidx.lifecycle:lifecycle-compiler:2.4.0'
implementation 'androidx.room:room-runtime:2.3.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
annotationProcessor 'androidx.room:room-compiler:2.3.0'
}
It is difficult to post the entire dependency tree since I'm still unable to post screen images. But the repository in question, com.google.guava:guava:23.6-android, is not listed as a dependency for any other files, and its entry in the tree for the release variant reflects this fact as it is situated furthest left on the tree as follows:
+--- com.google.guava:guava:23.6-android FAILED
This repository only appears once in the dependency tree, furthermost to the left.
The com.google.guava:guava:23.6-android repository has an updated version to 30.1-android. I did update the version, but the error remains and everything is the same as above except version 30.1-android replaces version 23.6-android.
I need to figure out how to resolve the build error, which I'll post here again for ease of use:
Could not find com.google.guava:guava:23.6-android.
Required by:
project :app
I don't understand how the build is failing to see this repository when it has been added as a dependency, and there doesn't appear to be any complications apparent by analyzing the dependency tree.

Related

Kotlin library was complied with a newer Kotlin compiler and can't be read

Hello I tried to run Kotlin file on Android Studio (version 4.1) and I got an error:
Kotlin library {0} was compiled with a newer Kotlin compiler and can't be read. Please update Kotlin plugin.
Even I got this error I'm able to run kotlin files but Ide don't gives me tips when I use kotlin functions and methods are marked by red colour. Kotlin version in gradle is 1.6.0, if I'm return to older version I can see tips about method names and red colour is not showed.
Gradle build(app):
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.kotlin_udemy4"
minSdkVersion 26
targetSdkVersion 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'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Gradle build:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.6.0"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.0"
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
}
Does anyon know how to resolve that issue ?
Besides Kotlin version 1.6.21 ...
That version of Android Studio appears rather outdated; eg. the current version "Chipmunk" uses:
com.android.tools.build:gradle:7.2.1
jcenter() should be replaced with mavenCentral().
And also, use JavaVersion.VERSION_11.
I have similar problem. To solve this, I do the following things:
I try to Rebuild the project, then this error log appear:
The minCompileSdk (32) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-31).
Dependency: androidx.appcompat:appcompat-resources:1.5.0.
AAR metadata file: C:\Users..........
Lower androidx.appcompat:appcompat version to 1.4.0, and then sync gradle. That's it.
Maybe you can try this way.
Next to isssue popup i selected "Details" link and there was information about expected version. Probably because I'm using older Android studio I got the problem. I updated Kotlin in gradle build to: 1.4.32 according to message.

Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+

I tried changing the compilesdk and mindsdk versions as told here. I read all the other posts regarding the same but none worked so far. I have looked at the previous answers ans1 and ans2 . They didn't helped.
When I try to run the project it throws multplie errors. I think the main problem is because of this one
Could not find any matches for org.jitsi.react:jitsi-meet-sdk:3.+ as no versions of org.jitsi.react:jitsi-meet-sdk are available.
build.gradle(My application)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://github.com/jitsi/jitsi-maven-repository/raw/master/releases"
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath 'com.google.gms:google-services:4.3.10'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.myapplication"
minSdk 21
targetSdk 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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-common-ktx:20.0.0'
implementation 'com.google.firebase:firebase-firestore:24.0.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation ('org.jitsi.react:jitsi-meet-sdk:3.+') { transitive = true }
}
Any help is appreciated.
I find a workaround for this. You've to paste the maven URL into settings.gradle file. Some other user was facing a problem similar to this here . I did the same and it's working fine.
+1 / Failed to resolve: org.jitsi.react:jitsi-meet-sdk:3.+
5 min
I had added the maven dependency in the wrong place. It goes in the project gradle, under allprojects->repositories.
new fail
A problem occurred evaluating root project 'My Application'.
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
For me the problem was with the SDK version
I replaced this line
implementation ('org.jitsi.react:jitsi-meet-sdk:+') { transitive = true }
with this line
implementation ('org.jitsi.react:jitsi-meet-sdk:5.1.0') { transitive = true }
If you are using React-Native < 0.60, you should use a version < 2.0.0.
For versions higher than 2.0.0, you need to add the following piece of code in your metro.config.js file to avoid conflicts between react-native-jitsi-meet and react-native in metro bundler.
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/ios/Pods/JitsiMeetSDK/Frameworks/JitsiMeet.framework/assets/node_modules/react-native/.*/,
]),
},
};
ref: https://github.com/skrafft/react-native-jitsi-meet

Different errors with Gradle each time I tried most, common: ':app:processDebugManifest' (type 'ProcessMultiApkApplicationManifest')

A lot of errors building the gradle:
Gradle Scripts
build.gradle(Project:):
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.prototype"
minSdkVersion 23
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
proguardFiles
}
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 {
//https://developer.android.com/jetpack/androidx/releases/lifecycle
def lifecycle_version = "2.3.1"
def arch_version = "2.1.0"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
// Saved state module for ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
// optional - Test helpers for LiveData
testImplementation "androidx.arch.core:core-testing:$arch_version"
//https://developer.android.com/training/data-storage/room
def room_version = "2.3.0"
implementation "androidx.room:room-runtime:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
//https://developers.google.com/identity/sign-in/android/start-integrating
implementation 'com.google.android.gms:play-services-auth:19.2.0'
// https://mvnrepository.com/artifact/com.squareup.picasso/picasso
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
build.gradle(Module:Prototype):
ext {
buildToolsVersion = '30.0.0'
}// 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:4.1.3'
classpath 'com.google.gms:google-services:4.3.8'
// 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
}
gradle-wrapper.properties(Gradle Version)
#Tue Jul 27 13:37:39 BRT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip
ERRORS:
\app\build\intermediates\navigation_json\debug\navigation.json (The system cannot find the path specified)
\app\build\intermediates\merged_assets\debug\out
\app\build\intermediates\merged_manifest\debug\out\AndroidManifest.xml' specified for property 'mainMergedManifest' does not exist.
What i tried to do was:
Tried Gradle version: 6.5.1 and Gradle Plugin: 4.1.3
Tried Gradle version: 6.5.0 and Gradle Plugin: 4.1.0
Tried Gradle version: 6.7.1 and Gradle Plugin: 4.2.0
https://developer.android.com/studio/releases/gradle-plugin
Deleting "intermediates" in the build.
Changing the version min and max and target in the gradle;
[Copy] all the Classes and [Paste] in a new project.
Sometimes I believe that the error is not in the gradle but in the "room" libraries that I implemented, but the code seems to be according to the notes.Is there something that i must change?
In the end i found a Gradle and plugin that worked was:
Android Gradle plugin Version: 4.0.0
Gradle Version: 6.1.1
But i don't know if has something to do with the building but i found some bugs in the classes room, and it seems the builder was giving message error of the build process not the classes with the bugs.
I have encountered similar errors. My projects were on an SD card with FAT32 file system. The problem with this is that FAT32 does not support symbolic links.
Try not to store gradle projects on an SD card or any storage with a FAT32 file system.

Failed to calculate the value of task ':app:mergeLibDexDebug' property 'numberOfBuckets'. Expected minSdkVersion >= 21 but found 1

Have a good day everyone. I am starting my studies in Kotlin using Android Studio in its version 4.2.2. I have created a project from 0 using the IDE itself and I get the error:
Execution failed for task ':app:mergeLibDexDebug'
Failed to calculate the value of task ':app:mergeLibDexDebug' property
'numberOfBuckets'.
Expected minSdkVersion >= 21 but found 1
I was looking in other publications that spoke of compilation problems mainly due to incompatibilities in the dependencies included in the project, but none spoke exactly about the error that I am presenting...
The gradle module has the default code when creating the application which is the following:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.nueva"
minSdkVersion 28
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
The gradle project also has the default configuration that it brings when the application is created:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.5.20"
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.2.2"
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()
mavenCentral()
// jcenter() // Warning: this repository is going to shut down soon
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I don't have any additional implementation either in MainActivity.kt or another project file. If anyone has been through this error and fixed it please I would really appreciate if you would share with me how to eliminate this error. Maybe the solution is simple, but as I said before I am new to the world of Kotlin and I would like very much in the future to be able to be involved in the world of developing applications for smartphones. Without further ado, thank you very much in advance to anyone who can help
Can you make sure test on a Device >= API Level 21 ? Also check from Settings for New Projects to be selected Android 11.0 (R) or Android 9.0 Pie (check also these versions are installed in sdk manager)

Android Firestore cannot get FirestoreInstance

I am trying to set up the Firstore API with my Android project however when I try to call FirebaseFirestore.getInstance() I get this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.google.firebase.FirebaseApp.<clinit>(com.google.firebase:firebase-common##16.1.0:150)
at com.google.firebase.firestore.FirebaseFirestore.getInstance(com.google.firebase:firebase-firestore##18.1.0:70)
at ip.travelaid.backend.Database.<init>(Database.java:16)
at ip.travelaid.backend.CLITest.main(CLITest.java:11)
Caused by: java.lang.RuntimeException: Stub!
at android.os.Looper.getMainLooper(Looper.java:23)
at com.google.firebase.FirebaseApp$UiExecutor.<clinit>(com.google.firebase:firebase-common##16.1.0:987)
... 4 more
I have checked both my project and app level build.gradle files and they match what the documentation requires, even the Firebase Assistant in AS says that they are right. Just in case though here they are:
Module build.gradle:
// 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.2'
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 {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "ip.travelaid"
minSdkVersion 26
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.google.firebase:firebase-firestore:18.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
In the Firebase Console I have set up the database to deny any read/write requests but I thought that wouldn't affect my ability to get an instance to the database.
The google-services.json file for the Firebase project is up to date, I have even tried re-downloading it from the Firebase Console to no avail.
I have tried searching for a solution online but there seem to be nothing out there on it(this could well be down to me not being able to search for the issue properly though).
Is there a setting, either in the Firebase Console or AS, that I am missing that may be causing this issue?
update compiled & target sdk like so v
compiled sdk 26
to
compiled sdk 28
Obligatory: NVM I figured it out.
The problem was that I tried to run the code from the command line and not through an Android Emulator/Device actually running the app.
When I did run it there the problem disappeared.

Categories

Resources