Kotlin and Android Development featuring Jetpack: allprojects should be moved to settings.gradle (page 245)

The allprojects block listed on page 245 produces the following error when syncing gradle:
“org.gradle.api.GradleScriptException: A problem occurred evaluating root project ‘Android Baseball League
Caused by: org.gradle.api.InvalidUserCodeException: Build was configured to prefer settings repositories over project repositories but repository ‘Google’ was added by build file ‘build.gradle’’”
A search online lead me to this post which mentioned a working fix:
Using the suggestion from stack overflow, the fix is:
Remove the code segment:
allprojects {
repositories {
google()
jcenter()
maven{ url 'https://jitpack.io' }
}
}
Then modify the “settings.gradle” file to include “maven { url ‘https://jitpack.io’ }”. The file should look something like this when complete:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
jcenter() // Warning: this repository is going to shut down soon
}
}
Just wanted to give a heads up to anyone else working through this fantastic book.
Popular Pragprog topics










Other popular topics










Latest in Pragprog
Latest (all)
Categories:
My Saved Portals
-
None saved yet
Popular Portals
- /elixir
- /opensuse
- /rust
- /kotlin
- /ruby
- /erlang
- /python
- /clojure
- /react
- /quarkus
- /go
- /vapor
- /v
- /react-native
- /wasm
- /security
- /django
- /nodejs
- /centos
- /haskell
- /rails
- /fable
- /gleam
- /swift
- /js
- /deno
- /assemblyscript
- /tailwind
- /laravel
- /symfony
- /phoenix
- /crystal
- /typescript
- /debian
- /adonisjs
- /julia
- /arch-linux
- /svelte
- /spring
- /c-plus-plus
- /preact
- /flutter
- /actix
- /java
- /angular
- /ocaml
- /zig
- /kubuntu
- /scala
- /zotonic
- /vim
- /rocky
- /lisp
- /html
- /keyboards
- /vuejs
- /nim
- /emacs
- /nerves
- /elm