多个应用程序的Andr​​oid:在清单名称标签 [英] Multiple application android:name tags in manifest

查看:193
本文介绍了多个应用程序的Andr​​oid:在清单名称标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的两个库(糖ORM和Instabug)。他们都要求我使用android:应用程序的名称标记在我的清单。然而,似乎你不能有duplicates.Is有没有解决这个办法吗?

I am using two libraries(SUGAR ORM and Instabug). They both require me to use the android:name tag of the application in my manifest. However, it seems you cannot have duplicates.Is there a way around this?

我的清单:

 <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:icon="@drawable/runrouter_biggest"
        android:theme="@style/MyTheme"
        tools:replace="android:icon"
        android:name="com.orm.SugarApp"
        //I need to declare a second android:name here>

谢谢,
马特

Thanks, Matt

推荐答案

您似乎是出于运气。你只能有一个应用程序类的实例,所以你只能指定一个的android:名称

You seem to be out of luck. You can have only one instance of application class so you can specify only one android:name there.

不过,你其实并不出于运气。 Instabug不要求你使用他们的应用程序类,所有他们需要的是调用 Instanbug.initialize( ...)... ,你可以很容易地做到从 SugarApp 派生的应用程序类:

However, you are actually not out of luck. Instabug does not require you to use their application class, all they need is to call Instanbug.initialize(...)... which you can easily do in your application class derived from SugarApp:

class MyApplication extends SugarApp
{
    @Override
    void onCreate()
    {
        super.onCreate();
        Instabug.initialize(this)
            .setAnnotationActivityClass(InstabugAnnotationActivity.class)
            .setShowIntroDialog(true)
            .setEnableOverflowMenuItem(true);
    }
}

和定义此应用程序的Andr​​oid类:名称

这篇关于多个应用程序的Andr​​oid:在清单名称标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆