Using PreferenceScreen with applicationIdSuffix

前端 未结 3 625
情歌与酒
情歌与酒 2021-01-13 06:05

I\'m having some problems making PreferenceScreen and applicationIdSuffix work together.

Supposing my app package/applicationId

3条回答
  •  逝去的感伤
    2021-01-13 06:32

    Your confusion comes from the fact that applicationIdSuffix only changes the package name of the application (its unique id), but does not change the java package name of your classes inside the application, including your Activity.

    This means that you should declare in your preferences:

    android:targetClass="com.myapp.activities.AboutActivity"
    android:targetPackage="@string/packagename"
    

    Where targetClass is always the same, while targetPackage depends on your build type and can be com.myapp or com.myapp.dev.

提交回复
热议问题