Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In 2022, can't get examples to work in #13

Closed
seanw2020 opened this issue Feb 9, 2022 · 3 comments
Closed

In 2022, can't get examples to work in #13

seanw2020 opened this issue Feb 9, 2022 · 3 comments

Comments

@seanw2020
Copy link

seanw2020 commented Feb 9, 2022

First, thank you for writing this book!

Is it possible to run the code examples in a recent version of IntelliJ IDEA? I'm using 2021.3 Ultimate Edition. I'm using the gradle wrapper with the version set (see image below, note that the s is now required unlike a few years ago) as you suggest in your README, and I followed the tips you mentioned in this issue, but I get this output:

11:32 PM	Gradle sync failed: This version of Android Studio requires projects to use Gradle 4.8.1 or newer. This project is using Gradle 1.7.
			Change to minimum versions (plugin 3.2.0, Gradle 4.8.1) and sync project
			Change to latest versions (plugin 7.0.0, Gradle 7.0.2) and sync project
			Open build file (16 s 601 ms)

My settings look like this:

image
image
image
image

Now that it's 2022, should I just give up on getting the code to work, and instead follow the book content as best as possible, following up with something like the Udemy Gradle Masterclass?

@bmuschko
Copy link
Owner

bmuschko commented Feb 9, 2022

Thanks! You are using Android Studio and not IntelliJ IDEA which seems to enforce a specific Gradle version. Try this with IntelliJ IDEA community edition.

@seanw2020
Copy link
Author

Cool, that gets me closer, but rather than installing Community Edition, it turns out that you can disable IntelliJ's Android Studio plugin to achieve the same thing...

image

..., but then I get this:

Unsupported Gradle.
The project uses Gradle 1.7 which is incompatible with IntelliJ IDEA 2021.3.
Possible solution:

  • Upgrade Gradle wrapper to 3.0 version and re-import the project

So it seems IntelliJ integration is impossible.

As a workaround, should I just run the gradle commands from IntelliJ's terminal? For example, using sdk-man, I can select gradle 1.7, and cd to the project's directory.

@bmuschko
Copy link
Owner

bmuschko commented Feb 9, 2022

You can use a newer version than Gradle 1.7 and I am sure the IDE would still be happy with it. In addition, Gradle now also requires you to add a settings.gradle file for each project. The way you opened the "project" in IntelliJ isn't correct as you are not dealing with a large multi-project build. You need to open projects individually e.g. chapter02/helloworld-task-doLast.

Side note: For learning purposes, you don't really need an IDE. You may just open a project from an editor e.g. VsCode. You can always execute the build from the command line.

Bottom line: The book would need a major overhaul, however, Manning Publications decided not to work on a second edition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants