I'm new to using android studio and basically I'm having a problem with my dependencies I'm not sure what happened but I've tried updating my gradle plugin version to 3.5.1 and the gradle version to 5.4.1 and still nothing happened. Also I've tried updating my SDK but its still giving me the same error.
ERROR:
ERROR: Unable to resolve dependency for ':robotutility#debug/compileClasspath': Could not resolve project :nerarosbridgeclient.
Here is my Build.Gradle Project:
// 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.5.1'
// 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
}
& Build Gradle Module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
applicationId 'com.nerarobotics.robotutility'
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//noinspection DuplicatePlatformClasses
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout: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'
implementation 'com.jaredrummler:material-spinner:1.3.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation project(path: ':nerarosbridgeclient')
}
Settings.gradle
include ':robotutility', ':nerarosbridgeclient'
Thanks in advance!
Probably project nerarosbridgeclient is not included in your settings.gradle or project missing in your workspace. Please check and update.
Add this line in settings.gradle if missing:
include ':nerarosbridgeclient'
Related
I tried to run my project for first time but I faced this error:
Failed to notify dependency resolution listener.
Problems reading data
from Binary store in
C:\Users\Ghaem\AppData\Local\Temp\gradle9202596089529693792.bin
(exist: true)
I've tried changing version of gradle to all available version with no luck.
My Project (root) build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
jcenter()
maven { url 'https://repo1.maven.org/maven2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.1.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
}
My App build.gradle file:
buildscript {
repositories { maven { url 'https://plugins.gradle.org/m2/' } }
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.itechnotion.wpnews"
minSdkVersion 15
targetSdkVersion 26
versionCode 5
versionName "1.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [onesignal_app_id: "f893b120-b601-41e5-b0e3-715626efe0a3",
onesignal_google_project_number: "REMOTE"]
}
buildTypes {
release {
minifyEnabled false
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4: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'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support:recyclerview-v7:26.1.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.4.1'
compile 'com.squareup.okhttp3:okhttp:3.4.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.squareup.okhttp3:logging-interceptor:3.8.0'
compile 'com.squareup.okhttp:okhttp:2.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.facebook.stetho:stetho:1.1.1'
compile 'com.facebook.stetho:stetho-okhttp:1.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.firebase:firebase-core:16.0.0'
compile 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
compile 'org.jsoup:jsoup:1.10.1'
compile 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
Error: Program type already present:
com.google.android.gms.internal.measurement.zzet
Update classpath
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.3.2'
}
OneSignal-Gradle-Plugin
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.6, 0.99.99]'
Use implementation instead of compile.
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
You are using very old versions. If you want to use latest then libraries will not work unless you make the following changes in your app:
Upgrade compileSdkVersion to 28 or later.
Update your app to use Jetpack (AndroidX).
AndroidX replaces the original support library APIs with packages in the androidx namespace. Read official guideline about AndroidX Overview.
compileSdkVersion 29
defaultConfig {
minSdkVersion 21
targetSdkVersion 29
buildToolsVersion '29.0.2'
multiDexEnabled true
}
Your appcompat:appcompat & constraintlayout will
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
I'm new to using Android Studio and basically I'm having problem with my dependencies I've tried upgrading my gradle plugin version to 3.5.1 and my gradle version to 5.4.1 and still nothing happened. I basically have 2 projects in my workspace one is the nerarosbridgeclient which is my library and the robot utility which is my main application..
here is my ERROR:
Unable to resolve dependency for ':robotutility#debug/compileClasspath': Could not resolve project :nerarosbridgeclient.
Unable to find a matching configuration of project :nerarosbridgeclient:
- None of the consumable configurations have attributes. Could not resolve
project :nerarosbridgeclient. Required by: project :robotutility Caused
by:org.gradle.internal.component.NoMatchingConfigurationSelectionException:
Unable to find a matching configuration of project :nerarosbridgeclient:
- None of the consumable configurations have attributes.
My build.gradle(Project):
// 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.5.1'
// 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
}
My build.gradle(Module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.1"
defaultConfig {
applicationId 'com.nerarobotics.robotutility'
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//noinspection DuplicatePlatformClasses
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:23.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout: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'
implementation 'com.jaredrummler:material-spinner:1.3.1'
implementation 'com.google.code.gson:gson:2.8.6'
implementation project(path: ':nerarosbridgeclient')
}
And my settings.gradle
include ':robotutility', ':nerarosbridgeclient'
my LIBRARY build.gradle:
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles 'consumer-rules.pro'
}
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'
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.code.gson:gson:2.8.6'
implementation 'com.neovisionaries:nv-websocket-client:2.9'
}
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
}
}
Added two custom zxing and zbar libraries for reading and generating barcodes via File>New> Jar.file added them after in Project Structure too added them and chose implementation in all already open questions compile is used but in android studio it is no longer instead of it implementation and api how to add them correctly?
build.gradle (app)
apply plugin: 'com.android.application'
check.dependsOn 'assembleDebugAndroidTest'
android {
compileSdkVersion 28
flavorDimensions "minSdkVersion"
defaultConfig {
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner
'android.support.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:28.0.0'
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
// Firebase Authentication
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.2.0'
implementation 'com.google.android.gms:play-services-maps:16.1.0'
implementation 'com.google.firebase:firebase-database:16.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
implementation project(':zbar')
implementation project(':zxing_core')
}
apply plugin: 'com.google.gms.google-services'
build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenLocal()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:4.2.0'
}
}
allprojects {
repositories {
mavenLocal()
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'd suggest to use dependencies from here https://mvnrepository.com/artifact/com.google.zxing but in your case (as long as you're adding jars), you can plug them in via implementation fileTree(include: ['*.jar'], dir: 'libs') in build.gradle (libs to be replaced with whatever folder they landed into).
I use firebase on my project. So at the bottom of my app/build.gradle file is
apply plugin: 'com.google.gms.google-services'.
When I want to activate Databinding with
dataBinding {enabled true}
I'm getting the error;
"Gradle sync failed: Can not change dependencies of configuration ': app: api' after it has been included in dependency resolution."
As a result, when multiple plugins are added, DataBinding gives an error. I still can not find a solution.
How to use data binding in a project using Google Services?
Android Studio 3.1.2
Gradle 4.4
The problem is in the gms version. The problem has been resolved with version 4.0.1
// classpath 'com.google.gms:google-services:3.3.1'
classpath 'com.google.gms:google-services:4.0.1'
Fix with further steps -
1 In App level bulid.gradel file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "test.com.apptest"
minSdkVersion 15
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(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.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'
// add firbase
implementation 'com.google.firebase:firebase-messaging:15.0.2'
}
2. Project level gradel file.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I try implementing an app that put details about you in database in Firebase.
I do the sync with the code from the website from Firebase
Android Studio Version: 3.0.1
The Code is from THIS
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
//you need to add this line
classpath 'com.google.gms:google-services:3.2.0' // google-services plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle in the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.eranp.clientpage"
minSdkVersion 19
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'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation files('libs/activation.jar')
implementation files('libs/additionnal.jar')
implementation files('libs/mail.jar')
compile 'com.google.firebase:firebase-auth:11.8.0'
}
apply plugin: 'com.google.gms.google-services'
The error output:
Error:Could not find com.google.gms:google-services:3.2.0. Searched
in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/google/gms/google-services/3.2.0/google-services-3.2.0.jar
Required by:
project :
What do I need to do to fix that?