react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/Outline

Open bennyguitar opened this issue 10 years ago • 15 comments

Info:

  • ReactNative: 0.30
  • Platform: Android
  • Device: Nexus 5
  • Android OS: 4.4.2
  • Rooted: true

Problem:

The problem, as I see it, is that android.graphics.Outline was introduced in Lollipop 5.0 and it is used in ReactViewBackgroundDrawable.java as an import and as a method parameter. So OSs less than this will crash when this is hit.

StackTrace:

Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/Outline
       at java.lang.Class.getDeclaredMethods(Class.java)
       at java.lang.Class.getDeclaredMethods(Class.java:656)
       at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960)
       at android.view.ViewDebug.exportMethods(ViewDebug.java:1047)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997)
       at android.view.ViewDebug.exportFields(ViewDebug.java:1175)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:996)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983)
       at android.view.ViewDebug.dumpView(ViewDebug.java:900)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:855)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dump(ViewDebug.java:793)
       at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416)
       at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258)
       at android.view.IWindow$Stub.onTransact(IWindow.java:65)
       at android.os.Binder.execTransact(Binder.java:404)
       at dalvik.system.NativeStart.run(NativeStart.java)
Caused by java.lang.ClassNotFoundException: Didn't find class "android.graphics.Outline" on path: DexPathList[[zip file "/data/app/com.curse.highwind-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.curse.highwind-1, /vendor/lib, /system/lib]]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
       at java.lang.Class.getDeclaredMethods(Class.java)
       at java.lang.Class.getDeclaredMethods(Class.java:656)
       at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960)
       at android.view.ViewDebug.exportMethods(ViewDebug.java:1047)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997)
       at android.view.ViewDebug.exportFields(ViewDebug.java:1175)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:996)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983)
       at android.view.ViewDebug.dumpView(ViewDebug.java:900)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:855)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dump(ViewDebug.java:793)
       at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416)
       at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258)
       at android.view.IWindow$Stub.onTransact(IWindow.java:65)
       at android.os.Binder.execTransact(Binder.java:404)
       at dalvik.system.NativeStart.run(NativeStart.java)

bennyguitar avatar Jul 29 '16 18:07 bennyguitar

+1

Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/Outline
       at java.lang.Class.getDeclaredMethods(Class.java)
       at java.lang.Class.getDeclaredMethods(Class.java:656)
       at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960)
       at android.view.ViewDebug.exportMethods(ViewDebug.java:1047)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997)
       at android.view.ViewDebug.exportFields(ViewDebug.java:1175)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:996)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983)
       at android.view.ViewDebug.dumpView(ViewDebug.java:900)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:855)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dump(ViewDebug.java:793)
       at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416)
       at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258)
       at android.view.IWindow$Stub.onTransact(IWindow.java:65)
       at android.os.Binder.execTransact(Binder.java:404)
       at dalvik.system.NativeStart.run(NativeStart.java)
Caused by java.lang.ClassNotFoundException: Didn't find class "android.graphics.Outline" on path: DexPathList[[zip file "/data/app/com.anibox-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.anibox-1, /vendor/lib, /system/lib]]
       at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
       at java.lang.Class.getDeclaredMethods(Class.java)
       at java.lang.Class.getDeclaredMethods(Class.java:656)
       at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960)
       at android.view.ViewDebug.exportMethods(ViewDebug.java:1047)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997)
       at android.view.ViewDebug.exportFields(ViewDebug.java:1175)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:996)
       at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983)
       at android.view.ViewDebug.dumpView(ViewDebug.java:900)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:855)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867)
       at android.view.ViewDebug.dump(ViewDebug.java:793)
       at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416)
       at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258)
       at android.view.IWindow$Stub.onTransact(IWindow.java:65)
       at android.os.Binder.execTransact(Binder.java:404)
       at dalvik.system.NativeStart.run(NativeStart.java)

BeckZero avatar Jul 31 '16 16:07 BeckZero

+1 also getting this on a Nexus 5 4.4.2 (surprisingly - also rooted)

sagivmalihi avatar Aug 01 '16 07:08 sagivmalihi

+1 on Nexus 5, React-native 0.31.0

tepamid avatar Aug 11 '16 06:08 tepamid

+1 on Nexus 5, 4.4.2 (also rooted) Fatal Exception: java.lang.NoClassDefFoundError: android/graphics/Outline at java.lang.Class.getDeclaredMethods(Class.java) at java.lang.Class.getDeclaredMethods(Class.java:656) at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960) at android.view.ViewDebug.exportMethods(ViewDebug.java:1047) at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997) at android.view.ViewDebug.exportFields(ViewDebug.java:1175) at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:996) at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983) at android.view.ViewDebug.dumpView(ViewDebug.java:900) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:855) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dump(ViewDebug.java:793) at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416) at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258) at android.view.IWindow$Stub.onTransact(IWindow.java:65) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(NativeStart.java) Caused by java.lang.ClassNotFoundException: Didn't find class "android.graphics.Outline" on path: DexPathList[[zip file "/data/app/com.flightly.twitterads-1.apk", zip file "/data/data/com.flightly.twitterads/code_cache/secondary-dexes/com.flightly.twitterads-1.apk.classes2.zip"],nativeLibraryDirectories=[/data/app-lib/com.flightly.twitterads-1, /vendor/lib, /system/lib]] at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) at java.lang.ClassLoader.loadClass(ClassLoader.java:497) at java.lang.ClassLoader.loadClass(ClassLoader.java:457) at java.lang.Class.getDeclaredMethods(Class.java) at java.lang.Class.getDeclaredMethods(Class.java:656) at android.view.ViewDebug.getExportedPropertyMethods(ViewDebug.java:960) at android.view.ViewDebug.exportMethods(ViewDebug.java:1047) at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:997) at android.view.ViewDebug.exportFields(ViewDebug.java:1175) at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:996) at android.view.ViewDebug.dumpViewProperties(ViewDebug.java:983) at android.view.ViewDebug.dumpView(ViewDebug.java:900) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:855) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dumpViewHierarchy(ViewDebug.java:867) at android.view.ViewDebug.dump(ViewDebug.java:793) at android.view.ViewDebug.dispatchCommand(ViewDebug.java:416) at android.view.ViewRootImpl$W.executeCommand(ViewRootImpl.java:6258) at android.view.IWindow$Stub.onTransact(IWindow.java:65) at android.os.Binder.execTransact(Binder.java:404) at dalvik.system.NativeStart.run(NativeStart.java)

yagottahavehart avatar Aug 11 '16 18:08 yagottahavehart

If you set multiDexEnabled true in android/app/build.gradle, modify MainApplication.java by the following

import android.support.multidex.MultiDexApplication;
public class MainApplication extends MultiDexApplication implements ReactApplication

oney avatar Aug 15 '16 21:08 oney

@oney Why does that fix the problem?

bennyguitar avatar Aug 15 '16 23:08 bennyguitar

@oney I tried that but I'm still getting the same crash. I'm also seeing it on a rooted Nexus 5 running 4.4.2.

cymen avatar Sep 02 '16 22:09 cymen

Still seeing this issue through our analytics and we're now on react-native 0.33.

bennyguitar avatar Sep 16 '16 20:09 bennyguitar

Still seeing this on 0.34

getreup avatar Sep 30 '16 14:09 getreup

I'm confused...ReactViewBackgroundDrawable imports and uses android.graphics.Outline. But android.graphics.Outline was only added in API level 21 (ie 5.0), according to: https://developer.android.com/reference/android/graphics/Outline.html

So in theory, this should break React Native on 4.x devices due to that import. However, the code was added back in RN 0.22, so I assume the code has been fine on Android: https://github.com/facebook/react-native/commit/b65f1f223488b52963f80a67bb41956103263d27

My crash is coming from a user who is running a root-ed Nexus 5 on 4.4.2. (Curious who your users are who also see this...) I'm guessing there might be some special debug mode enabled that is triggering ViewDebug.dispatchCommand calling DUMP, which is then triggering a full dump of all fields/properties (and triggering the load of Outline)

So my questions: Is there a way to blacklist certain methods/classes (such as Outline) from ViewDebug's dump, to let it run without crashing?

mikelambert avatar Oct 06 '16 10:10 mikelambert

also seeing this on a user with LGE Nexus 5, SDK Level 19, RN version 0.31

arilitan avatar Oct 08 '16 20:10 arilitan

So it seems everyone sees this on a rooted Nexus 5 4.4.2 (API level 19), one that has ViewDebug enabled. That seems like quite the awful coincidence, but whomever that rogue user is using all our different apps, I'm not too worried about them anymore. :)

My guess is that there is some automated system out there running all Android apps in their rooted debug environment, unintentionally breaking when attempting to run our React Native apps. Perhaps it's used for rendering screenshots, for interacting with apps-in-the-cloud, or maybe a grad student research project, or who knows what else.

mikelambert avatar Oct 10 '16 02:10 mikelambert

@lacker Wondering why this issue was closed. I'm getting the same crashes from a SM-G900R7, which is a Samsung Galaxy S5 running 4.4.2, which seems to be different from the device that has been listed above (all Nexus 5 running 4.4.2) so this is probably not limited to a certain device. It could be happening only on Android 4.4.2, but it's still an issue.

SuhairZain avatar Apr 08 '18 12:04 SuhairZain

@SuhairZain I also got an crash report for a SM-G900R7 (4.4.2). I will change my minimum Android level to 5.0 in next release. @mikelambert I also suspect this is some automated system because I got my crash just 2 hours after my apk upload.

RN 0.55.4

flyingxu avatar Jun 20 '18 08:06 flyingxu

Got crash report on Galaxy S5 (4.4.2) . RN 0.52

aman1arun avatar Jul 05 '18 10:07 aman1arun