SupportMapFragment does not support AndroidX Fragment

后端 未结 10 1602
傲寒
傲寒 2020-11-30 11:04
import com.google.android.gms.maps.SupportMapFragment;
import androidx.fragment.Fragment;
...
private SupportMapFragment mMapFragment;
...
mMapFragment = (SupportMap         


        
10条回答
  •  臣服心动
    2020-11-30 11:22

    Finally, here is the perfect answer:

    1. Add

      android.enableJetifier=true
      android.useAndroidX=true
      

      to your gradle.properties file.

    2. With Android Studio 3.2 or higher, migrate your project to AndroidX by selecting Refactor > Migrate to AndroidX from the menu.

    3. (Most important) Some of your project imports (used in classes) will need to be replaced by equivalent AndroidX libraries. Here you can find libraries and their equivalents. Replace any imports that refer to pre-AndroidX libraries one-by-one.

    Now you're good to go :-)

提交回复
热议问题