cannot resolve Room dependencies - java

I want to add the following dependencies to my project:
1.compile "android.arch.persistence.room:runtime:1.0.0"
2.annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
but my project Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve android.arch.persistence.room:runtime:1.0.0.
the following text show my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.smm.room"
minSdkVersion 17
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
compile "android.arch.persistence.room:runtime:1.0.0"
annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
}

Update both to 1.1.1 version like:
implementation "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
Try the code below:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.smm.room"
minSdkVersion 17
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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 "android.arch.persistence.room:runtime:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
}
And your project grandle should be like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

I had the same problem and solved by:
1.-uncheck the offline work in settings
2.- adding in allprojects->repositories-> maven { url 'https://dl.google.com/dl/android/maven2/' } .
3.- repositories-> mavenCentral()
4.- in dependencies like below :
def room_version = "1.1.1"
implementation "android.arch.persistence.room:runtime:$room_version"
annotationProcessor "android.arch.persistence.room:compiler:$room_version"
// optional - RxJava support for Room
implementation "android.arch.persistence.room:rxjava2:$room_version"
// optional - Guava support for Room, including Optional and ListenableFuture
implementation "android.arch.persistence.room:guava:$room_version"
// Test helpers
testImplementation "android.arch.persistence.room:testing:$room_version"

Related

Could not resolve com.amitshekhar.android:android-networking:1.0.2

i am trying to import network library , but android studio shows up with this meessage:ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.amitshekhar.android:android-networking:1.0.2.
here is the build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.myfaild"
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.amitshekhar.android:android-networking:1.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
I know this is the old question, but I saw such a problem after removing jcenter() from repositories in gradle file:
repositories {
google()
jcenter()
}
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
this worked for me ,i had to add jitpack.io
Try this
compile 'com.amitshekhar.android:android-networking:1.0.2'
When using it with Jackson Parser
implementation 'com.amitshekhar.android:jackson-android-networking:1.0.2'
When using it with RxJava
implementation 'com.amitshekhar.android:rx-android-networking:1.0.2'
When using it with RxJava2
compile 'com.amitshekhar.android:rx2-android-networking:1.0.2'
add this line in gradle.properties:
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

Could not find com.github.rey5137:material:1.3.0

apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.ecommerce"
minSdkVersion 19
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 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
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.firebase:firebase-analytics:17.3.0'
implementation 'com.github.rey5137:material:1.3.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
}
apply plugin: 'com.google.gms.google-services'
I have been working on android studio nowadays but when I copied three dependencies the sync was not successful.Please help me out !!!!!
The dependencies which I copied from https://github.com/rey5137/material are given below
implementation 'com.github.rey5137:material:1.3.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
They are also distribute this library via Jcenter.
You can add new repository to your build.gradle, which is main directory (root) of your project (not in app!!!).
To the end of the file you should find allprojects with repositories inside. Here add new repository:
maven { url 'https://jitpack.io' }
So it should look like:
allprojects {
repositories {
maven { url 'https://jitpack.io' } <---- add this line
}
}
(section allprojects probably is on the bottom of the build.gradl file)

Android: Unable to resolve dependency

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'
}
}

Realm annotation processor error not picking up

I have been getting the error about the annotation processor for the Realm library fails to load, am I missing something? Where do I add it in or what should I do?
This is the error I get:
"Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- realm-android-0.82.1.jar (io.realm:realm-android:0.82.1)"
Please help.
App.Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.version.crt.myapplication"
minSdkVersion 22
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'io.realm:realm-android:0.82.1'
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'
}
Project.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// 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
}
Please assist!
Follow the instructions as mentioned in realm docs
Step 1: Add the class path dependency to the project level build.gradle file. (Which you refer to as Project gradle in question)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:5.4.1"
}
}
...
Step 2: Apply the realm-android plugin to the top of the application level build.gradle file. (Which you refer to as App gradle in question)
apply plugin: 'realm-android'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.version.crt.myapplication"
minSdkVersion 22
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
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 below two line
implementation 'io.realm:realm-android:0.82.1'
annotationProcessor 'io.realm:realm-android:0.82.1'
instead of just one line
implementation 'io.realm:realm-android:0.82.1'
should resolved the problem.

After updating to latest Firebase I am getting error "Unable to merge dex"

I am currently working on application, after updating to latest firebase I am get error "Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex"
build.gradle(Project)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.1.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.0'
defaultConfig {
applicationId "com.example.vishalverma.androideatitserver"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
jumboMode true
javaMaxHeapSize "4g"
}
}
dependencies {
implementation ('com.github.jd-alexander:android-flat-button:v1.1')
implementation 'com.github.d-max:spots-dialog:0.7#aar'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//Support library
implementation 'com.android.support:appcompat-v7:27+'
implementation 'com.android.support:mediarouter-v7:27+'
implementation 'com.android.support:design:27+'
implementation 'com.android.support:cardview-v7:27+'
implementation 'com.android.support:animated-vector-drawable:27+'
implementation 'com.android.support:recyclerview-v7:27+'
//Firebase
implementation 'com.google.firebase:firebase-config:11.8.0'
implementation 'com.google.firebase:firebase-crash:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.2'
//Location
implementation 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.google.android.gms:play-services:11.8.0'
//Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-scalars:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.2.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
implementation 'com.jaredrummler:material-spinner:1.2.4'
testImplementation 'junit:junit:4.12'
implementation 'info.hoang8f:fbutton:1.0.5'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
apply plugin: 'com.google.gms.google-services'

Categories