首页 > 解决方案 > 找不到参数的方法 applicationId()?

问题描述

我试图修复这个错误,但我不知道我的主要问题是什么。

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

我的毕业文件:

    // 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'

有人帮我和我的应用程序人员一起解决这个问题吗?

标签: javaandroidfirebase

解决方案


将缺少的内容添加{到您的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()
}

推荐阅读