如何在清单中添加应用程序名称

时间:2018-05-30 04:32:23

标签: android

我在清单

中添加了第一个继承的类
    <application
    android:name=".GlobalApplication"
    android:networkSecurityConfig="@xml/network_security_config"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar">

我想添加第二个应用程序ModelViewerApplication.class继承的类,因为我必须使用两个应用程序继承的类。

1 个答案:

答案 0 :(得分:1)

不幸的是<application>不支持多个Application类。如果您想要添加第二个类Application,那么您可以做的最好是:

public class SecondClass extends GlobalApplication {
...
}

在你的清单中

<application
    android:name=".SecondClass"
    android:networkSecurityConfig="@xml/network_security_config"
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"
    >