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

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" />

Related

androidTest AndroidManifest.xml ignored

I have the same issue mentioned in this post AndroidTest Manifest permission not detected
and this post AndroidManifest in androidTest directory being ignored
--> If I put the test manifest in androidTest, debugAndroidTest, androidTestDebug, it never gets picked up and merged.
the answers about putting the AndroidManifest.xml in the debug folder are correct; that does seem to work. (put the test manifest in src/debug
What I want to know is why can't you put it in the androidTest directory? All the documentation I've read while trying to figure this out makes it sound like you should be able to, and that if you can't then I'm thinking that sounds like some bug in the manifest merger.
For what it's worth, I'm using Android Studio
That is correct and totally agree with you on the confusing documentation. The AndroidManifest.xml under androidTest* source sets would be packaged for the instrumentation APK that does your tests on your actual app APK. If you open the generated APKs for debug and androidTest under build/outputs/apk/ after compiling your app module with the command gradlew assembleDebugAndroidTest (assuming that you haven't changed the testBuildType in you build.gradle, more info here), you'll find that any AndroidManifest.xml configuration added under androidTest will be in the androidTest APK and not in your debug app APK.
And also as you said, in case you need test specific configurations like extra permissions, you'll have to place them in the AndroidManifest.xml under the debug source set instead of main, hence they'll only be available for testing your app but not in your release build. Of course you can always double check by opening the generated APKs after compiling to make sure that the configuration is right for each build variant.
If you need to add extra permissions for tests, you can do it.
You should set the same android:sharedUserId in default AndroidManifest.xml and androidTest/AndroidManifest.xml.
For example:
AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:sharedUserId="com.yourpackagename.uid">
<application
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:replace="android:allowBackup">
</application>
</manifest>
androidTest/AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:sharedUserId="com.yourpackagename.uid">
<uses-permission android:name="android.permission.***" />
</manifest>
For details: https://stackoverflow.com/a/14196493/3901000

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>

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

Sharing application in facebook and twitter in android

In my application there is 1 functionality for sharing the my application link from markrt.
But problem is that how could i get the link of my application on android market before
submiting the my application to the market...
Its very much easy, just look at below link:
https://market.android.com/details?id=YourPackageName
Where YourPackageName is the name of package of your application.
FYI, Generally android application is uploaded on market with the package name, which must be unique in any case.
For example:
https://market.android.com/details?id=com.facebook.katana , here com.facebook.katana is the main package declared in the AndroidManifest.xml file with package:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.facebook.katana"
android:versionCode="1"
android:versionName="1.0" >
Usually the android market follows the app link as with what you've mentioned in your android manifest.xml
For Eg.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.company.testing.app"
android:versionCode="1"
android:versionName="1.0"
>
will be like this. But ensure the package you ve chosen is available in android market.
https://market.android.com/details?id=com.company.testing.app&hl=en

Is versionCode/versionName required in library manifest?

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.

Categories

Resources