DialogFragment$DialogStyle not found workaround

Here is a workaround if you’re getting the error: android.support.v4.app.DialogFragment$DialogStyle not found while using something like Androidannotations or Dagger.

In the support library 22.2 is an inner annotation in DialogFragment. Because of this you’re getting an error while using something like Androidannotations or Dagger. This bug is already reported to Google: https://code.google.com/p/android/issues/detail?id=175086

The workaround I use is from jeffdcamp from a Dagger 2 issue thread:

  1. Create the following package in your project src/main/java: android.support.v4.app

  2. Copy the DialogFragment.java class from Google into the created package and rename it (e.g. TempDialogFragment.java) otherwise you will get a duplicate class error.

  3. Rename any class in your project which extends from DialogFragment and let it extend from the created TempDialogFragment.

Source: https://github.com/google/dagger/issues/197