I've been having this issue for a while and have been racking my brain.
I googled this answer here
Which the response is "Make sure you open the project from its root directory. i.e. the directory which contains the top level build.gradle file."
My question is: How the do I do that if I cloned the project from bitbucket?
Here's a screenshot of my file tree:
Thank you for any insights
Edit: Gradle files
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
app level:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '4.0.0'
def JacksonVersion = '2.6.0'
def GPSVersion = '6.5.87'
dependencies {
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.android.support:design:23.0.0'
compile 'com.android.support:recyclerview-v7:23.0.0'
compile 'com.android.support:preference-v7:23.0.0'
}
repositories {
maven {
url 'https://repo.spring.io/libs-milestone'
}
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName "appname"
logLevel 'TRACE'
logAppenderConsole 'true'
}
}
android {
compileSdkVersion 23
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "appname"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
shrinkResources false
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
Your project is not Gradle based because settings.gradle
and bulid.gradle
are not in the IDE project directory, they are in that blacked-out subfolder under .idea
and .gradle
in your picture.
You must close this project. Open that other folder as an Android Studio Project, regardless of where you got that project from.
For library projects in Github, it would look like this. Anyone can clone this as-is and open as a project.
For apps, replace sample
with app
, and remove library
Most importantly, buildscript
and allprojects
section should not be in /app/build.gradle
, only /build.gradle
Additionally, your Gradle build plugin is outdated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With