redline under com.android.support:appcompat - android

I now have the following build.gradle Initially the compileSdkVersion and targetSdkVersion were set to 26 but I was getting a red line under
implementation 'com.android.support:cardview-v7:27.0.+'
implementation 'com.android.support:recyclerview-v7:27.0.+'
I then chaged compileSdkVersion and targetSdkVersion to 27, the red lines for the above two lines went away but now I have a red line under the following line
implementation 'com.android.support:appcompat-v7:27.0.2'
Below is my current
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.future.edge"
minSdkVersion 23
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.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
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.klinkerapps:android-smsmms:4.3.0'
implementation 'com.android.support:cardview-v7:27.0.+'
implementation 'com.android.support:recyclerview-v7:27.0.+'
}
apply plugin: 'com.google.gms.google-services'
What do you need to do to get rid of the red line under it?
implementation 'com.android.support:appcompat-v7:27.0.2'?
When I hover over it it says
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.0.2, 25.2.0. Examples include
com.android.support:animated-vector-drawable:27.0.2 and
com.android.support:support-media-compat:25.2.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that
are incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion.)

Current version of com.android.support:appcompat is 27.1.0.
Try this:
android {
compileSdkVersion 27
defaultConfig {
targetSdkVersion 27
}
dependencies {
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:cardview-v7:27.1.0'
implementation 'com.android.support:recyclerview-v7:27.1.0'
}
Also it's not the best practice to use notation like "27.0.+" to specify versions. You don't have control over versions so between builds you can get different implementations. Such change can affect your code and you won't know what is the source of the problem.
Edit:
The problem is here:
compile 'com.klinkerapps:android-smsmms:4.3.0'
you are including whole project which has it's own versions and you just can't mix them. Check inside of this repo for versions or just build this as .aar file and include as library to your project.

Related

error of library versions in gradle when importing graphview

I have android studio 3.3.2 and my goal is to import the GraphView library but, it turns out that it has given me an error that all the libraries must have the same version specification, I present an image of the error
error Tooltip info
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 27.1.1. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:27.1.1 less... (Ctrl+F1)
Inspection info:There are some combinations of libraries, or tools and libraries, that are incompatible, or can lead to bugs. One such incompatibility
is compiling with a version of the Android support libraries that is not the
latest version (or in particular, a version lower than your targetSdkVersion). Issue id: GradleCompatible
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.mrl.fredy.estadistica"
minSdkVersion 18
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(include: ['*.jar'], dir: 'libs')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.jjoe64:graphview:4.2.2'
implementation 'com.android.support:design:28.0.0'
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'
}
Instead of this
compileSdkVersion 28
targetSdkVersion 28
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
Use
compileSdkVersion 27
targetSdkVersion 27
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
GraphView library support library version is 27.
so you can downgrade your library version. if you do not want to downgrade then import GraphView as a module and in build.gradle file change to compileSdkVersion 28 and targetSdkVersion 28

android: gradle: same version for dependencies

I want to add fcm to my android project. Following the guide, I added firebase to my app and inserted the dependency. But now I get the error
All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 28.0.0, 26.1.0. Examples include com.android.support:animated-vector-drawable:28.0.0 and com.android.support:support-media-compat:26.1.0
on the appcompat dependency(or maybe I just haven't noticed it before)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "myApp.ginso.com.azul"
minSdkVersion 26
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Can anyone tell me, what I have to change?
Issue is that espresso-core is using older dependency of support library group. Increase it to latest version (3.0.2 or whatever latest is) or use below code instead of your existing code to explicitly remove support group from it:
androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.0.1') {
exclude group: "com.android.support"
}
Hope this will solve your problem.
Some of your libraries have used an older version of dependencies.
To resolve this add this dependency and try again
implementation 'com.android.support:support-media-compat:28.0.0'

I am facing a strange problem on integrating Admob into my Android Studio Project

So I'm trying to implement admob into my android project. I am following Google's official guide for this purpose (https://developers.google.com/admob/android/quick-start#import_the_mobile_ads_sdk)
but I am getting an error on adding this line into my build.gradle(Module app),
implementation 'com.google.android.gms:play-services-ads:17.1.1'
issue description :
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 28.0.0, 26.1.0. Examples include
com.android.support:animated-vector-drawable:28.0.0 and
com.android.support:customtabs:26.1.0 less... (Ctrl+F1) There are
some combinations of libraries, or tools and libraries, that are
incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion). Issue id: GradleCompatible
My Target SDK is API 14
My build.gradle(Module:app)
https://justpaste.it/684d6
replace with this.
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.bitpix.tales"
minSdkVersion 14
targetSdkVersion 28
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:28.0.0'
compile 'com.android.support:customtabs:28.0.0'
compile 'com.android.support:support-v4:28.0.0'
compile 'com.android.support:support-media-compat:28.0.0'
compile 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'com.android.support:design:28.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
}
apply plugin: 'com.google.gms.google-services'
Just copy and paste error version shown in gradle. For this scenario it is 'com.android.support:customtabs:26.1.0 '.
Implement this line in your gradle file it will solve the issue.
//add this line
implementation 'com.android.support:customtabs:26.1.0'
//change the version to your appcompat support version it will solve the problem
implementation 'com.android.support:customtabs:28.0.0'
compile gradle once. This error will be resolved.
there is number of dependency in support library Bundle, this library have not same version, but you can run without resolved this error. your app run fine.

com.google.firebase:firebase-database:16.0.1 issue

I just created an Android project using Android Studio (v3.1.4) which consists of 1 activity: LoginActivity (generated from wizard).
Here's the content of my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "app.anta40.com.home_client_app"
minSdkVersion 14
targetSdkVersion 28
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:28.0.0-rc01'
implementation 'com.android.support:design:28.0.0-rc01'
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'd like to use Firebase Database, so I added this line on build.gradle:
implementation 'com.google.firebase:firebase-database:16.0.1'
Then Android Studio red-underlined the appcompat-v7 part, saying:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 28.0.0-rc01, 26.1.0. Examples include
com.android.support:animated-vector-drawable:28.0.0-rc01 and
com.android.support:support-media-compat:26.1.0 less... (Ctrl+F1)
There are some combinations of libraries, or tools and libraries, that
are incompatible, or can lead to bugs. One such incompatibility is
compiling with a version of the Android support libraries that is not
the latest version (or in particular, a version lower than your
targetSdkVersion).
How to solve this?
There are incompatibility issues between your app compat which is: 'com.android.support:appcompat-v7:28.0.0-rc01' and firebase database version which is: 'com.google.firebase:firebase-database:16.0.1'.
One solution for this would be to use a lower targetsdk version like 27 and app compat, for example
implementation 'com.android.support:appcompat-v7:27.1.1'

Gradle dex issue when using support lib dependency v7:26.1.0

Hello I am having a problem with my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.dell"
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(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-firestore:12.0.1'
implementation 'com.firebaseui:firebase-ui-firestore:3.3.0'
implementation 'hanks.xyz:htextview-library:0.1.5'
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'
}
Android Studio gives me this warning:
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.1.0, 26.1.0. Examples include
com.android.support:recyclerview-v7:27.1.0 and
com.android.support:animated-vector-drawable:26.1.0
Can somebody please help me? I don't know what to do. I tried even making it v 27. I even deleted it, but it still didn't solve my problem.
I am also seeing this error:
Error:Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
Android Studio warning
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 27.1.0, 26.1.0. Examples include
com.android.support:recyclerview-v7:27.1.0 and
com.android.support:animated-vector-drawable:26.1.0
Problem
One of your dependencies (com.firebaseui:firebase-ui-firestore:3.3.0) has a transitive dependency on com.android.support:recyclerview-v7:27.1.0. Meanwhile, the support libraries that you manually declare in your build file use version 26.1.0.
Solution
Update compileSdkVersion and targetSdkVersion to 27 and your support libraries to 27.1.1
android {
compileSdkVersion 27
defaultConfig {
targetSdkVersion 27
...
}
...
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
...
}
Tip (optional)
Since com.android.support:design has transitive dependencies on com.android.support:appcompat-v7 and com.android.support:support-v4, you do not have to manually declare the appcompat-v7 or support-v4 dependencies if you declare the design dependency.

Categories

Resources