Search code examples
androidcrashandroid-studio-3.0android-multidex

Android MultiDex app crashing on low APIs on Android Studio 3.0


I was trying to run an app that requires MultiDex using Android Studio 3.0 on an API 16 device and when the app is finally trying to launch, it crashes. The same occurs on other low APIs (eg.: 17, 18, 19)

But, when I tried to run the app using the Android Studio 3.1 (beta version), no crashes occur.

Is there any way this crash can be fixed?

   FATAL EXCEPTION: main
  java.lang.ExceptionInInitializerError
      at android.support.multidex.MultiDexApplication.<init>(MultiDexApplication.java:35)
      at MY_APP_PATH.MY_CUSTOM_APPLICATION_CLASS.<init>(MY_CUSTOM_APP_CLASS.java:23)
      at java.lang.Class.newInstanceImpl(Native Method)
      at java.lang.Class.newInstance(Class.java:1319)
      at android.app.Instrumentation.newApplication(Instrumentation.java:997)
      at android.app.Instrumentation.newApplication(Instrumentation.java:982)
      at android.app.LoadedApk.makeApplication(LoadedApk.java:496)
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4170)
      at android.app.ActivityThread.access$1400(ActivityThread.java:134)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
      at android.os.Handler.dispatchMessage(Handler.java:99)
      at android.os.Looper.loop(Looper.java:137)
      at android.app.ActivityThread.main(ActivityThread.java:4867)
      at java.lang.reflect.Method.invokeNative(Native Method)
      at java.lang.reflect.Method.invoke(Method.java:511)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
      at dalvik.system.NativeStart.main(Native Method)
   Caused by: java.lang.UnsatisfiedLinkError: Cannot load library: reloc_library[1306]:  1674 cannot locate '__isnanf'...

      at java.lang.Runtime.loadLibrary(Runtime.java:370)
      at java.lang.System.loadLibrary(System.java:535)
      at com.android.tools.profiler.support.ProfilerService.<clinit>(ProfilerService.java:41)
      at android.support.multidex.MultiDexApplication.<init>(MultiDexApplication.java:35) 
      at MY_APP_PATH.MY_CUSTOM_APPLICATION_CLASS.<init>(MY_CUSTOM_APPLICATION_CLASS.java:23) 
      at java.lang.Class.newInstanceImpl(Native Method) 
      at java.lang.Class.newInstance(Class.java:1319) 
      at android.app.Instrumentation.newApplication(Instrumentation.java:997) 
      at android.app.Instrumentation.newApplication(Instrumentation.java:982) 
      at android.app.LoadedApk.makeApplication(LoadedApk.java:496) 
      at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4170) 
      at android.app.ActivityThread.access$1400(ActivityThread.java:134) 
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
      at android.os.Handler.dispatchMessage(Handler.java:99) 
      at android.os.Looper.loop(Looper.java:137) 
      at android.app.ActivityThread.main(ActivityThread.java:4867) 
      at java.lang.reflect.Method.invokeNative(Native Method) 
      at java.lang.reflect.Method.invoke(Method.java:511) 
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) 
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) 
      at dalvik.system.NativeStart.main(Native Method) 

Solution

  • Issue should be about enabling "advanced profiling" feature in AS 3.0, if you've done so just disable it:

    • Go to "Edit Configurations...",
    • Select your app configuration under "Android App",
    • Then go "Profiling" tab and
    • Uncheck "Enable advanced profiling"

    Problem should be gone.