Whether it is possible to change the Android manifest attribute dynamically?

空扰寡人 提交于 2021-02-18 19:09:40

问题


I need the set the Application attribute dynamically in android , particularly i need set the Name field which is shown below , i need to change it dynamically because i import two library packages each package will contain two different Application class to maintain session variable,but i can able to use any one Application class in imported project, i need to use that both dynamically based on the package user going to use, for that i need to set and change the Application class Name dynamically in Android Manifest.xml file. enter image description here

if any one knows the solution means help me out.

Thanks.


回答1:


Your manifest is within your apk, which is signed, so changing it dynamically would invalidate the whole package. My guess is dynamically changing the manifest is not possible.




回答2:


I also agree Once your Apk is Created it contains your manifest file.And the manifest contains all information about the application,So it is not possible




回答3:


We can't change manifest attribute dynamically

When an app installs, system first checks and collects the manifest file to get all the information about the app like permissions, activities, services, broadcast receivers, content providers.. etc, and based on that info the system reacts to the app in future.

For Example: if some app has request the system to perform some ACTION then the system knows that certain app has an activity that could deal with the ACTION, likewise if a boardcast is fired system knows which app has the related boardcast receivers to notify.. etc

However if we somehow able to edit the manifest file dynamically then also it will be of no use as the system will be unaware of those changes cause it reads the app's manifest file first time only while installing..




回答4:


I agree with K-ballo ..I am not sure i got exactly what your problem is,but i worked on Android before and i am pretty sure that there is no way you are allowed to change the manifest dynamically.so its better if you find a new solution to deal with your problem :)



来源:https://stackoverflow.com/questions/7357619/whether-it-is-possible-to-change-the-android-manifest-attribute-dynamically

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