Closed oras closed 3 years ago
Hi @oras. Have you included the Maven plugin repositories into your Gradle dependencies, as discussed in the project's README.md
?
TLDR, ensure you have these additions to your top-level build.gradle
:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
// ...
}
// ...
}
allprojects {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
// ...
}
// ...
}
According to this we should add our dependencies to the settings.gradle
file.
Here is my settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven {
url "https://plugins.gradle.org/m2/"
}
}
}
rootProject.name = "AWS Test"
include ':app'
And this is my top-level build.gralde
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30"
classpath 'com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm getting this error message and can't really figure out why
Execution failed for task ':app:nodeSetup'.
> Build was configured to prefer settings repositories over project repositories but repository 'ivy' was added by unknown code
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Hi, any update on this? I have exactly the same problem as @msimic-dev. Running on a MacBook with M1 pro chip.
I am also facing the same problem as @msimic-dev.
Please upgrade to 3.4.1 which contains support for Apple Silicon chips
Hi, @tylerjroach. I upgraded to 3.4.1. But I am also facing the same problem as @msimic-dev. Running on a MacBook with M3 pro chip.
@hackfreeee can you show your build.gradle?
@tylerjroach build.gradle.kts (project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
}
buildscript {
repositories {
// Add this maven block.
maven(url="https://plugins.gradle.org/m2/")
google()
mavenCentral()
}
dependencies {
classpath("com.amazonaws:aws-android-sdk-appsync-gradle-plugin:3.4.1")
}
}
build.gradle.kts (app)
plugins {
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsKotlinAndroid)
id("com.amazonaws.appsync")
}
android {
namespace = "com.example.myapplication"
compileSdk = 34
defaultConfig {
applicationId = "com.example.myapplication"
minSdk = 24
targetSdk = 34
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.activity.compose)
implementation(platform(libs.androidx.compose.bom))
implementation(libs.androidx.ui)
implementation(libs.androidx.ui.graphics)
implementation(libs.androidx.ui.tooling.preview)
implementation(libs.androidx.material3)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
androidTestImplementation(platform(libs.androidx.compose.bom))
androidTestImplementation(libs.androidx.ui.test.junit4)
debugImplementation(libs.androidx.ui.tooling)
debugImplementation(libs.androidx.ui.test.manifest)
}
settings.gradle.kts
pluginManagement {
repositories {
maven(url="https://plugins.gradle.org/m2/")
google {
content {
includeGroupByRegex("com\\.android.*")
includeGroupByRegex("com\\.google.*")
includeGroupByRegex("androidx.*")
}
}
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven(url="https://plugins.gradle.org/m2/")
google()
mavenCentral()
}
}
rootProject.name = "My Application"
include(":app")
error message
Execution failed for task ':app:nodeSetup'.
> Build was configured to prefer settings repositories over project repositories but repository 'ivy' was added by unknown code
The failure is coming from your settings.gradle.kts
setup of repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
.
Can you try and replace that with repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
and report back?
@tylerjroach The following was output
Execution failed for task ':app:nodeSetup'.
> Could not resolve all dependencies for configuration ':app:detachedConfiguration10'.
> Could not find org.nodejs:node:20.10.0.
Searched in the following locations:
- https://plugins.gradle.org/m2/org/nodejs/node/20.10.0/node-20.10.0.pom
- https://dl.google.com/dl/android/maven2/org/nodejs/node/20.10.0/node-20.10.0.pom
- https://repo.maven.apache.org/maven2/org/nodejs/node/20.10.0/node-20.10.0.pom
Required by:
project :app
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Hi @hackfreeee @lindan4. This issue is caused by the Node Gradle Plugin being used adding a repository pointing to the nodejs.org distribution location. This plugin is used to install Node in order to run the Apollo codegen. Newer Gradle versions have centralized repository declarations in settings.gradle.kts
and fail by default if anything else tries to add them.
The easiest workaround is to use repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
as suggested and to manually specify the repository in your settings.gradle.kts
file. This is how I did it:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
ivy {
name = "Node.js"
setUrl("https://nodejs.org/dist/")
patternLayout {
artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]")
}
metadataSources {
artifact()
}
content {
includeModule("org.nodejs", "node")
}
}
}
}
Please let us know if that resolves the issue.
Solved. Thank you so much.
When I try to build my project, I am getting an error. Here is the Gradle error trace:
AppSync SDK version: 3.1.1
My Android Studio version info:
Gradle version: 6.7 Android Gradle Plugin version: 4.2.0-alpha13