Приложение Android Chat разбилось с кодом ошибки Firebase! "Невозможно получить поставщика Firebase" - PullRequest
0 голосов
/ 07 июля 2019

Я слежу за видео на YouTube с названием канала " KOD DEV ". Я застрял во втором видео чата приложения PlayList! Ниже мой код ошибки я получил в LogCat!

2019-07-07 09:58:23.636 9327-9327/com.example.chataround E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.chataround, PID: 9327
    java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0d0034
        at android.app.ActivityThread.installProvider(ActivityThread.java:6504)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6053)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5965)
        at android.app.ActivityThread.-wrap1(Unknown Source:0)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1792)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:192)
        at android.app.ActivityThread.main(ActivityThread.java:6760)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826)
     Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f0d0034
        at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:295)
        at android.content.res.Resources.getResourcePackageName(Resources.java:2012)
        at com.google.android.gms.common.internal.StringResourceValueReader.<init>(Unknown Source:5)
        at com.google.firebase.FirebaseOptions.fromResource(com.google.firebase:firebase-common@@17.1.0:160)
        at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@17.1.0:248)
        at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@17.1.0:53)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:2064)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:2039)
        at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@17.1.0:47)
        at android.app.ActivityThread.installProvider(ActivityThread.java:6501)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:6053) 
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5965) 
        at android.app.ActivityThread.-wrap1(Unknown Source:0) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1792) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:192) 
        at android.app.ActivityThread.main(ActivityThread.java:6760) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:826) 

Я хочу решить, пожалуйста, помогите мне! Введите код здесь

Это файл My Manifest.xml.

 <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              package="com.example.chataround">

        <uses-permission android:name="android.permission.INTERNET"/>

        <application
                android:allowBackup="true"
                android:icon="@mipmap/ic_launcher"
                android:label="@string/app_name"
                android:roundIcon="@mipmap/ic_launcher_round"
                android:supportsRtl="true"

                android:theme="@style/AppTheme">
            <activity android:name=".StartActivity">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>

                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
            <activity android:name=".LoginActivity"
                        android:parentActivityName=".StartActivity"/>

            <activity android:name=".RegisterActivity"
                        android:parentActivityName=".StartActivity"/>

            <activity android:name=".MainActivity">

            </activity>
        </application>

    </manifest>

Это код My Manifest.xml! Я получил приложение сбой с кодом ошибки в Logcat, который я загрузить ранее выше.

Это мой уровень проекта Build.gardle

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

buildscript {
    ext.kotlin_version = '1.3.21'
    repositories {
        google()
        jcenter()

    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.1'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath 'com.google.gms:google-services:4.1.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()

    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

А это мой уровень приложения Build.gradle File

    apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'

android {
    compileSdkVersion 28
    defaultConfig {
        multiDexEnabled true
        applicationId "com.example.chataround"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.0-beta01'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
    testImplementation 'junit:junit:4.12'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0-beta01'
    implementation 'com.google.android.material:material:1.0.0-beta01'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'androidx.cardview:cardview:1.0.0-beta01'
    androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
    implementation 'com.rengwuxian.materialedittext:library:2.1.4'
    implementation 'com.android.support:multidex:1.0.3'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
}
apply plugin: 'com.google.gms.google-services'

1 Ответ

0 голосов
/ 07 июля 2019

Попробуйте добавить android:name="android.support.multidex.MultiDexApplication" в блок приложения вашего манифеста

<application
        android:name="android.support.multidex.MultiDexApplication" >
    ...
</application>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...