Recently I uploaded an app to the Google Playstore and it told me that before the next version could be uploaded I needed to target a later OS version, and that certain of the files I was using were old/deprecated and told me to change the dependencies.
So, in build.grade I altered the relevant sections to read:
compileSdkVersion 34
targetSdkVersion 34
and
implementation 'androidx.fragment:fragment:1.7.0'
implementation 'com.google.android.gms:play-services-maps:18.0.0'
When I try to build this I get:
Unable to find method 'org.gradle.api.artifacts.result.ResolvedComponentResult.getVariant()Lorg/gradle/api/artifacts/result/ResolvedVariantResult;'.
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 clicking on the links above (labelled **) and nothing happens.
I’m using Android Studio 4 and is over 4 years old and looking at old Stackoverflow posts, they say that for errors involving ‘Unable to find method ‘org.gradle.api.artifacts.result.ResolvedComponentResult*’, an upgrade of the IDE helps.
I click on help->check for updates it says that they are available and when I click on it, it brings up a brower window but nothing appears – the tab remains blank.
I’m thinking that maybe a command line update might help and I’ve looked for cmdline-tools.
I’ve looked at Project Structure to see if there is a problem with my paths and it has two entries:
The first is the Android SDK location used by new projects and for existing projects that do not have a local.properties files with a sdk.dir property
/home/user/Android/Sdk (1)
and
The JDK that Gradle is to use when building the project
/usr/lib/jvm/jdk-11.0.24-oracle-x64 (2)
With (1) the local.properties file has the line “sdk.dir=/home/user/Android/Sdk”.
I’m at a loss as to what to do. I’ve looked at https://developer.android.com/tools and it says that command line tools should be found in android_sdk/cmdline-tools/version/bin/ but I can’t find the cmdline-tools directory or the sdkmanager utility I should use.
Is there way to resolve the problem mentioned in the first paragraph without going through the trouble of a fresh install? And if not, how do go about doing an install without using the IDE?