All my dependencies start from a verson 27, but the build task is still finishing with an Exception:
Error: All com.android.support libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 27.1.1, 25.4.0. Examples include com.android.support:animated-vector-drawable:27.1.1 and com.android.support:cardview-v7:25.4.0 [GradleCompatible]
I know that I can add
lintOptions {
abortOnError false
}
and it will fix my issue, but I want to establish the reason.
Here is my build.gradle file:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "my.company.app"
minSdkVersion 19
targetSdkVersion 27
multiDexEnabled true
versionCode 1
versionName "0.10.8"
vectorDrawables.useSupportLibrary = true
}
testOptions {
unitTests.returnDefaultValues = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField("String", "ENV_URL_PREFIX", "\"https://\"")
buildConfigField("String", "ENVIRONMENT", "\"release\"")
}
staging {
initWith debug
buildConfigField("String", "ENV_URL_PREFIX", "\"https://staging.\"")
buildConfigField("String", "ENVIRONMENT", "\"staging\"")
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField("String", "ENV_URL_PREFIX", "\"https://dev.\"")
buildConfigField("String", "ENVIRONMENT", "\"dev\"")
}
}
flavorDimensions "app"
productFlavors {
_Live {
dimension "app"
buildConfigField("String", "TYPE", "\"live\"")
}
_Test {
dimension "app"
buildConfigField("String", "TYPE", "\"test\"")
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'lib/x86_64/darwin/libscrypt.dylib'
exclude 'lib/x86_64/freebsd/libscrypt.so'
exclude 'lib/x86_64/linux/libscrypt.so'
}
}
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'
implementation 'com.android.support:gridlayout-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.0'
implementation 'me.dm7.barcodescanner:zxing:1.8.4'
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-messaging:17.1.0'
implementation 'com.google.android.gms:play-services-location:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.zxing:zxing-parent:3.3.3'
implementation 'com.google.zxing:core:3.3.2'
implementation 'com.google.guava:guava:22.0'
implementation project(':mobile_api') // a module compiled with java plugin
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'
}
My idea that some of the dependencies transit a com.android.support libraries with version 25.4.0.
I would be grateful for any suggestions.
Thanks in advance!
You are using this library 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0',
and it in turn uses dependency 'com.android.support:cardview-v7:25.4.0'
Perhaps this is the cause of the conflict.
Add this to the very end of your root level build.gradle:
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') { details.useVersion '27.x.x' }
}
}
To fix it I added a dependency
implementation 'com.android.support:cardview-v7:27.1.1'
in my build.gradle which overrides 25.4.0. Therefore, you do not need to look for a dependency that includes a breaking library.
Related
How can I solve this issue? I tried searching in YouTube and Chrome couldn't find the relevant solution for this. There are three issues faced. I tried changing various things in settings and tried different solution but none of those helped
THIS IS BUILD.GRADLE (app):
apply plugin: 'com.android.application'
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion '29.0.1'
defaultConfig {
applicationId "com.pdf.scanner.queenscanner"
minSdkVersion 16
targetSdkVersion 31
versionCode 1
versionName '1.1'
multiDexEnabled true
//Photo editor
renderscriptTargetApi 23
renderscriptSupportModeEnabled true
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
//Photo editor
dataBinding {
enabled = true
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
repositories {
maven { url "http://jitpack.io" }
//tedpicker
maven { url "http://repo.commonsware.com.s3.amazonaws.com" }
maven { url "http://s3.amazonaws.com/repo.commonsware.com" }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
//Add library
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
//hungdh
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation project(':openCVLibrary310')
//Photo editor
// annotationProcessor 'ly.img.android:photo-editor-sdk:2.0.27'
// compile 'ly.img.android:photo-editor-sdk:2.0.27'
//OCR
implementation 'com.rmtheis:tess-two:6.1.1'
implementation 'com.github.mthli:Knife:v1.1'
//Opennote
implementation 'com.google.zxing:core:3.3.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//compile 'com.github.ctodobom:OpenCV-3.1.0-Android:9e00ee4218ca0c9e60a905c9f09bf499f9dc5115'
implementation 'us.feras.mdv:markdownview:1.1.0'
implementation 'com.github.ctodobom:drag-select-recyclerview:0.3.4.ctodobom.sections'
implementation 'com.github.nostra13:Android-Universal-Image-Loader:v1.9.5'
implementation 'com.github.ctodobom:FabToolbar:3c5f0e0ff1b6d5089e20b7da7157a604075ae943'
//Simple document scanner
implementation 'com.afollestad.material-dialogs:core:0.8.5.9'
implementation 'com.jakewharton.timber:timber:4.1.2'
//ImagetoPDF
implementation project(':tedpicker')
implementation project(':photo-editor-sdk-2.0.27')
implementation 'com.itextpdf:itextg:5.5.9'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.jakewharton:butterknife:10.2.1'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.1'
implementation 'androidx.multidex:multidex:2.0.1'
//Auto mail
implementation 'com.github.yesidlazaro:GmailBackground:1.2.0'
implementation 'com.github.nextcloud:android-library:-SNAPSHOT'
//filter_image
implementation 'it.chengdazhi.styleimageview:styleimageview:1.0.4'
//photoview
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'com.google.android.gms:play-services-ads:21.3.0'
//sửa là lỗi (lúc có firebase-core)
//implementation files('/libs/photo-editor-sdk-2.0.14.aar')
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.facebook.android:facebook-android-sdk:5.13.0'
implementation 'com.facebook.android:audience-network-sdk:5.8.0'
implementation project(path: ':dynamicgrid')
}
You could download the corresponding JAR file directly from the package's Maven repository site and put it into the libs directory of your project. This earlier Stackoverflow thread might be helpful in the details.
I'm working on building an android library and I want to include a dependency of the library as a transitive dependency into my app. Here's my library's build.gradle file:
plugins {
id 'com.android.library'
id 'com.github.dcendents.android-maven'
}
group='com.github.rohg007.xxx'
android {
compileSdkVersion 30
defaultConfig {
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
ndk {
abiFilters 'armeabi-v7a', 'arm64-v8a'
}
}
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.3.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//SDK level dependencies
implementation 'org.protoojs.droid:protoo-client:4.0.3'
api 'org.webrtc:google-webrtc:1.0.32006'
implementation 'com.squareup.okhttp3:okhttp:4.9.1'
implementation("com.squareup.okhttp3:logging-interceptor:4.9.1")
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.2.6'
implementation 'com.jakewharton.timber:timber:4.7.1'
}
repositories {
mavenCentral()
}
It works fine and all transitive dependencies are resolved when I include the library as a module:
implementation project(path: ':huddle01-android-sdk')
But when I release on Jitpack and include it as a dependency:
implementation 'com.rohg007.xxx:0.1.0'
or
implementation ('com.rohg007.xxx:0.1.0'){transitive=true}
It fails to resolve the webrtc dependency.
How to include the transitive dependency on release as well?
Jitpack uses ./gradlew install for generating the artifacts.
Adding an install block and manually appending the dependencies to the pom file worked for me.
Here's the install block that I added to the module level build.gradle file:
android {
...
}
dependencies {
...
}
install{
repositories{
mavenInstaller{
pom.withXml {
def dependenciesNode = asNode().appendNode('dependencies')
configurations.implementation.allDependencies.each { dependency ->
if (dependency.name != 'unspecified') {
def dependencyNode = dependenciesNode.appendNode('dependency')
dependencyNode.appendNode('groupId', dependency.group)
dependencyNode.appendNode('artifactId', dependency.name)
dependencyNode.appendNode('version', dependency.version)
}
}
}
}
}
}
I'm not sure if it's a clean solution to the problem. If there are cleaner alternatives, do let me know.
It's my first time building AAR
The official site says that All I hate to do is build APK and AAR will be assembled
Here's the quote:
But when I choose "Build Apk(s)" nothing happens.
Another tutorial says I have to choose Gradle-> library name -> tasks-> build-> :assembleRelease.
But there is no such thing :
How can I assemble library as AAR?
here's my gradle :
plugins {
id 'com.android.library'
id 'kotlin-android'
id 'kotlin-kapt'
}
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
minSdkVersion 17
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'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
def room_version = "2.2.3"
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-ktx:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
implementation 'com.google.code.gson:gson:2.8.2'
}
Just click assemble or add buildTypes.debug. While you don't have buildTypes.debug defined, it won't generate the tasks you are looking for (as there only is one configuration present there and so there is nothing to tell apart).
Bold: this is my Gradle configuration when I am trying to build my project using android emulator than catching that error which is very annoying for me I have to do some r&d for this issue like some people say that use falt instead of annotation processor I also do this but the problem is still not resolved. I am using android studio 4.1 trying to find out the annotation processor option but not take some luck so please help to figure out this problem thanks a lot of open source community.
click here for image
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "org.rtspplr.app"
minSdkVersion 21
targetSdkVersion 28
versionCode 106
// Previous version svn+ssh://svn#52.0.53.255/RTSP/projects/android/MediaPlayer
// last version which published on PlayMarket 4.4.3
versionName "4.4.49"
setProperty("archivesBaseName", "VXG_RTSPPlayer_$versionName-vc$versionCode")
ndk {
abiFilters 'x86', 'x86_64' , 'armeabi-v7a', 'arm64-v8a'
}
}
signingConfigs {
debug {
storeFile file("../../signing_key/Debug/debug.keystore.jks") // need for develop google map
keyAlias 'alias_name'
keyPassword 'remember.me.again'
storePassword 'remember.me'
}
release {
storeFile project.file("../../signing_key/RTSPPlayer/sign/rtspplayer-release-key.keystore")
storePassword 'remember.me'
keyAlias 'alias_name'
keyPassword 'remember.me.again'
v1SigningEnabled true
v2SigningEnabled true
}
}
buildTypes {
debug {
buildConfigField "boolean", "IS_DEBUG", "true" // Had issues with BuildConfig.DEBUG, created IS_DEBUG to ensure functionality behaved as expected.
minifyEnabled false
multiDexEnabled true
debuggable true
}
release {
buildConfigField "boolean", "IS_DEBUG", "false"
minifyEnabled false
multiDexEnabled true
debuggable false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
/*
splits {
abi {
enable true
reset()
include 'armeabi-v7a'
universalApk false
}
}
*/
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.google.android.gms:play-services-ads:17.0.0'
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'androidx.annotation:annotation:1.1.0-alpha02'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha02'
implementation 'androidx.recyclerview:recyclerview:1.1.0-alpha03'
implementation project(':data')
implementation project(':logic')
implementation project(':add_cloud_camera')
implementation project(':textinputs')
implementation 'com.google.dagger:dagger:2.28'
annotationProcessor 'com.google.dagger:dagger-compiler:2.28'
implementation 'com.vxg.cloudsdk:cloudsdk:2.0.202'
implementation 'com.github.bumptech.glide:glide:4.11.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.squareup.picasso:picasso:2.71828'
//implementation project(':CloudSDK')
//implementation 'io.vxg.media:components:2.0.112-alpha01'
//implementation 'androidx.cardview:cardview:1.0.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
implementation "io.reactivex.rxjava2:rxjava:2.1.9"
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.4.4'
//implementation 'commons-validator:commons-validator:1.6'
implementation 'com.google.firebase:firebase-core:17.4.2'
implementation 'com.google.firebase:firebase-messaging:20.2.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
File -> Project Structure -> SDK Location -> JDK Location -> Choose your local jdk instead of the jre located into the android studio.
I have written code in CPP and linked with gradle using cmake now there another sub module like bottomsheet and few more and now while sync gradle I get the following error:
Unable to resolve dependency for ':app#externalNativeBuild/compileClasspath': Could not resolve project :bottomsheet
build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.devmedia.videostatus"
minSdkVersion 14
targetSdkVersion 27
versionCode 4
versionName "1.3"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
externalNativeBuild {
cmake {
// Provides a relative path to your CMake build script
path "CMakeLists.txt"
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-ads:15.0.1'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-config:16.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation project(path: ':bottomsheet')
}
apply plugin: 'com.google.gms.google-services'
How can resolve above error ?