AndroidManifest.xml with multiple application tags

烈酒焚心 提交于 2019-12-04 06:34:10

What I think you want is to use your custom Application as the main Application.

So you dont add a new <application> but just specify its name to the main <application>(you need to specify its full package).

<application android:icon="@drawable/icon" android:label="@string/app_name" android:name:"com.mypackage.MyApp"> <!-- Added the android:name -->
    <activity android:name=".MainActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="Result" android:label="@string/app_name">        </activity>
</application>

See info here

Marcin Pietraszek

According to documentation manifest file with only one application element is valid.

Only the <manifest> and <application> elements are required, they each must be present and can occur only once.

Only the 'manifest' and 'application' elements are required, they each must be present and can occur only once. Most of the others can occur many times or not at all — although at least some of them must be present for the manifest to accomplish anything meaningful.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!