Multiple application android:name tags in manifest

2019-02-18 06:57发布

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?

My manifest:

 <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

1条回答
聊天终结者
2楼-- · 2019-02-18 07:45

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.

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);
    }
}

And define this application class in android:name.

查看更多
登录 后发表回答