Error inflating class > com.google.android.material.switchmaterial.SwitchMaterial - android

So I use SwitchMaterial in one layout:
<com.google.android.material.switchmaterial.SwitchMaterial...
And Firebase Crashlytics spams me with the following errors for many users
Fatal Exception: java.lang.RuntimeException Unable to start activity
ComponentInfo{...}: android.view.InflateException: Binary XML file
line #324: Binary XML file line #324: Error inflating class
com.google.android.material.switchmaterial.SwitchMaterial
Caused by android.content.res.Resources$NotFoundException File
res/drawable/abc_switch_thumb_material.xml from drawable resource ID
#0x7f080047
App theme:
<style name="AppTheme" parent="Theme.MaterialComponents.Light.NoActionBar">...
Material dep:
implementation "com.google.android.material:material:1.6.1"
What does it mean?
Update
I tried to use Switch from AndroidX AppCompat library instead and still the same issue with drawable:
Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{****.ui.MainActivity}: android.view.InflateException: Binary XML file line #324: Binary XML file line #324: Error inflating class androidx.appcompat.widget.SwitchCompat
Caused by android.content.res.Resources$NotFoundException Drawable ***:drawable/abc_switch_thumb_material with resource ID #0x7f080047
This is so weird, it works fine for my smartphones though but it's effected 22 my users already
Yes, I have both the following options enabled for release builds
minifyEnabled true
shrinkResources true
But it worked fine all the time for different apps and I never had to add anything to a proguard file to keep drawable of some third party libraries (especially Google libraries) - abc_switch_thumb_material
Update 2
I just tried to download APK generated by Google Play Console from my AAB file
I checked apk\res\drawable\ and found that drawable is available
This is magic...
But this generated APK is universal and Google Play Consoles generates different APK based on type of device and its Android version, so what happens in this case I don't know
Update 3
I will try to use just Switch even if Android Studio shows the following warning:
Use SwitchCompat from AppCompat or SwitchMaterial from Material
library
But at least I hope my app will stop getting crashed for some users because of it
p.s. devices for which the error happens (Firebase Crashlytics):
My build.gradle files of that app (if it's helpful in anyway and mb there are some conflicts between libraries)
Project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = "1.7.10"
nav_version = "2.5.1"
hilt_version = "2.43.2"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.2.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.gms:google-services:4.3.13"
classpath "com.google.firebase:firebase-crashlytics-gradle:2.9.1"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" // for DataStore
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App module build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-kapt"
id "com.google.gms.google-services"
id "com.google.firebase.crashlytics"
id "kotlin-parcelize"
id "dagger.hilt.android.plugin"
id "androidx.navigation.safeargs.kotlin"
id "kotlinx-serialization" // for DataStore
}
android {
compileSdkVersion 32
defaultConfig {
applicationId ***
minSdkVersion 21
targetSdkVersion 32
multiDexEnabled true
versionCode 18
versionName "1.0.15"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
manifestPlaceholders = [crashlyticsEnabled: false]
signingConfig signingConfigs.release
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
manifestPlaceholders = [crashlyticsEnabled: true]
signingConfig signingConfigs.release
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}
buildFeatures {
dataBinding = true
}
}
dependencies {
implementation "androidx.core:core-ktx:1.8.0"
implementation "androidx.appcompat:appcompat:1.5.0"
implementation "androidx.activity:activity-ktx:1.5.1"
implementation "androidx.fragment:fragment-ktx:1.5.2"
implementation "androidx.multidex:multidex:2.0.1"
implementation "com.google.android.material:material:1.6.1"
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "com.jakewharton.timber:timber:5.0.1"
implementation platform("com.google.firebase:firebase-bom:30.3.2")
implementation "com.google.firebase:firebase-analytics"
implementation "com.google.firebase:firebase-crashlytics"
implementation "com.google.firebase:firebase-ads:21.1.0"
implementation "com.google.android.ump:user-messaging-platform:2.0.0"
implementation "com.android.billingclient:billing-ktx:5.0.0"
def lifecycle_version = "2.5.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// Navigation Component
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
// Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
// OkHttp
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
// Retrofit
def retrofit = "2.9.0"
implementation "com.squareup.retrofit2:retrofit:$retrofit"
implementation "com.squareup.retrofit2:converter-gson:$retrofit"
// Glide
def glide_version = "4.13.2"
implementation "com.github.bumptech.glide:glide:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"
// Pagination
implementation "androidx.paging:paging-runtime-ktx:3.1.1"
// Datastore
implementation "androidx.datastore:datastore:1.0.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-protobuf:1.4.0"
implementation "org.jsoup:jsoup:1.15.2"
testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}

the crashes stopped when i switched to using <Switch>
both <SwitchCompat> and <SwitchMaterial> caused crashes in production

Related

Include used 3rd party libraries in Android Library

I made an Android Library. I upload it to Azure Artifact and pull it to my project from there.
I am making a service call with retrofit in the library. I'm using Moshi or Kotlinx-Serialization for Converter, but if I don't add these libraries to the Project where I use the library, I get errors like ClassNotFoundException. After adding, these errors go away, but the variables in the service models do not hold the data and remain null.
I think this is due to the 3rd party library (Moshi, KotlinX-Serialization, ...).
I found a way to include the 3rd party libraries I use in the library in the .aar package.
task copyLibs(type: Copy) {
from configurations.implementation
into 'libs'
}
But when I run the task I got this error.
Resolving dependency configuration 'implementation' is not allowed as it is defined as 'canBeResolved=false'.
Instead, a resolvable ('canBeResolved=true') dependency configuration that extends 'implementation' should be resolved.
The .aar file path for my library consists of ->
Projects/MySDK-Android/MySDK/build/outputs/aar/MySDK-release.aar
I think if I include the 3rd party library I use for serialization (Moshi, KotlinX-Serilalization, Gson, ...) into my library, the problem will be solved.
Any help on how I can do it?
build.gradle
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
id 'kotlin-parcelize'
id "kotlinx-serialization"
}
android {
compileSdk 31
defaultConfig {
minSdk 23
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'
}
kotlin {
// for strict mode
explicitApi()
// for warning mode
explicitApiWarning()
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.1"
// Logger
implementation 'com.orhanobut:logger:2.2.0'
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2"
// KotlinX Serialization
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2"
implementation "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:0.8.0"
}
task copyLibs(type: Copy) {
from configurations.customConfig
into "$project.rootDir/build/outputs/"
}
apply plugin: 'maven-publish'
apply plugin: "kotlinx-serialization"
publishing {
publications {
maven(MavenPublication) {
groupId 'com.my.mysdk-android'
artifactId 'mysdk-android'
version '1.0.0'
artifact("$projectDir/build/outputs/aar/MySDK-release.aar")
}
}
repositories {
maven {
url 'https://pkgs.dev.azure.com/......'
credentials {
username "MySDK.Android"
password accessToken
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

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

After Kotlin 1.6 and Android Studio update, databinding shows errors but app compiles and runs fine

My android studio version is
Arctic Fox | 2020.3.1 Patch 3
Build #AI-203.7717.56.2031.7784292, built on October 1, 2021
After updating IDE and kotlin to 1.6, I opened a project I was working on and Android Stidio marked data binding fields as red, showing the following error:
In text:
Cannot access 'androidx.databinding.Observable' which is a supertype of
'com.cioccarellia.wordbucket.databinding.ActivityMainBinding'.
Check your module classpath for missing or conflicting dependencies
The weird thing is that everything compiles and the app works just fine, these errors are just in the IDE, and they pop up every time I access views through data binding.
I haven't changed my dependencies since updating android studio. Anyone else has the same problem / solution for this situation?
The Main Activity xml:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<data>
</data>
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:id="#+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.cioccarellia.wordbucket.activity.MainActivity">
...
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</layout>
General build.gradle:
buildscript {
ext {
kotlin_version = "1.6.0"
}
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://jitpack.io' }
}
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.dagger:hilt-android-gradle-plugin:2.40.3"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
classpath "com.github.ben-manes:gradle-versions-plugin:0.39.0"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
Application build.gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "kotlin-kapt"
id "dagger.hilt.android.plugin"
id "com.google.gms.google-services"
id "androidx.navigation.safeargs.kotlin"
id "com.github.ben-manes.versions"
id "kotlin-parcelize"
id "com.google.firebase.crashlytics"
}
android {
compileSdk 31
defaultConfig {
applicationId "com.cioccarellia.wordbucket"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
buildTypes {
debug {
versionNameSuffix ".dev"
}
release {
debuggable false
// Enables code shrinking, obfuscation, and optimization
minifyEnabled true
// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources true
// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
dataBinding true
}
sourceSets {
main.res.srcDirs = [
"src/main/res",
"src/main/res-public"
]
android.sourceSets.all {
java.srcDir("src/$name/kotlin")
}
}
lintOptions {
// if set to true (default), stops the build if errors are found.
abortOnError false
// if true, only report errors.
ignoreWarnings false
}
}
dependencies {
// AndroidX
implementation "androidx.core:core-ktx:1.7.0"
implementation "androidx.appcompat:appcompat:1.4.0"
implementation "androidx.constraintlayout:constraintlayout:2.1.2"
implementation "com.google.android.material:material:1.6.0-alpha01"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
// Lifecycle
def lifecycle_version = "2.4.0"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:2.3.5"
implementation "androidx.navigation:navigation-ui-ktx:2.3.5"
// Coroutines
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
// DI -> Hilt
implementation "com.google.dagger:hilt-android:2.40.3"
kapt "com.google.dagger:hilt-compiler:2.40.3"
// Import the Firebase BoM
implementation platform("com.google.firebase:firebase-bom:28.4.2")
// When using the BoM, you don"t specify versions in Firebase library dependencies
implementation "com.google.firebase:firebase-crashlytics-ktx"
implementation "com.google.firebase:firebase-analytics-ktx"
implementation "com.google.firebase:firebase-auth-ktx"
implementation "com.google.firebase:firebase-firestore-ktx"
// LeakCanary
debugImplementation "com.squareup.leakcanary:leakcanary-android:2.7"
// Logging
implementation "com.jakewharton.timber:timber:5.0.1"
// Styles
implementation 'com.airbnb.android:paris:2.0.1'
kapt 'com.airbnb.android:paris-processor:2.0.1'
// JUnit Default Dependencies
testImplementation "junit:junit:4.13.2"
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.espresso:espresso-core:3.4.0"
}
Try to restart the IDE. If that does not work, clean the project be going to Build > Clean Project at the top of the window, then completely rebuild it by going to Build > Rebuild Project.
Edit:
Another reason is that Android Studio will no longer support binding to straight elements, so you have have to specify the binding yourself.
To do this, add BuildFeatures in the application gradle file:
android {
compileSdk 31
//This right here
buildFeatures{
viewBinding true
}
defaultConfig {
applicationId "com.cioccarellia.wordbucket"
minSdk 23
targetSdk 31
versionCode 1
versionName "1.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary true
}
Then create a new binding by adding this to your activity file:
//Declare the binding
private lateinit val binding : ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
//Initialize the binding
binding = ActivityMainBinding.inflate(layoutInflater)
super.onCreate(savedInstanceState)
//Change the content view to the root of the binding
setContentView(binding.root)
}
Then reference binding when using your views:
binding.toolbar.title = bucket.name
Updating android studio fixed the issue

Failed Android build - unable to find Guava repository

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.

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.

Categories

Resources