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



我在清单中添加了第一个继承的类

<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继承类,因为我必须使用两个应用程序继承类。

不幸的是,<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"
>

相关内容

最新更新