I ran into this problem after i updated android studio and the gradle version. Here's what i did step by step:
First i got the following error:
Build Gradle Error Could not get unknown property 'compile'
I checked stackoverflow and it said that changing "compile" with "implementation" would solve the problem, and so i did that.
Another issue was that maven was deprecated. So i used, maven-publish instead of maven.
Now i am getting the following error:
12:24 PM Gradle sync failed: Could not find method uploadArchives() for arguments [build_a5ye7ixpcm9qfmol93kt3ucl1$_run_closure4@73b8042a] on project ':expo-application' of type org.gradle.api.Project. (17 s 537 ms)
In this part of code in build.gradle(:expo-application):
uploadArchives {
  repositories {
    mavenDeployer {
      configuration = configurations.deployerJars
      repository(url: mavenLocal().url)
    }
  }
}
I am not really familiar with android studio or java. I just use Android Studio for configuring react native apps for android. Can someone please help me resolve these issues..
Thank you
As of Gradle 7.0, compile has been removed in favor of api.  When you changed compile to implementation, you effected the transitive properties of the libraries.  I'm not sure where you read that changing compile to implementation was the correct answer, but it isn't.  api is a much closer approximation to compile.  This chart gives a fairly easy to understand explanation of why this is.  You should change the implementation to api and make sure you are using the java-library plugin instead of the java plugin.  This should allow gradle to see the UploadArchives method.  However, this wil cause a new issue.
As of Gradle 6.0, UploadArchives is also deprecated  along with the maven plugin.  You should consider using the maven-publish plugin instead.  This will ensure your build continues to work in future Gradle releases.
So, to summarize, make sure your plugins look like this
  apply plugin: 'java-library'
  apply plugin: 'maven-publish'
and update your code to use publishing instead of UploadArchives.  More information on this can be found in the current Gradle user guide here.
Alternatively, you can downgrade your gradle version to something before 7.0 and just ignore all the deprecation warnings. The choice is yours.
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