Android error: Failed to resolve: :unspecified: Affected Modules: app - android

I keep getting the error "Failed to resolve: :unspecified: Affected Modules: app" whenever I sync my gradle. This error is not descriptive and hence hard to figure out what's the exact cause for this.
App build.gradle:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 29
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.sample.sample"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
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'
//testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.clevertap.android:clevertap-xiaomi-sdk:1.0.1'
}
Project build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
maven {
url "https://jitpack.io"
}
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
maven {
url "https://maven.google.com"
}
maven {
url "https://jitpack.io"
}
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I am using Android Studio 4.1.3 on MacBook Air with macOS 10.15.7

This is happening because of 'com.clevertap.android:clevertap-xiaomi-sdk:1.0.1' This library is not having the correct dependency specified in their pom file.
you can check the same in the link below and scroll down to dependency tag you will see the problem.
https://search.maven.org/artifact/com.clevertap.android/clevertap-xiaomi-sdk/1.0.1/aar
You can create an issue with clevertap team on this repo
https://github.com/CleverTap/clevertap-android-sdk
for module clevertap-xps
Hope I was any help to you.
Cheers.

Related

Cannot import FirebaseMessagingService even with right dependecies

I'm trying to connect firebase to my app for the cloud messaging services. I made all the changes needed in gradle files that docs mentioned.
here are my grade files:
Project Level:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.1.0-beta01'
}
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
maven {url "https://maven.google.com"}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
classpath 'com.google.gms:google-services:4.3.14'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
allprojects {
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
maven {url "https://maven.google.com"}
}
}
Module Level:
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.codax.codax_app"
minSdk 23
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_9
targetCompatibility JavaVersion.VERSION_1_9
}
buildToolsVersion '32.1.0-rc1'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'junit:junit:4.13.2'
implementation 'androidx.test.ext:junit:1.1.3'
implementation 'com.android.volley:volley:1.2.1'
implementation 'com.google.firebase:firebase-messaging:23.1.1'
}
When I sync gradle files I get no error but when trying to import firebase like this:
import com.google.firebase.messaging.FirebaseMessagingService;
i get this error : Cannot resolve firebase
I tried cleaning and invalidating the cache(i use android studio) and resyncing gradle files but nothing helped.
and there is no other path that contains the firebase classes.
What am i doing wrong here? thanks in advance.

Could not resolve all files for configuration ':app:debugCompileClasspath' while adding a 3rd party library

I'm trying to add a library to apply page curl effect animation in android and after adding the dependency and click on sync it worked fine but when I try to run the app its giving me an error as:
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
I searched about it in google and tried different solutions like toggle offline mode and toggle online mode, adding maven { url 'https://maven.google.com' } to project level repositories but nothing worked for me.
I'm attaching the app level gradle file and project level gradle file below.
Any help would be really helpful. Thanks in advance.
app level build.gradle file
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.animations"
minSdk 23
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
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
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.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "com.airbnb.android:lottie:3.4.0"
implementation("androidx.dynamicanimation:dynamicanimation:1.0.0")
implementation 'app.num.numandroidpagecurleffect:numandroidpagecurleffect:1.0'
}
project level build.gradle file
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
id 'org.jetbrains.kotlin.android' version '1.6.21' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
settings.gradle file
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "Animations"
include ':app'

Could not find method dependencyResolutionManagement() for arguments [build_ckqar66poaozqtyzw4dyn6sx4$_run_closure3#a921a13] on project app

I have a trouble in my build.gradle file because there is a method called dependencyResolutionManagement() but I don't know how to solve it.
The error says that there are not method.
This is the message:
Also I have an error that says 'Cannot Resolve symbol 'RepositoriesMode' on my build gradle.
I think I was modifying my build.gradle to add some dependence but I did something wrong. These are the message and my build.gradle file
build.gradle
1 error
Could not find method dependencyResolutionManagement() for arguments [build_ckqar66poaozqtyzw4dyn6sx4$_run_closure3#a921a13] on project ':app' of type org.gradle.api.Project
This is my build.gradle file
Cannot resolve symbol 'RepositoriesMode'
import org.gradle.api.initialization.resolve.RepositoriesMode
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 31
buildToolsVersion "30.0.3"
defaultConfig {
applicationId 'com.example.myapp'
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
allprojects {
repositories {
google()
mavenCentral()
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard- a.ndroid-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:20.5.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-inappmessaging'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.android.gms:play-services-ads:20.5.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter()
maven { url 'https://jitpack.io' }
}
}
rootProject.name = "appname"
include ':app'
I tried Invalidate- Restart Caché but it didn't work. I think I was modifying the build.gradle code and I made something wrong.
Try this:
Remove from your build.gradle file
repositories {
mavenCentral()
}
Add to your settings.gradle the next code section:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter() // Warning: this repository is going to shut down soon
}
}
Try to sync again your project
This worked for me!!

Unable to build gradle; Execution failed for task ':app:processDebugMainManifest'

Execution failed for task ':app:processDebugMainManifest'.
Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module #3bcb9348
I am receiving this error on building a project in Android-Studio, I have tried almost all the methods suggested on stack-overflow and youtube, I have tried completely removing all android studio files and reinstalling them but still am unable to sort it.
These are my build.gradle files
build.gradle: (Module: EmployerModule.app)
*plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.example.employermodule"
minSdkVersion 18
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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}*
Build.gradle(EmployerModule)
*// 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:4.2.1"
// 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
}*

Unable to resolve dependency for ':app#debug/compileClasspath':Could not resolve com.android.databinding:library:3.2.1

i am facing a problem with android studio 3.2.1 and the Gradle build version is 4.6. Recently i updated my android studio to 3.2.1 and and gradle is also updated to 4.6. If we remove the dataBinding, erors will be disappears. after adding the dataBinding its giving problem like
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.databinding:library:3.2.1.
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.databinding:adapters:3.2.1.
Unable to resolve dependency for
':app#debugAndroidTest/compileClasspath': Could not resolve
com.android.databinding:library:3.2.1.
my Gradle build of the project level is
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they
belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
is any one solved this issues please help in this case.I have tried all the trials but did not worked.
my app level gradle is
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.sample.mvvmandroidstudio"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-
layout:1.1.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'
}
I made some edit in your gradle.
Project level
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App level
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.sample.mvvmandroidstudio"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
}
Changes I made:
Removed duplicate google repo
Removed testing dependencies, as I don't think you use it.
I resolved my issue by updating my android studio to recent version.
Thanks to Khemraj for your valuable time.
This can be fixed by uncheck the offline work in settings->Build,Execution Deployment->gradle.Hope it will help for you.

Categories

Resources