How do you install an Apk and what does it look like afterwards?

1

I have a question about what happens with that apk file once installed if it remains as one or separated into fragments that make up the operation of the app. I'm asking this, because I want to make an app like linkSD2 that is responsible for moving the app and I do not know if it stays in that apk format or changes to another format or is divided into different fragments.

    
asked by PowerApp 15.10.2016 в 00:31
source

2 answers

2
  

I want to make an app like linkSD2 that is responsible for moving app

That you can move the application programmatically seems to me that it is not possible, but you can define the file AndroidManifest.xml of your application where the application would be installed, and if this only allows to be installed in the internal storage, this through the property :

android:installLocation

in which you can specify

  

"internalOnly" : if the application should only be installed on the   internal storage.

     

"auto" : if the application can be installed in storage   external (SD Card), but the operating system can install the application in the   internal storage by default. If internal storage is   full, the operating system installs it in external storage.   The user can move the application in the storage he chooses.

     

"preferExternal" : Indicates that the application prefers to be installed in   External storage (SD Card). The user can move the application in the   storage you choose.

Example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    android:installLocation="auto"
    ...
    ... >

Regarding what happens if you install your application with the .apk, in the case that your application is installed in external storage, the .apk is installed there but data that the application generates such as databases, preferences , .dex, etc this is saved in internal storage.

  

I do not know if it stays in that format apk or change to another format or it   It divides into different fragments.

Actually it is divided, the file .apk is a packaged file, in fact you can check it by changing the extension to .zip and open it so that you can see its contents.

As an example, change the extension of my file MyApp.apk to MyApp.zip and this is its content:

From the configuration you can make the movement of your application to external storage (SD Card) or internal, if you have defined in your AndroidManifest.xml :

  android:installLocation="auto"

or

  android:installLocation="preferExternal"

    
answered by 15.10.2016 в 01:27
1

The .apk file is a package that has a variable content, depending on the project itself.

The most commonly found within the .apk are the following folders:

  • META-INF :

    • MANIFEST.MF: The manifest
    • CERT.RSA: Certificate of the application
    • CERT.SF: List of resources and the SHA-1 digest of the corresponding lines in the manifest, for example:

       Signature-Version: 1.0 
       Created-By: 1.0 (Android)  SHA1-Digest-Manifest:
       wxqnEAI0UA5nO5QJ8CGMwjkGGWE=  
       ...  
       Name: res/layout/exchange_component_back_bottom.xml  SHA1-Digest:
       eACjMjESj7Zkf0cBFTZ0nqWrt7w=  
       ...  
       Name: res/drawable-hdpi/icon.png 
       SHA1-Digest: DGEqylP8W0n0iV/ZzBx3MW0WGCA=
      
  • lib : Folder that contains the compiled code that is specific to the processor architecture. It is divided into:

    • armeabi: Compiled code for ARM processors
    • armeabi-v7a: Compiled code for ARMv7 and higher processors
    • x86: Compiled code for x86 processors
    • mips: Compiled code for MIPS processors
  • res : folder that contains non-compiled resources within resources.arsc.

  • assets : folder containing assets that are retrieved via AssetManager .

  • AndroidManifest.xml : An additional manifest, describing the name, version, access rights and libraries referenced by the application. The file could be in Android binary XML format, which can be converted to plain text XML with tools such as AXMLPrinter2, apktool, or Androguard.

  • classes.dex : The classes compiled in dex format, for the Dalvik virtual machine

    • resources.arsc : File containing pre-compiled resources, such as binary XML for example.

In the best java style, the .apk file is actually a zipped file (as are .jar and .war files, for example), so you can easily see its contents using any tool that can show / unzip a zip. It may be necessary for you to rename the file.

Source

Reference

    
answered by 15.10.2016 в 00:41