Sunday, 22 March 2020

Importance of Android manifest file

Every project in Android includes AndroidManifest.xml, file which is stored in the root directory of its project hierarchy. The manifest file is an important part of our application because it defines the structure and metadata of our application, its components, and its requirements.
This file includes nodes for each of the Activities, Services, Content Providers and Broadcast Receiver that make the application and it also includes  Intent Filters and Permissions, which determines how activities co-ordinate with each other and other applications.
The manifest file also specifies the application metadata, which includes its icon, version number, themes etc.
A  manifest node looks like:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pkg.myapp"
android:versionCode="1"
android:versionName="0.9 Beta"> 
[....manifest nodes....] 
</manifest> 
uses-sdk– It is used to define a minimum and maximum SDK version that must be available on a device so that our application function properly, and target SDK for which it has been designed .


<uses-sdk android:minSdkVersion=”6”
        android:targetSdkVersion=”15”/>

application– A manifest can contain only one application node. It uses attributes to specify the metadata for your application (including its title, icon and theme). During development we should include a debuggable attribute set to true to enable debugging, then be sure to disable it for your release builds.

<application android:icon="@drawable/icon"
             android:theme="@android:style/Theme.Light"
             android:name=".MyApplicationClass"
             android:debuggable="true">
             [....application nodes.....]

</application>

What are apk files and how to deploy apk files

Apk Files:An Android Package Kit (APK for short) is the package file format used by the Android operating system for distribution and installation of mobile applications. Just like Windows (PC) systems use an .exe file for installing software, the APK does the same for Android.

Once your Android application is signed, you can deploy it to emulators and devices using the adb.exe (Android Debug Bridge) tool (located in the platform-tools folder of the Android SDK).
Using the command prompt in Windows, navigate to the <Android_SDK>\platform-tools folder. 
To install the application to an emulator/device (assuming the emulator is currently up and running or a device is currently connected), issue the following command:
adb install "C:\Users\abc\Desktop\Practical1.apk"