Is versionCode/versionName required in library manifest? - android

Below is a manifest of one of my library projects. Currently I increase the versionCode and versionName with every change. Is that required?
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="preferExternal"
android:versionCode="14"
android:versionName="1.1.7"
package="com.tubala.android" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="11" />
</manifest>
Thanks in advance.

Currently AndroidManifest.xml of Android Library is completely ignored when building application that uses this library. The only thing that is used by aapt tool is package attribute (to generate R class into correct package).
This might be changed in next releases. But I'd say you should keep your versioning anyway. This is a good practice (even if build tools are ignoring it).

android:versionName attribute is not necessary. It's just a version users see when they open your application information in the application manager.
android:versionCode is more important. You must increase it every time you publish your application on the Android Market.

Related

Play Install Referrer Library Adding WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions

We are trying to update Google Play Install Referrer Library and
Internally it's adding some external read write permissions.
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Do we really need to stick with the permissions ?
dependency implementation 'com.android.installreferrer:installreferrer:1.1
Source https://developer.android.com/google/play/installreferrer/library.html
Install referrer adds this permission due to the fact that the targetSdkVersion is a value lower than the version in which the restriction was added.
If you take a look at generated manifest-merger-report in the build folder of your app, you can see this information:
uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from android/app/src/main/AndroidManifest.xml:1:1-130:12 reason: com.android.installreferrer has a targetSdkVersion < 4
Information on how this implicit system permission works on Android can be found in this documentation :
https://developer.android.com/studio/build/manifest-merge#inspect_the_merged_manifest_and_find_conflicts
Quoting from this answer (and completing):
Version 1.1 and 1.1.1 are missing "minSdkVersion". This would automatically add those permissions (because the default SDK < 4 as said by #thiagolr). See similar issue here: Google Play Services 12.0.1.
Solution
Version 1.1.2 solves this issue.
Details
Manifest.xml for v1.0 (from https://mvnrepository.com/artifact/com.android.installreferrer/installreferrer/1.0)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.installreferrer" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="22" />
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
<application />
</manifest>
Manifest.xml for v1.1 (from https://mvnrepository.com/artifact/com.android.installreferrer/installreferrer/1.1)
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.installreferrer">
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE" />
<application />
</manifest>
I've also come across this issue.
But in my case, the 1.1 version is also adding the READ_PHONE_STATE permission
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
I've decompiled the .aar file for installreferrer:1.1 and checked the manifest and pom file, there is nothing in those files to indicate that these permissions should be added.
The library manifest file only adds this permission (which is always has in previous versions):
<uses-permission android:name="com.google.android.finsky.permission.BIND_GET_INSTALL_REFERRER_SERVICE"/>
I haven't been able to find any official information regarding this.
But other Google libraries have had issues in the past with adding additional, unneeded, permissions, which have then been removed in a hotfix version shortly after.
For example, this:
Why has the READ_PHONE_STATE permission been added?
So i hope the same is gonna happen here.
Edit: Solution: Version 1.1.2 (and above) solves this issue.
From this answer:
This is because they have added a dependency to
com.google.android.gms:play-services-measurement:17.2.1
Which adds those permissions.
You can find it on the file: manifest-merger-blame-debug-report.txt which is under "yourApp/build/intermediates/manifest_merge_blame_file/debug"
It's a bug. Also, installreferrer 1.1.1 doesn't solve it.
Solution:
Update to installreferrer 1.1.2 or any version above (current version is 2.1`)
Obsolete:
Easiest solution is to downgrade installreferrer back to 1.0 for now.
But if you need this version, you can add:
<uses-permission android:name="<permission_name>" tools:node="remove" />
To disable it.
But know that if you'll use any API which needs it inside the library, it could lead to a crash, so I won't recommend doing so.
These permissions are added because com.android.installreferrer has a targetSdkVersion < 4. You can see it on the manifest-merger-release-report.txt file located on Temp\gradleOut\build\outputs\logs folder inside your project. This is a bug and it will probably be fixed on a newer version.
In order to fix this, you need to find out which plugin is adding com.android.installreferrer as dependency.
In my project, the culprit was the Facebook plugin. It uses the com.facebook.android:facebook-core:5.15.x package which is responsible for adding the com.android.installreferrer:installreferrer:1.1 dependency.
The solution was to rollback to com.facebook.android:facebook-core:5.13.0, which doesn't have a com.android.installreferrer dependency.
Edit the file FacebookSDK/Plugins/Editor/Dependencies.xml and change these packages to:
<androidPackage spec="com.facebook.android:facebook-core:[5,5.13.0)" />
<androidPackage spec="com.facebook.android:facebook-applinks:[5,5.13.0)" />
<androidPackage spec="com.facebook.android:facebook-login:[5,5.13.0)" />
<androidPackage spec="com.facebook.android:facebook-share:[5,5.13.0)" />
Next, don't forget to resolve the dependencies again: Assets > Play Services Resolver > Android Resolver > Force Resolve
1.1.2 is released, it adds minSdkVersion correctly.
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="22" />
One could theoretically remove them altogether with the manifest-merger:
<manifest
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
</manifest>
But if the library will then still work as expected is another story -
it's rather an exception, that a Google library requires unnecessary permissions.
The release notes and the documentation do not mention permissions.

App in Google Play Store (Beta-Test) says "App not compatible with your devices"

i have written an android app with xamarin.android in visual studio and compiled a release build for android 4.1 and higher. testing directly with my devices works without problems.
after building an apk and uploading it in the play store for a beta test, it says: "app not compatible with your devices". i am pretty sure, that my test devices are not the problem. what could it be??
here is my manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="xxx" android:versionCode="1" android:versionName="1.1" android:installLocation="auto">
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<application android:label="alone" android:icon="#drawable/Icon"></application>
</manifest>
on developer interface it says 10106 supported devices:
any ideas? thanks for your help...
best regards from germany,
steven
I dont use xamarin , but using studio if your gradle hava a different min sdk it will overwrite whatever os on you manifest , check your gradle file .

Change android apk version with appcelerator

when i try to update my alpha release i receive the error that i need to change my apk version. But how can i do that? my android manifest:
<android xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.1">
<manifest>
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23"/>
<application>
<activity android:configChanges="keyboardHidden"
android:name="org.appcelerator.titanium.TiActivity" android:screenOrientation="portrait"/>
<activity android:configChanges="keyboardHidden" android:name="ti.modules.titanium.ui.TiTabActivity"/>
</application>
</manifest>
</android>
Ah, you talk about APK version, not about Android SDK. The solution is simple. You need to change the version at a couple places.
Change the version tag with at least the 3rd number (patch) increased
<version>1.0</version>
Can become
<version>1.0.1</version> or <version>1.1</version>
Next, you also need to change the part in the android manifest
<manifest android:versionCode="1"
android:versionName="1.0.1" package="com.example.app"
xmlns:android="http://schemas.android.com/apk/res/android">
Increase version code every time, can be same as version, in my example 101 for example. Or just a build number (1, 2, 3, etc)
Versionname should be the same as the version in the version tag. Also don't forget to put your app ID in the same code ;)
In TiApp.xml add version code and version name to manifest
<manifest android:versionCode="1" android:versionName="1.0">
Google is mainly complaining about version code so check that and increase by one. These settings will override the version of the app specified in the tag for android
Each APK you submit to Google Play must have a unique, incremental build version, which on Android is android:versionCode.
Titanium will use the <version> tag in tiapp.xml to set the release version which on Android is android:versionName.
To set the build version you need to add/use a <manifest> element under the <android> element in tiapp.xml like this:
<android>
<manifest android:versionCode="1">
..
</manifest>
</android>
The 4.1.0 Sample included a Gruntfile.js to easily increment the iOS and Android build versions. It can even bump the major, minor or patch release version for you.
Please read the blog post on versioning your apps with Titanium 4.1.0 and later for more information.
you also have to increment
<version>1.1</version>

Does an Android Library need a manifest ,app_name,Icon?

I have an android Library that outputs an aar library. This library will be built into different projectFlavors of Mobile, TV and Wear apps. I think that each of these platforms' should be the ones that set variables like the app name, icon, and permissions through the manifest and productflavors.
Is there any way to build an AAR without requiring an AndroidManifest.xml and therefore drawables(for the icon)?
More information about what I'm doing can be found at my last question on the subject:
Android Studio Java Library Module vs. Android Library Module
Any android library needs to have an AndroidManifest.xml file, but a name or an icon is not required. It's only needed when there is an activity that is MAIN and LAUNCHER.
You simply could use this manifest and your library will work like a charm.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="[your package]"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="[min supported version]" />
<application/>
</manifest>
You can go with the AndroidManifest.xml below if you don't need to setup any Android component like Activities or Services or add custom properties.
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.your.library.base.package" />

How to set Android version in Eclipse?

I've written a first app for Android with Eclipse. I've published it but I'm noticing that on the app page it doesn't show the Android minimum version supported, you can see it here:
https://market.android.com/details?id=com.yellowhouse.everydayquotes
I've searched in the project files and I've found that in project.properties there is the following line:
target=android-15
is that the correct place to set the Android version? Am I missing something? Why does it not appear on the page? Thanks.
the "target=android-15" that you have is for your emulator or your test device which you want to launch your app with
To answer to your question, you need to set the minSDK version in your android manifest file
like that
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tfe.rma.ciss.be"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="8" />
</manifest>
To set the minimum required android version for your app, you need to use uses-sdk element inside your AndroidManifest.xml file:
<manifest ...>
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="7"/>
...
</manifest>
Version 4 means Android 1.6. Read up information on android manifest to see the correct sdk version numbers: http://developer.android.com/guide/topics/manifest/uses-sdk-element.html

Categories

Resources