how to handle multiple application classes in android

后端 未结 2 1316
名媛妹妹
名媛妹妹 2020-11-28 10:30

I am developing a native android application, in which I am trying to use 2 open-source libraries. Problem is both the libraries are using Applicati

相关标签:
2条回答
  • 2020-11-28 10:54

    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. See this link: http://developer.android.com/guide/topics/manifest/manifest-intro.html#filec

    0 讨论(0)
  • 2020-11-28 11:19

    You need to implement Multilevel inheritance to resolve this scenario.

    This is your scenario

    public Lib1Application extends Application{
    
    }
    
    public Lib2Application extends Application{
    
    }
    
    public YourApplication extends Application{
    
    }
    

    How to resolve this?

    public Lib1Application extends Application{
    
        }
    
        public Lib2Application extends Lib1Application{
    
        }
    
        public YourApplication extends Lib2Application{
    
        }
    

    finally in mainfest.xml

    <application
            android:name="com.your.packagename.YourApplication"
            android:icon="@drawable/ijoomer_luncher_icon"
            android:label="@string/app_name"
     >
    
    0 讨论(0)
提交回复
热议问题