Android Gradle - Error: Unsupported method: BaseConfig.getApplicationIdSuffix ()

2

When importing a Github project using < strong> Android Studio 3.0.1 I got the following error in Gradle:

  

Error: Unsupported method: BaseConfig.getApplicationIdSuffix (). The   version of Gradle you connect to does not support that method. To   solve the problem you can change the target version of   Gradle you connect to. Alternatively, you can ignore this exception   and read other information from the model.

I already tried to make these changes, but I was not successful: link

I'm new to android. I still do not understand much about Gradle. Below is the status of my Gradle files in Android Studio 3.0.1

Any help is greatly appreciated.

build.gradle :

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.1"

    defaultConfig {
        applicationId "luck.materialdesign.tabsnavigator"
        minSdkVersion 16
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:21.0.3'
    compile 'com.android.support:support-v4:21.0.3'
    compile 'de.hdodenhof:circleimageview:1.2.2'
    compile 'com.mcxiaoke.volley:library:1.0.15'
}

local.properties :

## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Sat Jan 27 00:26:41 BRST 2018
sdk.dir=/Users/user/Library/Android/sdk

gradle-wrapper-properties :

#Sat Jan 27 01:01:59 BRST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
    
asked by anonymous 27.01.2018 / 04:18

1 answer

2

I was able to resolve it as follows.

Edit the build.gradle file to use an older version: classpath 'com.android.tools.build:gradle:2.3.2'

IdownloadedanolderversionofGradlehere: link

Extract and paste content into the Android Studio Gradle folder, on the Mac the path is Applications > Android Studio > Contents > Gradle

NowforceAndroidStudiotousetheolderversionofGradlebychangingthesettings.

AfteraBuild>CleanProjectandRebuildProject

Androidwillaskyoutoupgradetoanewerversion.Ignorethismessage.

Fromnowonyoushouldalreadybeabletoworkonyourapplication.

    
27.01.2018 / 06:30