я хочу соединиться с Firebase но у меня ошибка - PullRequest
0 голосов
/ 30 мая 2018

Я хочу подключиться к Firebase, но у меня есть ошибка: «не удалось проанализировать модули приложения для Android gradle config.resolve, проблемы сборки сборки и / или повторной синхронизации».и я проверяю свое обучениеесли я синхронизирую gradle, у меня появляется предупреждение «ПРЕДУПРЕЖДЕНИЕ: конфигурация« compile »устарела и была заменена на« реализация »и« api ».»

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
    applicationId "dxd.zzz.axy"
    minSdkVersion 15
    targetSdkVersion 26
    versionCode 2
    versionName "1.1"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
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
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.android.gms:play-services-maps:11.0.4'
implementation 'com.google.firebase:firebase-messaging:11.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation 'com.mikhaellopez:circularimageview:3.0.2'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
implementation 'com.android.support:mediarouter-v7:26.1.0'
implementation files('libs/sqliteassethelper-2.0.1.jar')
}

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

Ответы [ 4 ]

0 голосов
/ 30 мая 2018

Прежде всего, убедитесь, что вы используете последнюю версию сервисов Google (Project Level):

classpath 'com.google.gms:google-services:4.0.1'

Затем измените свой код, вы также должны добавить firebase-core, как показано ниже.

apply plugin: 'com.android.application'
android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "dxd.zzz.axy"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 2
        versionName "1.1"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    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
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support:support-v4:26.1.0'
    implementation 'com.android.support:design:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.0'
    implementation 'com.google.android.gms:play-services-maps:15.0.1'

    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:cardview-v7:26.1.0'
    implementation 'com.mikhaellopez:circularimageview:3.0.2'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    implementation 'com.mohamadamin:persianmaterialdatetimepicker:1.2.1'
    implementation 'com.android.support:mediarouter-v7:26.1.0'
    implementation files('libs/sqliteassethelper-2.0.1.jar')
}

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

Более того, если вы хотите использовать другие библиотеки Firebase прямо сейчас, пожалуйста, следите за последней версией, как показано ниже, и всегда обращайтесь к по этой ссылке , чтобы быть уверенным, что вы используете последнюю версию.

    implementation 'com.google.firebase:firebase-core:16.0.0'
    implementation 'com.google.firebase:firebase-ads:15.0.1'
    implementation 'com.google.firebase:firebase-analytics:16.0.0'
    implementation 'com.google.firebase:firebase-appindexing:15.0.1'
    implementation 'com.google.firebase:firebase-auth:16.0.1'
    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    implementation 'com.google.firebase:firebase-functions:16.0.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.0'
    implementation 'com.google.firebase:firebase-invites:16.0.0'
    implementation 'com.google.firebase:firebase-perf:16.0.0'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'com.google.firebase:firebase-config:16.0.0'
0 голосов
/ 30 мая 2018

Пожалуйста, используйте самую последнюю библиотеку для firebase

implementation 'com.google.firebase:firebase-messaging:15.0.0'

И убедитесь, что вам нужно добавить консольный файл конфигурации firebase в ваш проект.

0 голосов
/ 30 мая 2018

Вы должны написать последнюю версию службы gms на уровне приложения. Пожалуйста, см. Изображение ниже

введите описание изображения здесь

0 голосов
/ 30 мая 2018

Не беспокойтесь об этом предупреждении.Если он успешно строится, тогда вообще никаких проблем.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...