In the app's build.gradle file, I have included the maven central repository and added the dependency
apply plugin: 'com.android.application'
repositories
{
mavenCentral()
}
dependencies {
compile 'org.ethereum:geth:1.8.7'
}
But the Gradle sync failed with this error
Failed to resolve: org.ethereum:geth:1.8.7
How do I fix this?
Write below code :
maven {
url "https://maven.google.com"
}
google()
instead
mavenCentral()
Related
When I add firebase perf dependency into my project i am getting this error Illegal class file: Class module-info is missing a super type. Class file version 53.
My Gradle and google services project-level dependencies are
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
and I followed the exact steps mentioned in their docs https://firebase.google.com/docs/perf-mon/get-started-android.
I have tried clean and rebuild and clearing the Android Studio cache.
And also tried similarly issue resolution from StackOverflow
Project level build gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.1'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'com.google.firebase:perf-plugin:1.3.1' // Performance Monitoring plugin
}
}
allprojects {
repositories {
google()
jcenter()
}
}
App level build gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
jcenter()
}
dependencies {
classpath 'io.fabric.tools:gradle:1.31.0'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
// Apply the Performance Monitoring plugin to enable instrumentation
apply plugin: 'com.google.firebase.firebase-perf'
repositories {
maven { url 'https://maven.fabric.io/public' }
maven { url "https://jitpack.io" }
maven {
url 'https://maven.google.com'
}
}
dependencies {
// Not added all dependencies , Just the firebase one SINCE ITS PRETTY LONG
implementation 'com.google.firebase:firebase-perf:19.0.0'
}
Adding this to your app-level build.gradle file solves the problem temporarily
debug {
FirebasePerformance {
// Set this flag to 'false' to disable #AddTrace annotation processing and
// automatic HTTP/S network request monitoring
// for a specific build variant at compile time.
instrumentationEnabled false
}
}
EDIT as per other answers and comments
Change the gradle plugin to 3.6.0 to resolve it as it has been fixed in that version
FYI, this was an AGP bug...it's been fixed in AGP 3.6
On updating build Gradle from 3.5.1 to 3.6.0 fixed my issue.
Also remove this from gradle.properties if you happen to have it there for any reason:
android.enableR8=false
(I got the error even with com.android.tools.build:gradle:4.1.2 if the above line was present)
I am getting the issue for applying instamojo in sdk 28. Its throwing ERROR: Failed to resolve: in.juspay:godel:0.6.25.4.1423
implementation 'com.instamojo:android-sdk:3.2.0'
and
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
}
I think you added below one in project level build.gradle file
mavenCentral()
maven {
url "https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/"
}
Remove and add it in application build.gradle file at parent level.
Then incluce
implementation 'com.instamojo:android-sdk:3.2.0'
in dependencies section.
When I updated, Gradle 4.6 -> 4.10.1 and the Android Gradle plugin 3.2.1 -> 3.3.1, I get the following errors:
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.firebase:firebase-messaging:[10.2.1, 12.1.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support:support-v4:[26.0.0, 27.2.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.android.support:customtabs:[26.0.0, 27.2.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-location:[10.2.1, 12.1.0).
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not resolve com.google.android.gms:play-services-base:[10.2.1, 12.1.0).
Show Details
Affected Modules: app
While inspecting dependancies I found OneSignal implementation 'com.onesignal:OneSignal:3.10.6' was throwing above errors for ex.
> Could not resolve com.google.android.gms:play-services-location:[15.0.0, 16.0.0).
Required by:
project :app > com.onesignal:OneSignal:3.10.6
> Failed to list versions for com.google.android.gms:play-services-location.
> Unable to load Maven meta-data from https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk/com/google/android/gms/play-services-location/maven-metadata.xml.
> Could not get resource 'https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk/com/google/android/gms/play-services-location/maven-metadata.xml'.
Now coming to https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk is used to fetch the dependencies required for JustPay integration.
Problem
Why wrong repository is used when resolving above dependancies for compiling the project? Am I doing something wrong or something has changed in gradle 3.3 which is causing this? Or its an issue of gradle 3.3.1?
Solution : Excluding this libs does solves the problem.
implementation ('com.onesignal:OneSignal:3.10.6') {
exclude group : 'com.google.android.gms'
exclude group : 'com.android.support'
exclude group : 'com.google.firebase'
}
I am not sure, It may have adverse affects though(If any please do let me know). But I want to get to the root of the problem I want to know why this is only happening for Android Gradle plugin 3.3.1 and the same works just fine with Android Gradle plugin 3.2.1 i.e. without excluding this dependancies.
Here is my app/build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath "io.fabric.tools:gradle:$rootProject.fabricGradle"
}
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'realm-android'
apply plugin: 'project-report'
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com'
}
maven {
url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'
}
maven {
url 'https://s3-ap-southeast-1.amazonaws.com/jp-build-packages/ec-android-sdk'
}
maven {
url 'https://s3-ap-southeast-1.amazonaws.com/godel-release/godel/'
}
}
android {
....
....
}
dependencies {
...
implementation 'com.onesignal:OneSignal:3.10.6'
...
}
build.gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.21'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1
classpath 'com.google.gms:google-services:4.2.0'
classpath "io.realm:realm-gradle-plugin:5.8.0"
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
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
...
}
Update : I know it has something to do with Improved classpath synchronization which is introduced in 3.3, but still have no clue why is it trying to resolve those dependencies with wrong repository.
Update 2
I have tried following as well
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
dependencies {
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]' //as well ) at the end
}
Can you please try this:
Go to File -> Settings -> Build, Execution, Deployment -> Gradle ->
And uncheck "Offline work" option.
Update:
Remove below line of code
classpath 'com.google.gms:google-services:4.2.0'
from top-level build.gradle file sync and check it once.
Error:Unable to find method 'com.android.build.gradle.api.BaseVariant.getOutputs()Ljava/util/List;'.
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.
In Android studio 3.0 on this problem, use the JakeWharton great god butterknife. Please how to deal with this problem, this is no problem on the Android studio 2.3. May be I used the wrong way, please advise, is originally used 8.5.1 version, an error, I upgraded to 8.6.0, found that the problem cannot be solved.
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.1+'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.6.0'
classpath ("com.tencent.mm:AndResGuard-gradle-plugin:1.2.3") { changing=true }
classpath 'com.letv.sarrsdesktop:BlockCanaryExPlugin:0.9.8.3'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven {
url "https://jitpack.io"
}
maven {
url 'http://www.idescout.com/maven/repo/'
}
maven {
url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories"
}
maven {
url 'https://maven.google.com'
}
maven {
url 'https://dl.google.com/dl/android/maven2/'
}
}
}
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}
task printProps << {
println commandLineProjectProp
println gradlePropertiesProp
println systemProjectProp
println envProjectProp
println System.properties['system']
}
apply plugin: 'com.android.application'
//butterknife
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.butterknife'
/**
* library
*/
dependencies {
compile 'com.jakewharton:butterknife:8.6.0+'
apt 'com.jakewharton:butterknife-compiler:8.6.0+'
}
Downgrade butterknife-gradle-plugin to 8.4 or use 9.0 snapshot.
Kotlin 1.2.10
Gradle 3.0.1
Build tools version 27.0.3
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
apply plugin: 'com.jakewharton.butterknife'
In my library project this comment helped me (R2 imports):
https://github.com/JakeWharton/butterknife/issues/963#issuecomment-342547601
project's build.gradle:
buildscript {
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
google()
jcenter()
}
dependencies {
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0-SNAPSHOT'
}
}
repositories {
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
module's build.gradle:
apply plugin: 'com.jakewharton.butterknife'
...
dependencies {
compile 'com.jakewharton:butterknife:9.0.0-SNAPSHOT'
kapt 'com.jakewharton:butterknife-compiler:9.0.0-SNAPSHOT'
}
This way you can use the
apply plugin: 'com.jakewharton.butterknife'
Just remove
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
downgrade butterknifeversion to 8.4.0
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
Don't forget to remove below line
apply plugin: 'me.tatarka.retrolambda'
I've deployed artifact to bintray as it whitten in documentation (using their plugin). All looks fine. It is opened in browder, structure looks fine: https://dl.bintray.com/flymob/maven/
Now I want to use it via gradle in Android Studio before publishing to jcenter(). I've read their documentation https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_gradle
I've tried:
buildscript {
repositories {
jcenter()
maven {
url "https://dl.bintray.com/flymob/maven"
}
}
}
and
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0'
or
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0#aar'
I'm getting error:
Failed to resolve: flymob-sdk-sample:FlyMobSdk:1.3.0
What am I doing wrong?
you added "https://dl.bintray.com/flymob/maven" inside the buildscript section. Those are the repos used by the buildscript (a.k.a. gradle script) only. Those are the repos where the system will find the plugins from apply plugin
to fix it is easy. Just move it to the repositories on the "root" of the script. Something like:
buildscript {
repositories {
// repos for the build script
jcenter()
... etc
}
dependencies {
// dependencies from the plugins from the build script
classpath 'com.android.tools.build:gradle:2.1.2'
... etc
}
}
apply plugin: 'android-sdk-manager'
apply plugin: ... etc
repositories {
jcenter()
maven { url "https://dl.bintray.com/flymob/maven" } <<<<< HERE
}
dependencies {
compile ... etc