Android Manifest: action package still need to be under main apk package?

I am coming to a large existing Android project. The manifest looks something like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.company.group1.package1"> <application ... > <activity android:name="com.company.group1.MyActivity /> <service android:name="com.company.group2.blah.MyService" /> <provider android:name="com.company.group3.etc.MyProvider" /> ... more fully-qualified activities ... </application> </manifest> 

Basically, entities are ubiquitous in terms of packages and fully qualified. Of course, this breaks all kinds of filming, but somehow everything is fine. I tried to find an expression from Google that this was a bad idea, but I did not find any official recommendation against it or whatever problems it caused.

Renaming the com.company package is not a good option because the company has several applications.

My question is: is there any reason, besides the convention, to organize the project in a more reasonable way? I expect pushback from mass renaming due to issues with version control history and something else.

+4
source share
1 answer

No, the action name should not be under the main apk package. For example, you can specify an action that is defined in an external bank that uses a completely different package name.

The actual requirement according to the AndroidManifest.xml documentation is that the action name must be a fully qualified class name.

However, as the document continues to indicate, in most cases there is an abridged version in which you do not need to specify the full class name all the time. And this, preceding the name with .. (i.e. <activity android:name=".MyActivity /> ")

+3
source

Source: https://habr.com/ru/post/1393013/


All Articles