Could not find method android() for arguments on root project 'DemoApp'

  • Replies:1
nathanjames
  • Forum posts: 1

Oct 3, 2018, 1:24:56 AM via Website

Hi, apologies if this is in the wrong area.

I am learning to become a Android Developer and I am getting the following error after importing a DemoApp lecture/project.

Error:(22, 0) Could not find method android() for arguments [build_37t24irnbyoe7akecva1y2tmh$_run_closure3@4e763413] on root project 'DemoApp' of type org.gradle.api.Project.

I am not sure what to do here, or what is causing this. From what I understand it's something to do with the build or project version?

As I understand it, it is something to do with my Gradle Script or the Build Script, but I dont understand what is wrong.

image

I did some initial research, and found an StackOverFlow article but I can't post the link as I am a new user. But the answer said

You are using the wrong build.gradle file.
In your top-level file you can't define an android block.
Just move this part inside the module/build.gradle file

But I dont understand where you move it to.
Or how I need to fix this.

Can someone please explain what the problem is?
I am using Android Studio 2.2.1

Reply
James Watson
  • Forum posts: 1,584

Oct 3, 2018, 2:41:57 PM via Website

Check whether you have installed Android SDK 23 in SDK Manager.

Download size < 0.15 MB. But also accurate enough, ad-free & free.
The minimalist app available on Play Store: https://goo.gl/ws42fN
Blog: https://okblackcafe.blogspot.com Your 5-star is appreciated.

Helpful?
Reply