无法找到方法applicationId()作为参数?

时间:2019-01-14 17:08:13

标签: java android firebase

我已尝试解决此错误,但我不知道这是我的主要问题。

我遇到的错误是有关添加依赖项或依赖项版本的信息,如果有解决方案,请帮助:

我的gradle文件:

    // Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.1'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
}

task clean(type: Delete) {

    delete rootProject.buildDir
}

app.gradle文件是:

  

应用插件:“ com.android.application”

android {

    compileSdkVersion 28
    buildToolsVersion '28.0.3'

    defaultConfig
        applicationId "me.ismashot.ibtassim"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 59
        versionName '4.6'
        multiDexEnabled true
    }

    dexOptions {

        jumboMode true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }

    productFlavors {
    }


dependencies {
    implementation  fileTree(include: ['*.jar'], dir: 'libs')
    implementation  'com.mcxiaoke.volley:library:1.0.19'
    implementation  'com.github.chrisbanes.photoview:library:1.2.3'
    implementation  'com.facebook.android:facebook-android-sdk:4.35.0'
    implementation  'com.pkmmte.view:circularimageview:1.1'
    implementation  'com.melnykov:floatingactionbutton:1.3.0'
    implementation  'com.squareup.okhttp:okhttp:2.5.0'
    implementation  'com.github.bumptech.glide:glide:3.7.0'
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:animated-vector-drawable:28.0.0'
    implementation 'com.android.support:mediarouter-v7:28.0.0'
    implementation 'com.android.support:customtabs:28.0.0'
    implementation 'com.android.support:design:28.0.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.balysv:material-ripple:1.0.2'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.3.0'
    implementation 'com.google.firebase:firebase-analytics:16.0.3'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation 'com.google.android.gms:play-services-ads:15.0.1'

    implementation  files('libs/YouTubeAndroidPlayerApi.jar')
}

apply plugin: 'com.google.gms.google-services'

有人帮助我和我的应用程序专家一起解决此问题吗?

1 个答案:

答案 0 :(得分:1)

将丢失的{添加到您的defaultConfig

android {
    ...
    defaultConfig {
        applicationId "me.ismashot.ibtassim"
        ...
        }
    ...
}

编辑:

要修复Failed to resolve: play-services-basement,请确保在所有google()块中将jcenter()存储库放在repositories之前:

repositories {
    maven {
        url 'https://maven.google.com/'
        name 'Google'
    }
    google()
    jcenter()
}