Gradle module dependency not found - android-studio

I just installed Android Studio 3.1.4 on Windows 10, and upon creating an empty test project, and building it, I'm getting the error:
Cannot find JAR 'aws-java-sdk-kms-1.11.6.jar' required by module 'gradle-resources-s3' using classpath or distribution directory
It is referencing gradle 4.4 in my documents\.gradle folder. Anyone has any idea how to go about this problem?

This turned out to be a blockage for an internet security suite. The suite scans all incoming jar dependencies while they are extracted from the global gradle zip file. For some reason, a select few packages are flagged, and thus gradle syncing fails.

Related

Could not find com.android.tools.build:gradle:7.5.1

So I was building out a test APK in Android Studio tonight that had to be signed. It failed and said my Gradle was out of date. So I upgraded my gradle from 7.3.3 to the newest 7.5.1
I changed the wrapper setting to distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
and then I changed my build.gradle dependency to classpath 'com.android.tools.build:gradle:7.5.1'
Note that after doing the changes, and restarting Android Studio, it did upgrade the version in the app directory.
Here's the error getting thrown below:
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
> Could not find com.android.tools.build:gradle:7.5.1.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/7.5.1/gradle-7.5.1.pom
Required by:
project :
Note that this was a project from a client, and I did not write this originally. These dependencies were in place, but fairly recent, and the app would build fine with it using 7.3.3. However it wouldn't let me sign my app.
I suppose I could use some wisdom on both of these issues. What I'm going to do is go back to version 7.3.3, build the signed APK again, and copy that exact error to report back here with. It was a gradle version error.
For any any Flutter noobs like myself passing through, this error occured because the Android Tools Plugin version DOES NOT match the Gradle Version:
https://developer.android.com/studio/releases/gradle-plugin#groovy
They match up just vaguely enough in number, that you would think that my line com.android.tools.build:gradle:7.5.1. uses gradle 7.5.1, but instead, Android Tools for Gradle is actually a separate entity, and at 7.3.3 as of typing this reply.
So you CAN set your Gradle to the newest version somewhere else in your project, but it has to match the compatible Android Tools version, which is set here. Its silly and confusing at first, and can easily trip up newcomers. Hopefully the versions diverge enough, or the code syntax changes for some better clarity, but as of now, this is it.

Unable to find method 'org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;'

I tried to run an imported project in this repo
but I got this error:
Unable to find method 'org.gradle.api.tasks.SourceSetOutput.getClassesDir()Ljava/io/File;'.
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 used android studio version 3.4.1, and Gradle version 5.1.1.
anyone can help please.
I was getting the same error and fixed it by updating a dependency in the backend module:
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
to
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.3'

Android training for FragmentBasics won't import into AS 1.5.1

In trying to get the hang of Fragment, I imported into Android Studio 1.5.1 the unzipped folder FragmentBasics after extracting the downloaded file FragmentBasics.zip to that Folder.
Now I have Gradle problems and I have no clue what to do to be able to run the app. I don't know that the .zip file is from Eclipse as the message suggests.
I did move the folder FragmentBasics to C:\Users\Dov because of the space in "Google Drive" but got same error.
Gradle project sync failed . Basic functionality (e.g., editing, debugging) will not work properly.
Failed to sync gradle project 'FragmentBasics'
Error:Cause: failed to find target with hash string 'android-15' in: C:\Users\Dov\AppData\Local\Android\sdk
Open Android SDK Manager
ECLIPSE ANDROID PROJECT IMPORT SUMMARY
Risky Project Location:
The tools should handle project locations in any directory. However,
due to bugs, placing projects in directories containing spaces in the
path, or characters like ", ' and &, have had issues. We're working to
eliminate these bugs, but to save yourself headaches you may want to
move your project to a location where this is not a problem.
C:\Users\Dov\Google Drive\AndroidStudioProjects\FragmentBasics
-
Replaced Jars with Dependencies:
The importer recognized the following .jar files as third party
libraries and replaced them with Gradle dependencies instead. This has
the advantage that more explicit version information is known, and the
libraries can be updated automatically. However, it is possible that
the .jar file in your project was of an older version than the
dependency we picked, which could render the project not compileable.
You can disable the jar replacement in the import wizard and try again:
android-support-v4.jar => com.android.support:support-v4:18.0.0
Moved Files:
Android Gradle projects use a different directory structure than ADT
Eclipse projects. Here's how the projects were restructured:
AndroidManifest.xml => app\src\main\AndroidManifest.xml
res\ => app\src\main\res\
src\ => app\src\main\java\
Next Steps:
You can now build the project. The Gradle project needs network
connectivity to download dependencies.
Bugs:
If for some reason your project does not build, and you determine that
it is due to a bug or limitation of the Eclipse to Gradle importer,
please file a bug at http://b.android.com with category
Component-Tools.
(This import summary is for your information only, and can be deleted
after import once you are satisfied with the results.)
I installed sdk 15 but then had problems with Gradle griping about
gradle-wrapper.properties file having a line with
gradle-2.8-all.zip that needed to be changed to
gradle-2.1-all.zip, so I edited gradle-wrapper.properties file to contain 2.1 instead of 2.8.
Message said after making change, re-import project. And it works.
Before importing I only removed following line from AndroidManifest.xml
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15" />
Worked with FragmentsBasics.zip in Android Studio 2.3.3

When exactly is .gradle folder created in the home directory in Linux?

Okay so when exactly does gradle begin downloading dependencies? And when exactly is .gradle folder created in the home directory.
Gradle downloads dependencies just-in-time when they are first used. ~/.gradle is used for many purposes, and may be created as soon as Gradle is first started.
When talking about dependencies in gradle, you can categorize them into 2 categories :
build script dependencies : the gradle-plugins required by your script (for instance the android-gradle-plugin when you are building an android project). Those dependencies are downloaded at the very first stage of the gradle process.
project dependencies : downloaded when they are required. (i.e. if you are building only part of your project: it is possible that some dependencies not required for this part aren't downloaded)
There is a third kind of download : when you use the gradle-wrapper : gradle it-self can be downloaded by the wrapper-script (and of course it is the very first download.)
Regarding the ~/.gradle : it is the GRADLE_USER_HOME (by default USER_HOME/.gradle) : it can be redefined in multiple ways (see here) and it is used as soon as a gradle process is started.
EDIT
A gradle process is started as soon as you run a command starting with gradle <with args> in a directory where a build.gradle exists (note that if you use the wrapper : the command is gradlew <with args>) .
When using an IDE (like Android Studio or IntelliJ) : the IDE can start a gradle process for you. In Android-Studio (or IntelliJ) : there is a view named Gradle Console where you can see logs issued by any gradle process started by the IDE.
when we start the gradle it create the .gradle folder inside your home directory. It consist of native (information about your system) and caches. Caches further consist of plugins and all other jars dependencies.
When we build the project first time at that time it download dependencies and plugins and cheched them here. next time when we need them it, it get from here. even when we need them in eclipse to compile the code (=>gradle eclipse), its dependencies are added from cache

Android studio preview 0.4.5: The project is using an unsupported version of the Android Gradle plug-in

I got the following error message when I was importing a project from github:
Failed to refresh Gradle project 'XXX'
The project is using an unsupported version of the Android Gradle plug-in.
Fix plug-in version and re-import project
This is not a duplicate of this because your get thee error message before
gradle/wrapper/gradle-wrapper.properties
is generated.
The problem appeared after updates. The updated Android Gradle plug-in did not support the outdated version of Gradle I had. But the error message is misleading, if you don't attempt different build options you won't see what the problem is.
After downloading a newer version of Gradle, Imported the project again, then:
Use local gradle distribution
Then Gradle home set to the folder where the new version of gradle was downloaded
that solved it
Edit: From Scott (below comments) : It's preferable to use the wrapper and to change the Gradle version in gradle-wrapper.properties instead of downloading and installing Gradle yourself. As for the Android-Gradle plugin, that's set in the dependencies.classpath block in your build file; see this
I get this gradle-errors in 4 Studio updates! My solution: I copy the Studio-folder, and if gralde throws an error, I copy the old version back. It's not a good way, but until google is not able to deliver an update without producing always the same errors (even if mentioned in many forums), I stay on 4.9 and wait for the first final release.

Resources