Iorek
Iorek

Reputation: 581

Method for arguments with gradle in android studio

Syncing the project files with gradle files in android studio is resulting in the following error

Error:(14, 0) Could not find method applicationId() for arguments [com.amazon.mysampleapp] on project ':app' of type org.gradle.api.Project.

where the gradle file reads

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"
    applicationId "com.amazon.mysampleapp"
    minSdkVersion 15
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
    multiDexEnabled = true
}

What is happening here? Removing applicationID moves the error to minSdkVersion

Upvotes: 0

Views: 105

Answers (1)

AdamMc331
AdamMc331

Reputation: 16690

The applicationId doesn't go inside the android block, but instead your buildConfig block:

apply plugin: 'com.android.application'
android {
    compileSdkVersion 19
    buildToolsVersion "19.1"

    defaultConfig {
        applicationId "com.example.my.app"
        minSdkVersion 15
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
}

Pulled that from this page about applicationId: http://tools.android.com/tech-docs/new-build-system/applicationid-vs-packagename

Upvotes: 2

Related Questions