I have an old android app that uses the apache legacy Http library (org.apache.http.legacy). After the changes on Android 6, I was able to keep the app working including the
So after further troubleshooting found out that issue was due to a third party library (activeandroid). Library was using reflection to check all classes available in the classpath and for some reason the legacy apache HTTP classes conflicted when calling java.lang.Class.classForName. Skipped the reflection code and app worked as expected. On versions below Android 9 this is not an issue though.
So correct way is as per documentation using: . If you come across random exceptions check you are not using reflection to try to traverse the legacy HTTP classes.