AppsFlyerSDK / appsflyer-android-app

Other
33 stars 110 forks source link

E/AppsFlyer_6.3.2: (122058) [Thread-18] ExceptionInInitializerError at com.appsflyer.internal.a.AFKeystoreWrapper(Unknown Source:0) #12

Open chihung93 opened 3 years ago

chihung93 commented 3 years ago

I have many crashes on Samsung Phone

E/AppsFlyer_6.3.2: (122058) [Thread-18] ExceptionInInitializerError at com.appsflyer.internal.a.AFKeystoreWrapper(Unknown Source:0)
    java.lang.ExceptionInInitializerError
        at com.appsflyer.internal.a.AFKeystoreWrapper(Unknown Source:0)
        at com.appsflyer.internal.ae$d.run(:3175)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at com.appsflyer.internal.k$1$5.run(:31)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read(byte[], int, int)' on a null object reference
        at com.appsflyer.internal.a.<clinit>(:272)
        at com.appsflyer.internal.a.AFKeystoreWrapper(Unknown Source:0) 
        at com.appsflyer.internal.ae$d.run(:3175) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at com.appsflyer.internal.k$1$5.run(:31) 
        at java.lang.Thread.run(Thread.java:764) 
     Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read(byte[], int, int)' on a null object reference
        at java.io.DataInputStream.readFully(DataInputStream.java:198)
        at java.io.DataInputStream.readFully(DataInputStream.java:172)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.appsflyer.internal.a.<clinit>(:2408)
        at com.appsflyer.internal.a.AFKeystoreWrapper(Unknown Source:0) 
        at com.appsflyer.internal.ae$d.run(:3175) 
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458) 
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) 
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at com.appsflyer.internal.k$1$5.run(:31) 
        at java.lang.Thread.run(Thread.java:764)

My config : AndroidManifest:

 <meta-data
                android:name="com.gg.gapo.initializer.AppsFlyerInitializer"
                android:value="androidx.startup" />

Class:


class AppsFlyerInitializer : Initializer<Unit> {
    override fun create(context: Context) {
        val conversionDataListener = object : AppsFlyerConversionListener {
            override fun onAppOpenAttribution(p0: MutableMap<String, String>?) {
            }

            override fun onConversionDataSuccess(p0: MutableMap<String, Any>?) {
            }

            override fun onConversionDataFail(p0: String?) {
            }

            override fun onAttributionFailure(p0: String?) {
            }
        }

        AppsFlyerLib.getInstance().init(AF_DEV_KEY, conversionDataListener, context.applicationContext)
        AppsFlyerLib.getInstance().start(context)
        AppsFlyerLib.getInstance().setCollectAndroidID(true)
        AppsFlyerLib.getInstance().setCollectIMEI(true)
        if (BuildConfig.DEBUG) {
            AppsFlyerLib.getInstance().setLogLevel(AFLogger.LogLevel.VERBOSE)
        }
    }

    override fun dependencies(): List<Class<out Initializer<*>>> {
        return emptyList()
    }
}
sokoloff06 commented 3 years ago

Hi!

Are those crashes from production or your tests? Does it happen always or under certain conditions? Can you share and ask file and steps to reproduce?

Thank you!

chihung93 commented 3 years ago

Hello, Those crashes are from real devices in Debug mode. It randomly happen on my phones. So Do you have any solution to avoiding this crash in Production? P.s: I have not seen this issue on production ( Firebase report) yet.

sokoloff06 commented 3 years ago

Can you check if your apk contains a- and b- files under com/appsflyer/internal? Not in classes.dex, but as binary resources. Here is what I mean - https://dev.appsflyer.com/hc/docs/install-android-sdk#missing-resource-files

chihung93 commented 3 years ago

I see it in APK Debug.

Screen Shot 2021-07-15 at 21 51 13