I receive following warnings when I sync Gradle in Android Studio 4.1.2 from stable channel :
Failed to resolve: legacy-support-v4-1.0.0
Failed to resolve: asynclayoutinflater-1.0.0
Failed to resolve: media-1.0.0
Failed to resolve: swiperefreshlayout-1.0.0
Failed to resolve: slidingpanelayout-1.0.0
Failed to resolve: legacy-support-core-ui-1.0.0
Here is my app module build.gradle file :
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs.kotlin'
androidExtensions {
experimental = true
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.sample.android.storytel"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
buildConfigField "String", "STORYTEL_BASE_URL", "\"https://jsonplaceholder.typicode.com/\""
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Support libraries
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$version_kotlin"
implementation "androidx.appcompat:appcompat:$version_support"
implementation "com.google.android.material:material:$version_material"
implementation "androidx.constraintlayout:constraintlayout:$version_constraint_layout"
implementation "androidx.palette:palette-ktx:$version_palette"
implementation "androidx.test.espresso:espresso-idling-resource:$version_espresso"
// Android KTX
implementation "androidx.core:core-ktx:$version_core"
// Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$version_navigation"
// Architecture components
implementation "androidx.lifecycle:lifecycle-extensions:$version_lifecycle_extensions"
// Retrofit
implementation "com.squareup.retrofit2:retrofit:$version_retrofit"
implementation "com.squareup.retrofit2:converter-moshi:$version_retrofit"
implementation "com.squareup.retrofit2:adapter-rxjava2:$version_retrofit"
// Dagger
implementation "com.google.dagger:dagger:$version_dagger"
kapt "com.google.dagger:dagger-compiler:$version_dagger"
implementation "com.google.dagger:dagger-android:$version_dagger"
implementation "com.google.dagger:dagger-android-support:$version_dagger"
kapt "com.google.dagger:dagger-android-processor:$version_dagger"
// Network
implementation "com.squareup.okhttp3:logging-interceptor:$version_okhttp"
implementation "com.squareup.picasso:picasso:$version_picasso"
implementation "com.github.florent37:picassopalette:$version_picasso_palette"
// Moshi for parsing the JSON format
implementation "com.squareup.moshi:moshi:$version_moshi"
implementation "com.squareup.moshi:moshi-kotlin:$version_moshi"
//Android RX
implementation "io.reactivex.rxjava2:rxjava:$version_rxjava"
implementation "io.reactivex.rxjava2:rxandroid:$version_rxandroid"
// Timber
implementation "com.jakewharton.timber:timber:$version_timber"
// Dependencies for local unit tests
testImplementation "org.mockito:mockito-core:$version_mockito"
// Dependencies for Instrumentation tests
androidTestImplementation "androidx.test.ext:junit:$version_junit_ext"
// Espresso UI Testing
androidTestImplementation "androidx.test.espresso:espresso-core:$version_espresso"
androidTestImplementation "androidx.test.espresso:espresso-contrib:$version_espresso"
// Testing Architecture components
testImplementation "androidx.arch.core:core-testing:$version_lifecycle_test"
// Android Testing Support Library's runner and rules
androidTestImplementation "androidx.test:runner:$version_runner"
androidTestImplementation "androidx.test:rules:$version_rules"
// AndroidX Test - JVM testing
testImplementation "androidx.fragment:fragment-testing:$version_fragment"
}
When I build the project, I receive following error :
Could not resolve asynclayoutinflater-1.0.0.aar (androidx.asynclayoutinflater:asynclayoutinflater:1.0.0)
Here you can find my project : https://github.com/Ali-Rezaei/Colors
Do you know why it happens and how to resolve it?
Addenda : I realized it is related to following dependency :
implementation "com.github.florent37:picassopalette:$version_picasso_palette"
Without this dependency, it works as expected.
The problem here is with
implementation "com.github.florent37:picassopalette:$version_picasso_palette"
is that this library is that it uses support library dependencies of android and you are trying to use it in a project where you are using jetpack library.
You can resolve it by
Using a version of that library which is migrated to JetPack..
OR
You can download the zip of that library and extract it and then open it as a project and then from refactor menu migrate to AndroidX then you import that custom project as a library into your project.
You live in a country that is under sanctions. You must use a filter breaker.
you can use this
Could not resolve asynclayoutinflater-1.0.0.aar (androidx.asynclayoutinflater:asynclayoutinflater:1.0.0)
This means gradle cannot find that dependency anywhere. Make sure that the library can be accessed by gradle inorder to resolve the problem.
Basically gradle is seeing your dependency as some unresolvable gibberish.
Related
When I'm trying to put apply plugin: 'com.google.gms.google-services' at the bottom of my build gradle or anywhere else inside my apps build gradle I get the following error:
In project 'app' a resolved Google Play services library dependency depends on another at an exact version (e.g. "[19.0.
2]", but isn't being resolved to that version. Behavior exhibited by the library will be unknown.
Dependency failing: com.google.android.gms:play-services-vision-image-label:18.0.3 -> com.google.android.gms:play-servic
es-vision-common#[19.0.2], but play-services-vision-common version was 19.1.0.
The following dependencies are project dependencies that are direct or have transitive dependencies that lead to the art
ifact with the issue.
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision-object-detection-model#{strictly 19.0.5}
-- Project 'app' depends onto com.google.android.gms:play-services-vision-common#{strictly 19.1.0}
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision#{strictly 24.0.3}
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision-internal-vkp#{strictly 17.0.1}
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision-object-detection-model#19.0.5
-- Project 'app' depends onto com.google.firebase:firebase-ml-vision#24.0.3
-- Project 'app' depends onto com.google.android.gms:play-services-vision-image-label#{strictly 18.0.3}
-- Project 'app' depends onto com.google.android.gms:play-services-mlkit-face-detection#16.1.0
-- Project 'app' depends onto com.google.android.gms:play-services-vision#{strictly 20.1.0}
-- Project 'app' depends onto com.google.android.gms:play-services-mlkit-face-detection#{strictly 16.1.0}
For extended debugging info execute Gradle from the command line with ./gradlew --info :app:assembleDebug to see the dep
endency paths to the artifact. This error message came from the google-services Gradle plugin, report issues at https://
github.com/google/play-services-plugins and disable by adding "googleServices { disableVersionCheck = false }" to your b
uild.gradle file.
My build.gradle at app level is:
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.mlkitfacedetection"
minSdkVersion 21
targetSdkVersion 30
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
}
}
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.android.gms:play-services-mlkit-face-detection:16.1.0'
implementation 'com.google.firebase:firebase-ml-vision:24.0.3'
implementation 'com.google.firebase:firebase-ml-vision-object-detection-model:19.0.5'
def camerax_version = "1.0.0-beta03"
// CameraX core library using camera2 implementation
implementation "androidx.camera:camera-camera2:$camerax_version"
// CameraX Lifecycle Library
implementation "androidx.camera:camera-lifecycle:$camerax_version"
// CameraX View class
implementation "androidx.camera:camera-view:1.0.0-alpha10"
}
apply plugin: 'com.google.gms.google-services'
I am unable to resolve the error. The same code in another app is working absolutely fine.
I am using google-serivices.json file from another app registered on firebase. Isn't it the cause of problem?
I tested this workaround and this seems to work. Add the following in your dependencies block:
implementation 'com.google.android.gms:play-services-vision-image-label:18.0.4'
implementation 'com.google.android.gms:play-services-vision:20.1.1'
implementation 'com.google.android.gms:play-services-vision-common:19.1.1'
implementation "com.google.android.gms:play-services-vision-face-contour-internal:16.0.2"
implementation 'com.google.android.gms:play-services-vision-image-label:18.0.5'
implementation 'com.google.firebase:firebase-ml-vision:24.1.0'
implementation 'com.google.firebase:firebase-ml-vision-face-model:20.0.2'
implementation 'com.google.firebase:firebase-ml-model-interpreter:22.0.4'
implementation 'org.tensorflow:tensorflow-lite:2.0.0'
Follow this link for more detail-
https://github.com/firebase/firebase-android-sdk/issues/1904
You may just have to update your dependencies: File-->Project Structures-->Dependencies Then in the lower part you will see any dependencies that need updating...Worked for me
I didn't call variant.getAssemble() from my project but still showing these messages. When I try to run the project I get this error "Manifest Merger failed with multiple errors in Android Studio
"
'variant.getAssemble()' is obsolete and has been replaced with 'variant.getAssembleProvider()'.
Gradle.build file is here, I don't use variant.getAssemble() here. If the system is calling this then where can I find it to solve the issue. I have multiple modules.
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-crash'
dependencies {
implementation project(':A')
implementation project(':B')
implementation project(':C')
implementation project(':D')
//implementation project(':E')
implementation project(':F')
implementation project(':G')
implementation "com.android.support:appcompat-v7:$project.supportVersion"
implementation "com.android.support:support-v4:$project.supportVersion"
implementation "com.android.support:cardview-v7:$project.supportVersion"
implementation "com.android.support:recyclerview-v7:$project.supportVersion"
implementation "com.android.support:design:$project.supportVersion"
implementation "com.android.support:support-v13:$project.supportVersion"
implementation "com.android.support:support-vector-drawable:$project.supportVersion"
implementation "com.google.firebase:firebase-core:$project.firebaseCore"
implementation "com.google.firebase:firebase-ads:$project.firebaseAds"
implementation "com.google.firebase:firebase-auth:$project.firebaseAuth"
implementation "com.google.firebase:firebase-messaging:$project.firebaseMessaging"
implementation "com.google.firebase:firebase-crash:$project.firebaseCrash"
implementation "com.google.code.gson:gson:$project.gsonVersion"
implementation "com.google.guava:guava:$project.guavaVersion"
implementation "org.jsoup:jsoup:$project.jsoupVersion"
implementation "ch.acra:acra:$project.acraVersion"
implementation "com.mcxiaoke.volley:library:$project.volleyVersion"
// optional
debugImplementation "com.squareup.leakcanary:leakcanary-android:$project.leackcanaryVersion"
releaseImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$project.leackcanaryVersion"
testImplementation "com.squareup.leakcanary:leakcanary-android-no-op:$project.leackcanaryVersion"
implementation 'com.android.support:multidex:1.0.3'
implementation "com.squareup.retrofit2:retrofit:$project.RetrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$project.RetrofitGsonVersion"
}
android {
defaultConfig {
applicationId "com.XXX.XXXX"
multiDexEnabled = true
vectorDrawables.useSupportLibrary = true
}
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def relativeRootDir = output.packageApplication.outputDirectory.toPath().relativize(rootDir.toPath()).toFile()
output.outputFileName = new File( "$relativeRootDir" + File.separator+"libs", project.name+"-"+project.versionName+".apk")
}
}
}
apply plugin: 'com.google.gms.google-services'
You can safely ignore it. Some plugins like Fabric cause those warnings, as it's devs have to adapt to new Android Studio/Gradle releases. Just make sure to use latest versions of your dependencies.
Recently I have dived into learning new andoirdX artefacts including Android Architecture Components.
After reading through the officials docs and a google code samples I have successfully added the necessary dependencies in both my project and app level Gradle files.
They are as follows
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
and
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'androidx.navigation.safeargs'
android {
compileSdkVersion 28
defaultConfig {
applicationId "_ _ _ _ _ _"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.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-jdk8:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'com.google.android.material:material:1.0.0-rc01'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
def lifecycle_version = "2.0.0-beta01"
def room_version = "2.0.0-beta01"
def navigationVersion = '1.0.0-alpha06'
kapt "androidx.room:room-compiler:$room_version"
kapt "androidx.lifecycle:lifecycle-compiler:$lifecycle_version"
implementation 'androidx.core:core-ktx:1.0.0-alpha1'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime:$lifecycle_version"
implementation "android.arch.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "android.arch.navigation:navigation-ui-ktx:$navigationVersion"
implementation "androidx.room:room-runtime:$room_version"
}
after giving Gradle sync everything worked fine, however, it showed an error saying "Manifest merge error please see logs for more info"
I have double checked with an app from google repository and everything seems normal.
Please accept my humble appreciation in advance
Recently I have run into the same issue, Before giving you the solution I would like to tell you that in recent days, due to fast-paced development tools offered by Google our days-old development technique has changed significantly.
Take jetpack as an example, which is a part of AndroidX, and adding it into your projects requires some necessary steps. Moreover, if you are like me who uses Android studio's dialogs for creating an app, you are likely to have these kinds of issues including the one you have mentioned.
The reason for this is android studio still use Appcompat-v7, androidX on the other hand, uses
androidx.appcompat:appcompat:1.0.0
see the full artifacts listing
Above all, after adding responsible dependencies you need to add these two lines in you gradle.properties file
android.useAndroidX=true
android.enableJetifier=true
Unfortunately, if have come this far you would still probably face
Manifest marge error
this is because your automated layout files still have old classpaths such as
android.support.design.widget.CoordinatorLayout
which should be like this androidx.constraintlayout.widget.ConstraintLayout
this one android.support.design.widget.AppBarLayout should be com.google.android.material.appbar.AppBarLayout and So on.
After rechecking every classpath rebuild your project and everything should be fine.
I got this error while importing an eclipse project to Android studio. It shows a suggestion Add library Gradle: com.android.support:support-core-utils-27.1.1 to classpath. I have added the library in my build.gradle file.
Here is my gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "28.0.0"
defaultConfig {
applicationId "com.example.tracking"
minSdkVersion 17
targetSdkVersion 27
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
allprojects {
repositories {
google()
}
}
dependencies {
implementation project(':asciiProtocol')
implementation project(':deviceList')
implementation project(':captureActivity')
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation "com.android.support:support-core-utils:27.1.1"
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.google.code.gson:gson:2.8.2'
implementation files('libs/opencsv-2.3.jar')
implementation files('libs/rfid.reader.api.jar')
implementation files('libs/scannercontrol.jar')
implementation files('libs/Zebra.jar')
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '27.1.1'
}
}
}
}
}
I googled it but I could not find a proper solution for this. However, I tried the solution from this that isn't the right solution. Any help is appreciated?
I faced the same problem, then I noticed Google divided the v4 support library to multiple packages.
Note: Prior to Support Library revision 24.2.0, there was a single v4 support library. That library was divided into multiple modules to improve efficiency. For backwards compatibility, if you list support-v4 in your Gradle script, your APK will include all of the v4 modules. However, to reduce APK size, we recommend that you just list the specific modules your app needs.
https://developer.android.com/topic/libraries/support-library/packages#v4
Then I checked LocalBroadcast page.
https://developer.android.com/reference/android/support/v4/content/LocalBroadcastManager
At the page top, there is description
belongs to Maven artifact com.android.support:localbroadcastmanager:28.0.0-alpha1
When I faced this problem, the v28.0.0 (not alpha) has been available.
In the end, I changed settings in my build.gradle.
before
implementation 'com.android.support:support-v4:28.0.0'
after
implementation 'com.android.support:localbroadcastmanager:28.0.0'
AndroidX
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
This happened to me while migrating for AndroidX and the solution was to replace "import androidx.core.content.LocalBroadcastManager;" with import androidx.localbroadcastmanager.content.LocalBroadcastManager;
Edited, as required to include the implementation, please don't forget dependency:
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
Noting that Target & Build version are:
compileSdkVersion 29
buildToolsVersion '29.0.2'
Use this
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
instead of
import androidx.core.content.LocalBroadcastManager;
For newer Android version, you should try to add this to gradle.properties
android.enableJetifier=true
and then add this dependency to build.gradle
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
After lot of searching and R&D i found some solution. This is working for me i hope this is helping you.
implementation 'androidx.legacy:legacy-support-core-utils:1.0.0'
I used to copy 'compile' dependencies to a specific folder using this simple gradle task :
task copyLibs(type: Copy) {
from configurations.compile
into "$project.rootDir/reports/libs/"
}
But it stopped working just after upgrading my Android project using gradle plugin 3.0.1 for Android Studio and Gradle tool to 4.1. As the dependency configuration 'compile' is now deprecated by https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html#new_configurations I changed it to 'implementation'. However, I am not able to use my copyLibs task as resolving configuration 'implementation' directly is not allowed as per Gradle build error output :
$ ./gradlew.bat clean build
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:copyLibs'.
> Resolving configuration 'implementation' directly is not allowed
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
See following my current build.gradle file for app module : apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "newgradle.com.testingnewgradle"
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:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
}
task copyLibs(type: Copy) {
from configurations.implementation
into "$project.rootDir/reports/libs/"
}
build.dependsOn copyLibs
If I use 'compile' it works but I would like to be compliant with the latest recommendation on this plugin the usage.
I need help to upgrade my copyLibs task in order to work as before upgrading my enviromment.
I was using gradle plugin 2.2.3 for Android Studio and Gradle tool 2.14.1.
instead of using configurations.implementation, the best option is to use configurations.runtimeClasspath.
You can also think about:
compileClasspath
default
I make the configuration resolvable, so there is no exception when getting the dependencies
configurations.implementation.setCanBeResolved(true)
configurations.api.setCanBeResolved(true)
println configurations.implementation.resolve()
println configurations.api.resolve()
Another suggestion.
I created my custom config and then used it as configurations.customConfig:
configurations {
customConfig.extendsFrom implementation
}
The copy task must be correspondingly edited:
task copyLibs(type: Copy) {
from configurations.customConfig
into "$project.rootDir/reports/libs/"
}
It doesn't look as if there's a way to acquire the list of implementation dependencies and the compileClasspath mentioned at the Gradle ticket Rafael posted won't work if you're working with Android directly, like my case where I need the dependencies to be exported so that Unity3D can package them up for release.
So.. it looks like the only solution in this case is to use the deprecated compile type.
This probably won't help or have a better way to solve but...
You can put your dependencies in a way that is possible to copy doing the following:
android { ... }
// Add a new configuration to hold your dependencies
configurations {
myConfig
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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'
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'
// Now you have to repeat adding the dependencies you want to copy in the 'myConfig'
myConfig fileTree(dir: 'libs', include: ['*.jar'])
myConfig 'com.android.support:appcompat-v7:26.1.0'
myConfig 'com.android.support:support-v4:26.1.0'
...
}
task copyLibs(type: Copy) {
// Now you can use 'myConfig' instead of 'implementation' or 'compile'
from configurations.myConfig
into "$project.rootDir/reports/libs/"
}
This also helps if you have a Jar task that stops placing the dependencies in to the jar file because you changed from compile to implementation.
You can use:
from {configurations.myConfig.collect { it.isDirectory() ? it : zipTree(it) }}
Instead of:
from {configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }}
I started getting this error after upgrading from gradle 5.5 to 5.6, and it happens when I try to sync the project in intelliJ.
Thanks to this answer on another question, I solved it by applying the idea plugin to all projects and then running gradle cleanIdea and after that everything started working again.
Another day, another #inexplicable solution to a problem.
there is some documentation about this, at least at this moment. You can not directly use 'implementation' configuration, but only use one that extends this. Now you can create a custom configuration, but there are preconfigured extensions already, like 'compileClasspath'.
compileClasspath extends compileOnly, implementation
Compile classpath, used when compiling source. Used by task compileJava.
Documentation is here: https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_plugin_and_dependency_management