Android Manifest with @String link - specifically Android: power

I have this issue with the manifest.

Looks like it could be a hoax: Using @string for android: permissions in ContentProvider

I have a provider with separate permissions for different versions of the application (so I can store different permissions in the string folders of the res res difference folders in different versions).

My manifest is as follows:

<provider android:authorities="@string/app_provider_auth" android:name="com.mecompany.myapp.provider.CachedFileProvider"/> 

NOW, this works great, but I see the Bad Manifest problem when it is installed on an OS 2.1 device. This problem is that when I change it to a text string, it works fine on 2.1.

I understand that in 2.1 (7) or earlier, the manifest does not allow references to strings from resource files. So, can I create a separate manifest for version 7-, can I have an if statement in the manifest? or do I need to raise minSDK (last resort)?

UPDATE:

OK on further searches it seems that I can set / switch the auth line of the provider using my Maven assembly. I already have several profiles and I redefine the resource folders. Therefore, I like this idea, but I cannot omit it. something like

 <replaceAuthority>${customerauthority}<replaceAuthority> 

However, I do not know what the tag is that I should use, or, if I suggested above, this is the way I need to go.

+2
android string resources manifest
Oct 25
source share
2 answers

To change the provider from maven, you can use the <providerAuthorities> , as here:

  <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <version>3.5.0</version> <extensions>true</extensions> <configuration> <!--     --> <manifest> <versionName>${project.version.name}</versionName> <versionCode>${project.version.code}</versionCode> <!--  --> <providerAuthorities> <property> <name>.database.DatabaseProvider</name> <value>${project.package}.database.DatabaseProvider</value> </property> </providerAuthorities> </manifest> </configuration> </plugin> 
+3
Apr 12 '13 at 6:15
source share

With more help from here, android-maven-plugin and resource filtering

here https://github.com/jayway/maven-android-plugin/pull/115

and @ Konstantin Pridluda, I came to an acceptable conclusion.

What I did was create a new folder in the parent folder of the project called manifestests. Then two subfolders are created: customer1Manifest and customer2Manifest

Inside each of these folders, I made a copy of the manifest file, and then replaced the @string link with the corresponding hard string permissions. (the normal manifest file is the debug version)

Then, in POM, I disabled manifests for matching ones like this.

 <profiles> <profile> <id>Customer1</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <customerManifest>../manifests/customer1Manifest/AndroidManifest.xml</customerManifest> </properties> </profile> <profile> <id>Customer2</id> <properties> <customerManifest>../manifests/customer2Manifest/AndroidManifest.xml</customerManifest> </properties> </profile> </profiles> 

and then in the Android-maven-plugin phase this

  <plugin> <groupId>com.jayway.maven.plugins.android.generation2</groupId> <artifactId>android-maven-plugin</artifactId> <extensions>true</extensions> <inherited>true</inherited> <configuration> <androidManifestFile>${customerManifest}</androidManifestFile> ......... ....... </configuration> </plugin> 
+1
Oct 26
source share



All Articles