"Inconsistencies in the existing project dependencies found" error when using Navigation from Android Jetpack - android-studio

This problem started right after I updated my gradle version and gradle plugin, then I just updated android studio to Artic Fox 2020.3.1 and now I have gradle version 7.0.2 and gradle plugin 7.0.0.
I'm fairly new using android jetpack, I've been trying to use navgraphs so when I open navigation/my_navgraph.xml Android Studio tells me to add navigation dependencies but It has this "Inconsistencies in the existing project dependencies found" message that unables me to compile properly:
Message after opening my_navgraph.xml
This is my app level build.gradle:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 30
defaultConfig {
applicationId "com.example.app.prueba"
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
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
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.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
And this is the project level build.graddle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.0"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any ideas?, I think just messed up my gradle configuration or something, I will appreciate your help

Related

Could not resolve all files for configuration ':app:debugRuntimeClasspath'. error in android studio version dolphin 2021.3.1

My Android Studio Current version Dolphin 2021.3.1 patch 1, in my project I am getting following build error in empty project while adding a fresh dependency. ie.
implementation 'io.github.amrdeveloper:codeview:1.3.7'
getting from here >>> https://amrdeveloper.github.io/CodeView/install/#main-features
I have already checked lots of Solutions related this question but no luck.
build.gradle:project
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.3.1' apply false
id 'com.android.library' version '7.3.1' apply false
}
build.gradle:module
plugins {
id 'com.android.application'
}
android {
namespace 'com.myvpn.myapp'
compileSdk 32
defaultConfig {
applicationId "com.myvpn.myapp"
minSdk 21
targetSdk 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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
//added these two dependencies
implementation 'io.github.amrdeveloper:codeview:1.3.7'
implementation 'com.github.AmrDeveloper:CodeView:1.3.7'
}
Build Output.
enter image description here
i have tried turn off the Toggle Offline Mode .
enter image description here

Gardle sync error due to dependency being unresolvable

I am currently developing an android app with AR features using the library com.gorisse.thomas.sceneform:sceneform:1.21.0. It was working fine up until now. Whenever I try to sync the project the dependency is not resolvable.
I once had this exact same problem, but a simple computer restart resolved the issue. Now that doesn't work anymore. I tried deleting the .idea and .gradle folders and importing the project instead of opening it.
More details:
The error I get:
Failed to resolve: com.gorisse.thomas.sceneform:sceneform:1.21.0
Show in Project Structure dialog
Show Details
Affected Modules: app
What my build.gradle looks like:
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 33
packagingOptions {
resources {
pickFirsts += ['META-INF/DEPENDENCIES']
}
}
buildFeatures {
viewBinding true
}
defaultConfig {
applicationId "com.example.rocksterapp"
minSdk 29
targetSdk 33
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
}
androidResources {
noCompress 'filamat', 'ktx'
}
namespace 'com.example.<appname>'
}
dependencies {
implementation 'com.google.android.filament:filamat-android:1.21.1'
implementation 'com.gorisse.thomas.sceneform:sceneform:1.21.0'
implementation 'androidx.fragment:fragment-ktx:1.5.3'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-ui:2.5.2'
implementation 'androidx.navigation:navigation-fragment:2.5.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Edit:
I created a new project and just simply copied every file from the old one into it. Problem isn't fixed. Now not only one dependency can't be resolved but three. Sceneform is not included in these.

After my Android Studio was upgraded to Arctic Fox version, then can't run emulator correctly in this project, why?

After my Android Studio was upgraded to Arctic Fox version, then can't run emulator correctly in this project, why?
build.gradle(Module)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id "androidx.navigation.safeargs.kotlin" }
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.squall.doodlekong_android"
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'
}
}
buildFeatures {
viewBinding true
}
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.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.recyclerview:recyclerview:1.2.1"
//Scarlet
def scarletVersion = '0.1.12'
implementation "com.tinder.scarlet:scarlet:$scarletVersion"
implementation "com.tinder.scarlet:websocket-okhttp:$scarletVersion"
implementation "com.tinder.scarlet:lifecycle-android:$scarletVersion"
implementation "com.tinder.scarlet:message-adapter-gson:$scarletVersion"
implementation "com.tinder.scarlet:stream-adapter-coroutines:$scarletVersion"
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
//okhttp3
// define a BOM and its version
implementation(platform("com.squareup.okhttp3:okhttp-bom:4.9.0"))
// define any required OkHttp artifacts without version
implementation("com.squareup.okhttp3:okhttp")
implementation("com.squareup.okhttp3:logging-interceptor")
//Easy Permissions
implementation 'pub.devrel:easypermissions:3.0.0'
//Preferences DataStore
implementation "androidx.datastore:datastore-preferences:1.0.0-rc02"
implementation "androidx.datastore:datastore-preferences-core:1.0.0-rc02"
//Dagger Hilt
implementation 'com.google.dagger:hilt-android:2.38.1'
kapt 'com.google.dagger:hilt-compiler:2.38.1'
//Timber
implementation 'com.jakewharton.timber:timber:4.7.1'
def lifecycle_version = "2.4.0-alpha02"
// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
// Lifecycles only (without ViewModel or LiveData)
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
// alternately - if using Java8, use the following instead of lifecycle-compiler
implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version"
//Coroutine
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'
// Navigation component
def nav_version = "2.3.5"
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"
//Gson
implementation 'com.google.code.gson:gson:2.8.7'
//Lottie
implementation 'com.airbnb.android:lottie:4.0.0' }
build.gradle(Project)
buildscript {
ext.kotlin_version = "1.5.21"
repositories {
google()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.38.1'
def nav_version = "2.3.5"
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()
mavenCentral()
jcenter()
} }
task clean(type: Delete) {
delete rootProject.buildDir }
build error:
API 'BaseVariant.getApplicationIdTextResource' is obsolete and has
been replaced with 'VariantProperties.applicationId'. It will be
removed in version 7.0 of the Android Gradle plugin. For more
information, see TBD. To determine what is calling
BaseVariant.getApplicationIdTextResource, use
-Pandroid.debug.obsoleteApi=true on the command line to display more information.
I think if you inspect code with lint you will find the solution.
On Windows: gradlew :app:lint
On Linux/Mac: ./gradlew :app:lint
But, i think this error is causing because with Artic Fox new version require another call of arguments... search for call arguments in your code and change to "require_()" signature... for example, in kotlin: in place of "aguments!!", call "requireArguments()"
Hope i help you!

Android Studio GridLayout not working. Shows completely grey into Design View

I hope someone can help me with this :S
I am working on Android Studio 3.6.2 and Gradle version is 5.6.4.
I just tried to drag and drop a GridLayout into a ConstraintLayout. But for some reason the GridLayout shows completely grey.
I read in my research that could be something related with the Gradle files. I read I need:
1) implementation 'androidx.gridlayout:gridlayout:1.0.0'
2)
repositories {
google()
}
I have these two included in my Gradle files. So, am I missing something somewhere?
I upload a reference image and some code. Thanks in advance ;)
Design View
build.gradle (Project: AndroidSample)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.aretius.androidsample"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
}
build.gradle (Module: app)
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.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()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Well, I finally solved my problem reinstalling Android Studio with the latest version of it :)

lombok fails when compile with Gradle 4.5 in Android Studio 3.1.2

I want to use lombok in my Android Studio project.
My current build.gradle project file looks like this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app build.gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "app.getter.android"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
customDebugType {
debuggable true
}
}
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
I've already installed Lombok Plugin in my Android Studio 3.1.2 and all seems correct. All the lombok tools are available tu use it. The content assist shows all lombok dependencies and there isn't compilation errors in my workspace. However when I try to run a test, Gradle compiles my code and it can't find the lombok generated code like getters/setters or val variables are not transformed to my Java type so it seems that annotationProcessor is not invoked before the compilation or the generated code by the annotationProcessor isn't in the classpath when gradle makes the compilation.
I've tried to use gradle-lombok-plugin but nothing works for me. What I'm doing wrong?

Resources