Sharath Chellappa
Sharath Chellappa

Reputation: 31

Firebase Cloud Notification causing Application to crash

I have limited Android Experience and had a very basic doubt. My scenario is as follows:

I currently have 2 applications, one being a QR Code Scanner and another which displays a QR Code. These will be running on multiple devices. The communication steps which take place are as follows:

Prior Setup:

There is a firebase database containing strings for QR Codes to be generated. Device 2 reads the Code off the Firebase Database and displays it on the Screen (2nd App).

Device Communication:

  1. Device 1 has the Scanner App and Device 2 has the QR Code displayed on Screen.
  2. Device 1 now scans the QR Code from the Device 2 and verifies through some logic whether QR Code is valid or not.

If QR Code is valid, then the following takes place:

  1. Device 1 calculates a new QR Code and places it on the Firebase Database.

  2. The Device 2 should now move from displaying the QR Code to another activity which has the logic to Scan QR Codes of other Devices and verifies if they are correct.

  3. Device 3 onwards must display a new QR Code which is on the Firebase Database which can now be scanned by Devices 1 and 2.

Note: The QR Code Updates on UI must keep happening until there is some sort of indication which makes the Device move to the QR Code Scanning stage.

Things which are working:

  1. The 2 activities of the application (QR Code Display and QR Code Scanning) working independently.
  2. QR Code Updates on UI whenever Firebase Database updated.

Things which are not working:

  1. Moving from QR Code Display to Scanning once the QR Code is deemed valid.

Things I have tried: I have basically tried to implement a Device to Device Communication using Firebase Cloud Messaging. However, as soon as Device 1 deems QR Code as valid, it sends a Push Notification and then crashes. The stack trace is as follows:


2019-11-26 14:32:21.626 16781-16781/com.example.blockchain I/System.out: tf = true
2019-11-26 14:32:21.626 16781-16781/com.example.blockchain I/System.out: Coming here to check it
2019-11-26 14:32:21.626 16781-16781/com.example.blockchain I/System.out: 128.237.116.38
2019-11-26 14:32:21.626 16781-16781/com.example.blockchain E/TAG: try
2019-11-26 14:32:21.627 16781-16781/com.example.blockchain I/System.out: {"to":"\/topics\/blockchain","data":{"title":"BlockchainCopy","message":"test_message"}}
2019-11-26 14:32:21.627 16781-16781/com.example.blockchain E/TAG: sendNotification
2019-11-26 14:32:21.651 16781-16781/com.example.blockchain I/Choreographer: Skipped 78 frames!  The application may be doing too much work on its main thread.
2019-11-26 14:32:21.667 16781-16796/com.example.blockchain D/DecorView: onWindowFocusChangedFromViewRoot hasFocus: true, DecorView@4fbf77c[SecondActivity]
2019-11-26 14:32:21.674 16781-16827/com.example.blockchain E/libc: Access denied finding property "vendor.debug.egl.changepixelformat"
2019-11-26 14:32:21.668 16781-16781/com.example.blockchain W/RenderThread: type=1400 audit(0.0:3682787): avc: denied { read } for name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=22634 scontext=u:r:untrusted_app:s0:c250,c256,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
2019-11-26 14:32:21.677 16781-16781/com.example.blockchain D/OnePlusJankManager:  Chor uploadMDM JANK_TYPE_ONCE mViewTitle = com.example.blockchain/com.example.blockchain.barcode.BarcodeCaptureActivity--- jank level = 3
2019-11-26 14:32:21.678 16781-16781/com.example.blockchain W/RenderThread: type=1400 audit(0.0:3682788): avc: denied { read } for name="u:object_r:vendor_default_prop:s0" dev="tmpfs" ino=22634 scontext=u:r:untrusted_app:s0:c250,c256,c512,c768 tcontext=u:object_r:vendor_default_prop:s0 tclass=file permissive=0
2019-11-26 14:32:21.687 16781-16827/com.example.blockchain E/libc: Access denied finding property "vendor.debug.egl.swapinterval"
2019-11-26 14:32:22.143 16781-16781/com.example.blockchain I/TAG: onResponse: {"message_id":810991634534636509}
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai: Rejecting re-init on previously-failed class java.lang.Class<com.google.firebase.iid.FirebaseInstanceIdReceiver>: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/legacy/content/WakefulBroadcastReceiver;
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at android.content.BroadcastReceiver android.app.AppComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:84)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at android.content.BroadcastReceiver androidx.core.app.CoreComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (:60)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread.handleReceiver(android.app.ActivityThread$ReceiverData) (ActivityThread.java:3492)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$ReceiverData) (ActivityThread.java:207)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1769)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.os.Looper.loop() (Looper.java:193)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6898)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:537)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:858)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai: Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.legacy.content.WakefulBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:134)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:379)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.VMClassLoader.findLoadedClass(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:738)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:363)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at android.content.BroadcastReceiver android.app.AppComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (AppComponentFactory.java:84)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at android.content.BroadcastReceiver androidx.core.app.CoreComponentFactory.instantiateReceiver(java.lang.ClassLoader, java.lang.String, android.content.Intent) (:60)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread.handleReceiver(android.app.ActivityThread$ReceiverData) (ActivityThread.java:3492)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread.access$1400(android.app.ActivityThread, android.app.ActivityThread$ReceiverData) (ActivityThread.java:207)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1769)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:106)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.os.Looper.loop() (Looper.java:193)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6898)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) (Method.java:-2)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run() (RuntimeInit.java:537)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain I/mple.blockchai:     at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:858)
2019-11-26 14:32:22.145 16781-16781/com.example.blockchain D/AndroidRuntime: Shutting down VM
2019-11-26 14:32:22.146 16781-16781/com.example.blockchain E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.example.blockchain, PID: 16781
    java.lang.RuntimeException: Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3499)
        at android.app.ActivityThread.access$1400(ActivityThread.java:207)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:84)
        at androidx.core.app.CoreComponentFactory.instantiateReceiver(:60)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3492)
        at android.app.ActivityThread.access$1400(ActivityThread.java:207) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6898) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
        Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/legacy/content/WakefulBroadcastReceiver;
        at java.lang.VMClassLoader.findLoadedClass(Native Method)
        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
                ... 12 more
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.legacy.content.WakefulBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                ... 15 more
2019-11-26 14:32:22.147 16781-16781/com.example.blockchain E/UncaughtException: java.lang.RuntimeException: Unable to instantiate receiver com.google.firebase.iid.FirebaseInstanceIdReceiver: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3499)
        at android.app.ActivityThread.access$1400(ActivityThread.java:207)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6898)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
        at android.app.AppComponentFactory.instantiateReceiver(AppComponentFactory.java:84)
        at androidx.core.app.CoreComponentFactory.instantiateReceiver(:60)
        at android.app.ActivityThread.handleReceiver(ActivityThread.java:3492)
        at android.app.ActivityThread.access$1400(ActivityThread.java:207) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1769) 
        at android.os.Handler.dispatchMessage(Handler.java:106) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.app.ActivityThread.main(ActivityThread.java:6898) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) 
        Suppressed: java.lang.NoClassDefFoundError: Failed resolution of: Landroidx/legacy/content/WakefulBroadcastReceiver;
        at java.lang.VMClassLoader.findLoadedClass(Native Method)
        at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:738)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:363)
                ... 12 more
     Caused by: java.lang.ClassNotFoundException: Didn't find class "androidx.legacy.content.WakefulBroadcastReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
                ... 15 more

The common part of the stack trace is as follows:

     Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.iid.FirebaseInstanceIdReceiver" on path: DexPathList[[zip file "/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/base.apk"],nativeLibraryDirectories=[/data/app/com.example.blockchain-g4FegWMiU_R7WlQdxEO8Ng==/lib/arm64, /system/lib64]]

Possible areas where code could go wrong is listed below:

Sending Notification using Request Queue

    private val requestQueue: RequestQueue by lazy {
        Volley.newRequestQueue(this.applicationContext)
    }


    private fun sendNotification(notification: JSONObject) {
        Log.e("TAG", "sendNotification")
        val jsonObjectRequest = object : JsonObjectRequest(FCM_API, notification,
                Response.Listener<JSONObject> { response ->
                    Log.i("TAG", "onResponse: $response")
                },
                Response.ErrorListener {
                    Toast.makeText(this@SecondActivity, "Request error", Toast.LENGTH_LONG).show()
                    Log.i("TAG", "onErrorResponse: Didn't work")
                }) {

            override fun getHeaders(): Map<String, String> {
                val params = HashMap<String, String>()
                params["Authorization"] = serverKey
                params["Content-Type"] = contentType
                return params
            }
        }
        requestQueue.add(jsonObjectRequest)
    }

Area where the QR Code is validated with the part where notification is sent 

                    if (tf == true) {
                        database.child("Latest Hash").setValue(block_to_be_added.getHash())
                        database.child("IP addresses").child(address).setValue(ip)
                        println("Coming here to check it")
                        println(ip)
                        val topic = "/topics/blockchain" //topic has to match what the receiver subscribed to

                        val notification = JSONObject()
                        val notificationBody = JSONObject()

                        try {
                            notificationBody.put("title", "BlockchainCopy")
                            notificationBody.put("message", "test_message")   //Enter your notification message
                            notification.put("to", topic)
                            notification.put("data", notificationBody)
                            Log.e("TAG", "try")
                        } catch (e: JSONException) {
                            Log.e("TAG", "onCreate: " + e.message)
                        }
                        println(notification)
                        sendNotification(notification)
                    }


Proguard.pro file has everything commented (Nothing changed from default)

Android Manifest

<?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.blockchain">
    <permission
        android:name="com.app.appname.permission.C2D_MESSAGE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.app.appname.permission.C2D_MESSAGE" />
    <uses-permission android:name="com.google.android.c2dm.permission.SEND" />
    <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <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=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".SecondActivity" />
        <activity
            android:name=".barcode.BarcodeCaptureActivity"
            android:theme="@style/Theme.AppCompat.NoActionBar" />
        <service
            android:name=".MyFirebaseMessagingService"
            android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
            </intent-filter>
        </service>
        <receiver
            android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver"
            android:exported="true"
            android:permission="com.google.android.c2dm.permission.SEND" >
            <intent-filter>
                <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                <category android:name="YOUR_PACKAGE_NAME" />
            </intent-filter>
        </receiver>
    </application>

</manifest>


Build.gradle file


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

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.example.blockchain"
        minSdkVersion 23
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            debuggable false
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
        debug {
            debuggable true
            minifyEnabled true
            shrinkResources true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    dataBinding{
        enabled=true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.gms:play-services-vision:19.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-database:16.0.4'
    implementation 'com.google.firebase:firebase-functions:16.1.3'
    implementation 'com.google.firebase:firebase-messaging:17.3.4'
    implementation 'com.android.volley:volley:1.1.1'
    annotationProcessor 'org.androidannotations:androidannotations:4.4.0'
    implementation 'org.androidannotations:androidannotations-api:4.4.0'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation "androidx.core:core-ktx:+"
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-crash:16.2.1'
    implementation 'com.google.firebase:firebase-auth:16.1.0'
}
repositories {
    mavenCentral()
}

**These are the areas where I feel error could occur. Also please help me understand whether my direction of approach is correct. If any more snippets needed please let me know. **

Upvotes: 2

Views: 1082

Answers (1)

Panicum
Panicum

Reputation: 824

Update your all dependencies versions to the newest one ( specifically from firebase). java.lang.ClassNotFoundException: crashes are offten caused by wrong implementation of dependencies.

Upvotes: 3

Related Questions