How to check if a (possibly obfuscated) class exists without displaying in logs

I am trying to check if a class exists at runtime.

Usage is Class.forName( "com.class.Name" );

not an option, as the class I want to test might be obfuscated using proguard.

Another option is to use a block try-catch(NoClassDefFoundError)

and try to access the actual class, but this results in the following logs:

  • art: Rejecting re-init on previously-failed class

    in newer os versions with ART - which I was able to avoid by executing Class cls = CheckedClass.class

    surrounded by a try-catch

    different method.

  • dalvikvm: Could not find class...

    on older os versions using dalvik which I haven't figured out yet how to avoid. Any thoughts?

+3


source to share





All Articles