My project was successfully building and all of a sudden I got the below error in Android studio.
Unable to find method 'org.gradle.api.publish.maven.internal.publication.MavenPublicationInternal.getPublishableFiles()Lorg/gradle/api/file/FileCollection;'. Possible causes for this unexpected error include: Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.) Re-download dependencies and sync project (requires network) The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem. Stop Gradle build processes (requires restart) Your project may be using a third-party plugin which is not compatible with the other plugins in the project or the version of Gradle requested by the project. In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
I tried clearing the local dependency cache and rebuilding the project. But still the error persists. I am using android studio v4.0 with build tools v29.0.2.
Is it because gradle can't download the dependency from maven repo? Is it because there is an error in configuring maven in my 'respositories' list? How can I get more information on this error?
If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.
Solution: Go in File -> Project Structure -> Project Settings -> Project and set Project SDK to Android API 30 Platform (or the latest). Go in File -> Project Structure -> Project Settings -> Modules and select the Dependencies tab and choose Android API 30 Platform in the Module SDK dropdown.
To do that, just pick the Gradle Remote Debug configuration and then click the Debug icon on the project to be debugged. For more info, you can read the Gradle documentation. Follow us for more productivity tools & ideas for Android, Kotlin & Gradle projects.
If you wish to clean (empty) the build directory and do a clean build again, you can invoke a gradle clean command first and then a gradle assemble command. Now, fire the gradle assemble command and you should have a JAR file that is named as <name>-<version>.
One of the most common root causes for build failures is a changed upstream binary dependency that is specified to resolve dynamically. Using Gradle Enterprise’s comparison feature is especially helpful in finding such failures. Bring up the Gradle Enterprise scan list by clicking here.
The best practice for deploying Gradle Enterprise is that all builds send build scans to the centralized Gradle Enterprise server. CI servers do preserve logs of failed CI builds, but the team is almost entirely blind to failures that occur in developer builds typically.
Other installation failures If gradle --version works, but all of your builds fail with the same error, it is possible there is a problem with one of your Gradle build configuration scripts. You can verify the problem is with Gradle scripts by running gradle help which executes configuration scripts, but no Gradle tasks.
Run with --scan to get full insights. Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings.
Try to update the com.jfrog.artifactory version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With