Difference between revisions of "Game Distribution/APKTool"

m
m (singleTop -> singleTask)
(12 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
To distribute your game for Android using APKTool:
 
To distribute your game for Android using APKTool:
  
 +
{{notice|'''This method is shouldn't be used for 11.1 APK and earlier!''' Google requires that all apps in Play Store must be compatible with API level 26 and compiled for ARM64, which isn't the case for LOVE 11.1 APK. However, those requirements is satisfied with the new LOVE APK that can be downloaded [https://bitbucket.org/rude/love/downloads/love-11.3-android-embed.apk here].}}
  
 
1. Download [https://ibotpeaches.github.io/Apktool/install/ APKTool] and follow the installation instructions.
 
1. Download [https://ibotpeaches.github.io/Apktool/install/ APKTool] and follow the installation instructions.
  
2. Download LÖVE APK from the [https://love2d.org/ main page] and put it somewhere in folder.
+
2. Download latest LÖVE APK from [https://bitbucket.org/rude/love/downloads/love-11.3-android-embed.apk here] and put it somewhere in folder.
  
3. In current folder (where you store the LÖVE APK), open Command Prompt/Terminal in the current directory and execute <code>apktool d -s -o love_decoded love-11.0-android.apk</code> and new folder <code>love_decoded</code> will be created. You can use any folder name, just make sure to make it consistent in later operations.
+
3. In current folder (where you store the LÖVE APK), open Command Prompt/Terminal in the current directory and execute <code>apktool d -s -o love_decoded love-11.3-android-embed.apk</code> and new folder <code>love_decoded</code> will be created. You can use any folder name, just make sure to make it consistent in later operations.
  
 
4. In <code>love_decoded</code> folder, create new folder named <code>assets</code> and put your <code>game.love</code> inside that folder. Your packaged game must be named exactly <code>game.love</code>!
 
4. In <code>love_decoded</code> folder, create new folder named <code>assets</code> and put your <code>game.love</code> inside that folder. Your packaged game must be named exactly <code>game.love</code>!
Line 21: Line 22:
 
     <uses-permission android:name="android.permission.INTERNET"/>
 
     <uses-permission android:name="android.permission.INTERNET"/>
 
     <uses-permission android:name="android.permission.VIBRATE"/>
 
     <uses-permission android:name="android.permission.VIBRATE"/>
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
+
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
 +
    <!--Uncomment line below if your game uses microphone capabilities. !-->
 +
    <!--uses-permission android:name="android.permission.RECORD_AUDIO" /!-->
 
     <uses-feature android:glEsVersion="0x00020000"/>
 
     <uses-feature android:glEsVersion="0x00020000"/>
 
     <application
 
     <application
Line 33: Line 36:
 
             android:configChanges="orientation|screenSize"
 
             android:configChanges="orientation|screenSize"
 
             android:label="${GameName}"
 
             android:label="${GameName}"
             android:launchMode="singleTop"
+
             android:launchMode="singleTask"
 
             android:name="org.love2d.android.GameActivity"
 
             android:name="org.love2d.android.GameActivity"
 
             android:screenOrientation="sensorLandscape"
 
             android:screenOrientation="sensorLandscape"
Line 45: Line 48:
 
     </application>
 
     </application>
 
</manifest></source>
 
</manifest></source>
   Here are the explanation of the variables:
+
   Here are the explanation of the variables. You just have to substitute them:
 
   * <code>${GamePackageName}</code> is your game internal package name.
 
   * <code>${GamePackageName}</code> is your game internal package name.
 
   * <code>${GameVersionCode}</code> is the internal APK version code.
 
   * <code>${GameVersionCode}</code> is the internal APK version code.
 
   * <code>${GameVersionSemantic}</code> is the readable APK version string. Example: 2.1.0
 
   * <code>${GameVersionSemantic}</code> is the readable APK version string. Example: 2.1.0
 
   * <code>${GameName}</code> is your game name which is going to be displayed in home screen/launcher.
 
   * <code>${GameName}</code> is your game name which is going to be displayed in home screen/launcher.
 +
  Make sure to substitute those variables.
  
7. Open <code>apktool.yml</code> and modify <code>minSdkVersion</code> and <code>targetSdkVersion</code> to 16.
+
7. Back to folder where you put the LÖVE APK then execute <code>apktool b -o your_game.apk love_decoded</code>. You can use any name, but again, make it consistent.
  
8. Back to folder where you put the LÖVE APK then execute <code>apktool b -o your_game.apk love_decoded</code>. You can use any name, but again, make it consistent.
+
8. '''Sign the resulting APK!!!''' This page doesn't cover how to do that, because it can be too long. '''You can't install the APK if it's not signed!!!'''  ([https://developer.android.com/studio/publish/app-signing Sign APK using Android studio])
  
9. Sign the resulting APK. This page doesn't cover how to do that, because it can be too long.
+
If you find something is wrong or having some problems, don't heistate to edit or mention me in LOVE Discord: "AuahDark#4586".
 
 
 
 
If you find something is wrong or having some problems, don't heistate to edit or contact me at Discord: "AuahDark#4586" ("Tae Hanazono" in LÖVE Discord).
 

Revision as of 03:16, 2 November 2019

This method will assume the usage of APKTool. To distribute your game for Android using APKTool:

O.png This method is shouldn't be used for 11.1 APK and earlier! Google requires that all apps in Play Store must be compatible with API level 26 and compiled for ARM64, which isn't the case for LOVE 11.1 APK. However, those requirements is satisfied with the new LOVE APK that can be downloaded here.  


1. Download APKTool and follow the installation instructions.

2. Download latest LÖVE APK from here and put it somewhere in folder.

3. In current folder (where you store the LÖVE APK), open Command Prompt/Terminal in the current directory and execute apktool d -s -o love_decoded love-11.3-android-embed.apk and new folder love_decoded will be created. You can use any folder name, just make sure to make it consistent in later operations.

4. In love_decoded folder, create new folder named assets and put your game.love inside that folder. Your packaged game must be named exactly game.love!

5. (Optional) Change the APK icon by replacing the LÖVE icon in res/drawable-{mdpi,{x,{x,{x,}}}hdpi} (mdpi, hdpi, xhdpi, xxhdpi, and xxxhdpi). Replace love.png with your game icon in those folders. Make sure the image dimensions are same!

6. Modify AndroidManifest.xml and use this template:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest package="${GamePackageName}"
      android:versionCode="${GameVersionCode}"
      android:versionName="${GameVersionSemantic}"
      android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
    <!--Uncomment line below if your game uses microphone capabilities. !-->
    <!--uses-permission android:name="android.permission.RECORD_AUDIO" /!-->
    <uses-feature android:glEsVersion="0x00020000"/>
    <application
        android:allowBackup="true"
        android:icon="@drawable/love"
        android:label="${GameName}"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
    >
        <activity
            android:configChanges="orientation|screenSize"
            android:label="${GameName}"
            android:launchMode="singleTask"
            android:name="org.love2d.android.GameActivity"
            android:screenOrientation="sensorLandscape"
        >
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
                <category android:name="tv.ouya.intent.category.GAME"/>
            </intent-filter>
        </activity>
    </application>
</manifest>
 Here are the explanation of the variables. You just have to substitute them:
 * ${GamePackageName} is your game internal package name.
 * ${GameVersionCode} is the internal APK version code.
 * ${GameVersionSemantic} is the readable APK version string. Example: 2.1.0
 * ${GameName} is your game name which is going to be displayed in home screen/launcher.
 Make sure to substitute those variables.

7. Back to folder where you put the LÖVE APK then execute apktool b -o your_game.apk love_decoded. You can use any name, but again, make it consistent.

8. Sign the resulting APK!!! This page doesn't cover how to do that, because it can be too long. You can't install the APK if it's not signed!!! (Sign APK using Android studio)

If you find something is wrong or having some problems, don't heistate to edit or mention me in LOVE Discord: "AuahDark#4586".