Reputation: 452
I have MyApplication.java class that extends Application but when i use a library .aar that also have a Global.Java class extends Application. I have update my menifest file with
<application
android:name=".activity.MyApplication"
But have got following error:
Caused by: java.lang.ClassCastException: com.xxx.xxx.activity.MyApplication cannot be cast to com.xxx.utils.GlobalClass
Is there anyone who face the same? please help.
Upvotes: 0
Views: 523
Reputation: 3026
Even if you have two classes which extends from application you can only specify one of them under the application tag. Hence answer to your original question, you cannot have two application classes actually.
To solve your problem you can extend from GlobalClass, your problem would be solved because Global class is inheriting from Application and you are inheriting from GlobalClass.
MyApplication IS-A GlobalClass
GlobalClass IS-A Application
Hence MyApplication IS-A Application.
Upvotes: 1
Reputation: 3339
According to documentation manifest file with only one application element is valid.
Only the and elements are required, they each must be present and can occur only once.
Upvotes: 1