In my gradle, I have a conflict in versions that gives me the error Cannot resolve symbol 'R' but I don't know what is the wrong version.
In my gradle, I have a conflict in versions that gives me the error Cannot resolve symbol 'R' but I don't know what is the wrong version.
Already tried every other solution:
Clean and Rebuild project
Sync project
Clean cache
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.ves.gennaio3"
minSdkVersion 14
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-ml-vision:17.0.1'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
compile 'com.github.satyan:sugar:1.5'
compile 'com.rmtheis:tess-two:6.0.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'
}
apply plugin: 'com.google.gms.google-services'
You cloud try the following:
File -> Invalidate Caches / Restart Android Studio -> Invalidate and Restart
Android Studio maintains information about which files are dependent on which other files. This means you not only have to Gradle sync your files, but you also need to invalidate studio caches.
Related
I am trying to run an old project on Android Studio, it used to work fine but now trying to run again without making any changes. I have tried many things but had no success and getting this error. Any help will be appreciated
A problem occurred configuring project ':app'.
I've updated the Gradle version but not sure where it's failing now.
Here is the gravel file.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.name"
minSdkVersion 30
targetSdkVersion 30
versionCode 3
versionName "3.0"
multiDexEnabled true
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-database:15.0.0'
implementation 'com.google.firebase:firebase-auth:15.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'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.google.firebase:firebase-core:15.0.2'
// implementation 'com.google.android.gms:play-services-ads:12.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
//implementation 'org.jetbrains.anko:anko-sdk15:0.8.2'
//implementation 'com.beust:klaxon:0.30'
}
apply plugin: 'com.google.gms.google-services'
If this project can run normally in the past, generally only need File -> Invalidate Caches
I have gone through all stackoverflow examples but couldn't find a solution for my problem. I tried to downgrade mz sdk vesrion and android:support but it didn't work.
I am having the following code in build.gradle. However, whenever I try to build my gradle it shows an error: Failed to resolve: com.android.support... Anyway I am able to successfully install apk to my devices and it runs perfectly. I just don't want that his dependency will cause some error in the future.
Thanks!
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.feecollector.android.feecollector"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.navigation_menu.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.0.1-alpha1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'de.hdodenhof:circleimageview:1.3.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.navigation_menu:runner:1.0.2'
androidTestImplementation 'com.android.support.navigation_menu.espresso:espresso-core:3.0.2'
implementation 'com.facebook.android:facebook-android-sdk:4.36.0'
}
You are using different versions of com.android.support.
this is your code:
implementation 'com.android.support:appcompat-v7:27.0.1-alpha1'
implementation 'com.android.support:design:27.1.1'
it should be like this:
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
You have issue with gradle local setting. You can try to Invalidate and Restart cache. Click File -> Invalidate caches.
Sometimes you might even other issues with updating to new Gradle level. For this case, remove .idea and .gradle folders from Project Room and Import it again from Idea start screen.
This is my dependencies file and there is an underlined red colored text on the compile 'com.android.support:appcompat-v7.27.1.1'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.abc.mcaproject"
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7.27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.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'
}
apply plugin: 'com.google.gms.google-services'
This because of this I am having problems changing themes in the styles.xml
when you hover over the red line it may show you the image like this which I have attached below.
What it tells you is there is a conflict of the version in some libraries so it suggests us to add those. For my case first, it showed for CardView and then for Design. So I added to it. Below is the code for it.
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.0'
implementation 'com.payumoney.sdkui:plug-n-play:1.2.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design: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'
}
so kindly add those it may be 2 or more than that.
Hope that helps.
In Android Studio 3.0 ,the compile configuration is now deprecated and should be replaced by implementation or api.
Just replace:
implementation 'com.android.support:appcompat-v7.27.1.1'
compile with implementation
testCompile with testImplementation.
debugCompile with debugImplementation.
androidTestCompile with androidTestImplementation.
compileOnly is still valid. It was added in 3.0 to replace provided and not compile.
for more information read this gradel doc
Reason of fail
You are using incompatible version of firebase with 27.1.1 support version.
Current version > 16.0.0 and you use 11.6.0.
Solution
Update your firebase dependencies versions. I suggest update target sdk version also.
Below is updated gradle as of date 1-10-2018, you can see firebase page to check latest version.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.abc.mcaproject"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
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.28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-database:16.0.2'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-storage:16.0.2'
}
apply plugin: 'com.google.gms.google-services'
Suggestion
Migrate to androidx because Android will not update support libraries after version 28.0.0.
just goto-> files->project structures->app->flavors
change your min SDK version and target SDK version to "API 27:"
then go to properties and check that your compile SDK version has also changed to the above version which you selected.
This worked for me.
i had a android studio project and it was wroks. I had push it to gitlab and after remove it , i had pull it again.
now i get this error when i want to build my gradle:
Error:The module 'app' is an Android project without build variants, and cannot be built.Please fix the module's configuration in the build.gradle file and sync the project again.
it's my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "sample.spart.com"
minSdkVersion 21
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.android.support:recyclerview-v7:26.0.0-alpha1'
}
what is the problem and how i can fix it??
Maybe you can try invalidating your cash.
in Android Studio:
File -> Invalidate Caches / Restart
Sharing your project's build.gradle file may help.
I am facing an issue with android studio 3.0.1, when I try to build the gradle project I have this message "Could not find method implementationSDKVersion()"
my gradle version is 4.1 and android plugin version is 3.0.1
here is my complete build.gradle file
apply plugin: 'com.android.application'
android {
implementationSdkVersion 26 //error on this line
defaultConfig {
applicationId "com.anatech.evidencereporter"
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.firebase:firebase-database:11.4.2'
implementation 'com.google.firebase:firebase-storage:11.4.2'
implementation 'com.firebaseui:firebase-ui-auth:3.1.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.0'
implementation 'com.google.android.gms:play-services-places:11.4.2'
implementation 'com.github.bumptech.glide:glide:3.7.0'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
any suggestions?
The problem is in implementationSdkVersion which should be compileSdkVersion. It happens when you are replacing automatically and blindly all the words "compile" with the word "implementation", without a "words" checkbox in the replacement options toolbar, due to gradle update. compile is deprecated for a future use but compileSdkVersion is not. Just had this issue.