find code for classpath in gradle - java

In Android Stdio,We can see as following.
classpath 'com.android.tools.build:gradle:1.5.0'
I know that the this code is for gradle dependencies with jar.
But I cannot find the this jar locally.
How can I find this jar?
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Gradle caches by default will be here
~/.gradle/caches/jars-<number>/<hash of jar>/<jar name>.jar
or
~/.gradle/caches/modules-<number>/files-<number>/<group id>/<artifact id>/<version>/<file hash>/<jar name>.jar

Related

A problem occurred configuring root project. What do I need to do?

I just created a new android project to test something separate to my main one, and this happened. I tried it several times and get the same error every time.
A problem occurred configuring root project 'login_test'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0-release-764.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
- https://repo.maven.apache.org/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.5.0-release-764/kotlin-gradle-plugin-1.5.0-release-764.pom
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
try to change version of kotlin in build.gradle under the root directory.I use 1.3.72 here
buildscript {
ext.kotlin_version = '1.0.0'
ext.kotlin_version = "1.3.72"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

ERROR: Gradle DSL method not found: 'compile()'

I'm trying to use yelp-fusion-android library. I tried updating the gradle but no luck.
I am getting this error:
ERROR: Gradle DSL method not found: 'compile()'
Possible causes:
The project 'testProject' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin.
Apply Gradle plugin
Here is build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Remove this line from the top-level file:
//compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
In the app/build.gradle file you can add the same dependency:
dependencies {
...
implementation 'io.github.ranga543:yelp-fusion-client:0.1.5'
...
}
Your problem is here
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
Compile is deprecated use "Implementation" instead
and you are placing it in the wrong gradle there are 2 gradle files
please note this warning
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Place below dependency in app module instead of main project gradle.
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
and replace compile with Implementation.
e.g (In app module)
Implementation 'io.github.ranga543:yelp-fusion-client:0.1.4'
dependencies section inside buildscript is not for module dependencies. Hence. move out compile 'io.github.ranga543:yelp-fusion-client:0.1.4' from this section and create top level dependencies block and put it there as below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
compile 'io.github.ranga543:yelp-fusion-client:0.1.4'
}
Also, if you have got submodule then you can add this dependency to the sub-module.

Pulling Android dependency in React Native

I am trying to write a React Native version of this module https://github.com/paypal/PayPal-Cordova-Plugin
It is deprecated, but until we can transition to Braintree, we need the functionality for an existing app.
It has a dependency:
repositories{
mavenCentral()
}
dependencies {
compile('com.paypal.sdk:paypal-android-sdk:2.16.0') {
exclude group: 'io.card'
}
}
I would think that I should add this to the build.gradle file for the React Native app, but when I go there, I see this:
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
So it seems like I should have a build.gradle file in my module directory, which I do - the same as the one above (com.paypal.sdk...)
However, it doesn't seem to be registering.
Is there a way to indicate to download this dependency? I know in iOS there is pod install - is there an equivalent method in Android?
How do I install this dependency?
EDIT: My newest plugin build.gradle is this, and it still throws an error due to the library being missing:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.1'
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.paypal.sdk:paypal-android-sdk:2.16.0'
compile 'com.facebook.react:react-native:+'
}

Error:(30, 0) Could not find method compile() for arguments

I get this error. I'm pretty confused because i check everything in sdk manager and it's all updated (i think so).
Error:(30, 0) Could not find method compile() for arguments
[com.android.support:appcompat-v7:+] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK
Manager. Open Android SDK Manager
Is there something wrong with my code in build.grandle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
or is something missing...?
You can't use the compile() DSL in the top level file.
Delete this block:
dependencies {
compile 'com.android.support:appcompat-v7:+'
}
and add the dependency in the dependencies block inside the app/build.gradle file.
You should not use "compile" when using Gradle build tools 3.0.0.
"compile" has been replaced with "implementation".
And you can't add dependencies in the project build.gradle file.
You have to add dependencies in the module build.gradle file.
So in the build.gradle file in the "app" directory, add these lines:
dependencies {
implementation 'com.android.support:appcompat-v7:+'
}
The "dependencies" block might already be there, if so, just add the contents to the original block.

gradle 2.0.0 beta 7 missing

I keep getting this error. Any ideas?
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:classpath'.
Could not find com.android.tools.build:gradle:2.0.0-beta7.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-beta7/gradle-2.0.0-beta7.pom
https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.0.0-beta7/gradle-2.0.0-beta7.jar
You are referring maven central for finding android plugin artifacts, android gradle plugin is published at jcenter
add jcenter() to buildscript.repositories block in your root build.gradle file.
It should look like as below:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:X.X.X' // your verison
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Categories

Resources