2017-03-02 1 views
0

J'ai une saveur et une base de code principale. Je peux passer à la saveur et le projet s'exécute, et je peux revenir à la base de code principale et le projet s'exécute, mais aucun de ces projets affichera des icônes. Je ne sais pas pourquoi, ma seule hypothèse est que quelque chose ne va pas avec mes déclarations et les attributs ajoutés à l'intention de FilerSaveur AndroidManifest.xml en conflit avec le principal AndroidManifest.xml, aucune icône lors de l'installation

saveur AndroidManifest.xml

<application 
    android:name="com.example.flavor.application.MyApplication" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/CustomAppTheme" 
    tools:replace="android:name"> 

    <!-- main launcher Activity --> 
    <activity 
     android:name="com.example.flavor.activity.RegistrationActivity" 
     android:configChanges="orientation|screenSize" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:theme="@style/CustomAppTheme" 
     android:windowSoftInputMode="adjustResize"> 
     <intent-filter> 
      <action android:name="com.example.flavor.activity.RegistrationActivity"/> 
      <action android:name="android.intent.action.MAIN"/> 
      <action android:name="android.intent.action.VIEW"/> 

      <category android:name="android.intent.category.LAUNCHER"/> 
      <category android:name="android.intent.category.DEFAULT"/> 
      <category android:name="android.intent.category.BROWSABLE"/> 

     </intent-filter> 
    </activity> 

</application> 

principal AndroidManifest .xml

<application 
    android:name="com.example.application.MyApplication" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:supportsRtl="true" 
    android:theme="@style/CustomAppTheme" 
    tools:replace="android:name"> 

    <!-- main launcher Activity --> 
    <activity 
     android:name="com.example.activity.RegistrationActivity" 
     android:configChanges="orientation|screenSize" 
     android:label="@string/app_name" 
     android:screenOrientation="portrait" 
     android:theme="@style/CustomAppTheme" 
     android:windowSoftInputMode="adjustResize"> 
     <intent-filter> 
      <action android:name="com.example.activity.RegistrationActivity"/> 
      <action android:name="android.intent.action.MAIN"/> 
      <action android:name="android.intent.action.VIEW"/> 

      <category android:name="android.intent.category.LAUNCHER"/> 
      <category android:name="android.intent.category.DEFAULT"/> 
      <category android:name="android.intent.category.BROWSABLE"/> 

     </intent-filter> 
    </activity> 

</application> 

Mon build gradle est configuré comme suit

productFlavors { 
    standard { 
     applicationId 'com.example' 
     manifestPlaceholders = [package_name: "com.example", primary_lang: "en"] 
     signingConfig signingConfigs.keystore 
    } 
    legacyTest { 
     applicationId 'com.example.flavor.test' 
     manifestPlaceholders = [package_name: "com.example.flavor.test", 
           target  : "Test", primary_lang: "en"] 
     signingConfig signingConfigs.keystore 
    } 
} 

La classe RegistrationActivity est différente pour la saveur et la base de code principal. Il n'y a pas de dépassement, et je crois que puisque j'utilise un paquet différent, ils agissent effectivement comme des classes différentes, ce que je veux. Mais ma question est, comment se fait-il qu'avec la fusion Manifest, je ne puisse pas avoir des icônes d'application séparées, mes icônes de saveur et mes icônes d'application principales? Rien n'est affiché. Merci d'avance

Répondre

0

OK, c'est ainsi que j'ai configuré mes filtres d'intention. Je devais les séparer dans la structure suivante

saveur AndroidManifest.xml

<intent-filter> 
      android:name="com.example.flavor.activity.RegistrationActivity" 
      <action android:name="android.intent.action.MAIN"/> 
      <category android:name="android.intent.category.LAUNCHER"/> 
     </intent-filter> 

     <intent-filter> 
      <action android:name="android.intent.action.VIEW"/> 

      <category android:name="android.intent.category.DEFAULT"/> 
      <category android:name="android.intent.category.BROWSABLE"/> 
     </intent-filter> 

principal AndroidManifest.xml

<intent-filter> 
      android:name="com.example.activity.RegistrationActivity" 
      <action android:name="android.intent.action.MAIN"/> 
      <category android:name="android.intent.category.LAUNCHER"/> 
     </intent-filter> 

     <intent-filter> 
      <action android:name="android.intent.action.VIEW"/> 

      <category android:name="android.intent.category.DEFAULT"/> 
      <category android:name="android.intent.category.BROWSABLE"/> 
     </intent-filter> 

Je ne comprends pas les raisons techniques pour lesquelles ce format fonctionne, mais tout regroupement Dans le cas d'un filtre d'intention, des problèmes peuvent survenir, tels qu'une erreur lors de l'exécution ou aucune icône d'application. Cheers