cannot access DialogStyle

前端 未结 7 2432
南旧
南旧 2021-02-12 04:10

After updating android-support library to 22.2.0 project stopped compiling.

error: cannot access DialogStyle
  class file for android.s         


        
7条回答
  •  执念已碎
    2021-02-12 04:11

    Here is a couple workarounds that worked for us:

    Workaround 1 (some people see a NPE with this, some don't)

    I just found a TEMPORARY workaround... till appcompat fixes this issue:

    1. Create the following package in your project src/main/java

    android.support.v4.app

    1. Create the following new file:

    DialogFragment$DialogStyle.java

    1. Contents

      package android.support.v4.app;

      // todo remove this file when fixed in appcompat (https://code.google.com/p/android/issues/detail?id=175086)

    public @interface DialogFragment$DialogStyle { }

    Workaround 2 (bit more ugly, but less potential for a build issue)

    I found another work-around.... a bit more ugly... but has gotten us around this issue (including the NPE on the above work-around) till appcompat 22.2 is fixed.

    1. Create the following package in your project src/main/java

    android.support.v4.app

    1. Copy the Google v4 FragmentDialog.java code

    https://android.googlesource.com/platform/frameworks/support/+/refs/heads/master/v4/java/android/support/v4/app/DialogFragment.java

    1. Rename the class (to something like TempFragmentDialog). You will get a "Duplicate" class error if you don't rename the class.

    2. Any FragmentDialog, in your project, that has @Inject will need to extend your copy of the FragmentDialog (example: public class MyFragmentDialog extends TempFragmentDialog)

提交回复
热议问题