Browse Source

Refactor AndroidManifest.

Playstore flavor is now removed. Instead, another "record" flavor added:
* `embedNoRecord` - Embed version without recording support.
* `embedRecord` - Embed version with recording support.
* `normalNoRecord` - Normal version without recording support.
* `normalRecord` - Normal version with recording support.
Miku AuahDark 4 years ago
parent
commit
c9831be4a4

+ 17 - 14
README.md

@@ -41,25 +41,28 @@ Quick Start:
 Before you start, install JDK 11 or later. If you intend to build from Android Studio, skip this step as
 Android Studio bundles its own JDK 11.
 
-Install Android SDK with SDK API 30 and Android NDK 21.3.6528147, set the environment variables:
-
-* `ANDROID_HOME` to your Android SDK location.
-
-(you may have to adjust the paths to the install directories of the Android SDK on your system) and run
+Install Android SDK with SDK API 30 and Android NDK 21.3.6528147, set the environment variables `ANDROID_SDK_ROOT` to your
+Android SDK location and run.
 
 ```
-$ ./gradlew assembleNormal
+$ ./gradlew assembleNormalRecord
 ```
 
-in the root folder of this project. This should give you a .apk file in the `app/build/outputs/apk/normal`
-subdirectory that you can then sign and install on your phone. The `normal` .apk flavor is what you normally have
-when downloading one from love2d.org.
+in the root folder of this project. This should give you a .apk file in the `app/build/outputs/apk/normalRecord`
+subdirectory that you can then sign and install on your phone. The `normalRecord` .apk flavor is what you normally have
+when downloading one from https://love2d.org.
+
+If you want to put your game inside the APK, you can either:
+
+1. Put all your games in `app/src/embed/assets` such that your `main.lua` path is `app/src/embed/assets/main.lua`; or
+2. Put your zipped \*.love in `app/src/embed/assets` with name `game.love`
 
-If you want to put your game inside the APK, put your zipped \*.love in `app/src/main/assets` with name `game.love`
-then change the package name, application display name, and the icons. Afterwards, run either `gradlew assembleEmbedRelease`
-to generate APK which you can install or `gradlew bundleEmbedRelease` which you can upload to Play Store.
+And change the package name, application version string and codes, application display name, and the icons. Afterwards,
+run either `gradlew assembleEmbedNoRecordRelease` (or `gradlew assembleEmbedRecordRelease` if your game uses microphone) to
+generate APK which you can install or `gradlew bundleEmbedNoRecordRelease` (or `gradlew bundleEmbedRecordRelease`) which you
+can upload to Play Store.
 
-Alternatively, you can install Android Studio **2020.3.1** or later. After opening it for the first time, open it's SDK Manager
+Alternatively, you can install Android Studio **2020.3.1** or later. After opening it for the first time, open its SDK Manager
 and on the tab "SDK Tools", tick "Show Package Details" then select NDK (Side By Side) version 21.3.6528147. After that, open
 the repository root.
 
@@ -69,7 +72,7 @@ Bugs:
 -----
 
 Bugs and/or feature requests should be reported to the issue tracker at:
-* https://github.com/love2d/love-android/issues - for internal, LÖVE-Android-specific stuff
+* https://github.com/love2d/love-android/issues - LÖVE-Android-specific issues
 * https://github.com/love2d/love/issues - for LÖVE in general
 
 Changelog:

+ 7 - 5
app/build.gradle

@@ -17,17 +17,19 @@ android {
             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
         }
     }
-    flavorDimensions 'mode'
+    flavorDimensions 'mode', 'recording'
     productFlavors {
         normal {
             dimension 'mode'
         }
-        playstore {
-            dimension 'mode'
-        }
         embed {
             dimension 'mode'
-            applicationIdSuffix '.embed'
+        }
+        record {
+            dimension 'recording'
+        }
+        noRecord {
+            dimension 'recording'
         }
     }
     lintOptions {

+ 0 - 34
app/src/embed/AndroidManifest.xml

@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest
-  package="org.love2d.android.executable"
-  xmlns:android="http://schemas.android.com/apk/res/android"
-  xmlns:tools="http://schemas.android.com/tools"
->
-  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
-  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" tools:replace="android:maxSdkVersion" />
-
-  <application
-      android:allowBackup="true"
-      android:icon="@drawable/love"
-      android:label="LÖVE for Android"
-      android:usesCleartextTraffic="true"
-	  tools:node="replace" >
-      <activity
-        android:name="org.love2d.android.GameActivity"
-        android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
-        android:label="LÖVE for Android"
-        android:launchMode="singleTask"
-        android:screenOrientation="landscape"
-        android:resizeableActivity="false"
-        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
-        <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>
-        <intent-filter>
-          <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
-        </intent-filter>
-      </activity>
-    </application>
-</manifest> 

+ 19 - 61
app/src/main/AndroidManifest.xml

@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest package="org.love2d.android.executable"
-  android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android">
+<manifest
+    package="org.love2d.android.executable"
+    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.BLUETOOTH" />
   <uses-permission android:name="android.permission.RECORD_AUDIO" />
-  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
-  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
+  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />
 
   <!-- OpenGL ES 2.0 -->
   <uses-feature android:glEsVersion="0x00020000" />
@@ -26,66 +26,24 @@
       android:allowBackup="true"
       android:icon="@drawable/love"
       android:label="LÖVE for Android"
-      android:usesCleartextTraffic="true"
-      android:hardwareAccelerated="true" >
-      <service android:name="org.love2d.android.DownloadService" />
-      <activity
+      android:usesCleartextTraffic="true" >
+    <activity
         android:name="org.love2d.android.GameActivity"
-        android:configChanges="layoutDirection|locale|orientation|uiMode|screenLayout|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation"
+        android:exported="true"
+        android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
         android:label="LÖVE for Android"
         android:launchMode="singleTask"
         android:screenOrientation="landscape"
-        android:resizeableActivity="true"
+        android:resizeableActivity="false"
         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
-        <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>
-        <intent-filter>
-          <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
-        </intent-filter>
-        <intent-filter>
-          <action android:name="android.intent.action.VIEW" />
-          <category android:name="android.intent.category.DEFAULT" />
-          <category android:name="android.intent.category.BROWSABLE" />
-          <data android:scheme="file" />
-          <data android:mimeType="*/*" />
-          <data android:pathPattern=".*\\.love" />
-          <data android:host="*" />
-        </intent-filter>
-        <intent-filter>
-          <action android:name="android.intent.action.VIEW" />
-          <category android:name="android.intent.category.DEFAULT" />
-          <category android:name="android.intent.category.BROWSABLE" />
-          <data android:scheme="content" />
-          <data android:mimeType="application/x-love-game" />
-        </intent-filter>
-        <intent-filter>
-          <action android:name="android.intent.action.VIEW" />
-          <category android:name="android.intent.category.DEFAULT" />
-          <category android:name="android.intent.category.BROWSABLE" />
-          <data android:scheme="content" />
-          <data android:mimeType="application/octet-stream" />
-        </intent-filter>
-      </activity>
-      <activity
-        android:name="org.love2d.android.DownloadActivity"
-        android:noHistory="true"
-        android:theme="@android:style/Theme.NoTitleBar" >
-        <intent-filter>
-          <action android:name="android.intent.action.VIEW" />
-          <category android:name="android.intent.category.DEFAULT" />
-          <category android:name="android.intent.category.BROWSABLE" />
-          <data android:scheme="http"
-            android:host="*"
-            android:mimeType="*/*"
-            android:pathPattern=".*\\.love" />
-          <data android:scheme="https"
-            android:host="*"
-            android:mimeType="*/*"
-            android:pathPattern=".*\\.love" />
-        </intent-filter>
-      </activity>
-    </application>
+      <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>
+      <intent-filter>
+        <action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
+      </intent-filter>
+    </activity>
+  </application>
 </manifest> 

+ 0 - 0
app/src/playstore/AndroidManifest.xml → app/src/norecord/AndroidManifest.xml


+ 57 - 1
app/src/normal/AndroidManifest.xml

@@ -1,2 +1,58 @@
 <?xml version="1.0" encoding="utf-8"?>
-<manifest package="org.love2d.android.executable" xmlns:android="http://schemas.android.com/apk/res/android" />
+<manifest
+    package="org.love2d.android.executable"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools" >
+  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="28" />
+  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" tools:replace="maxSdkVersion" />
+
+  <application tools:node="merge">
+    <service android:name="org.love2d.android.DownloadService" />
+    <activity
+        android:name="org.love2d.android.GameActivity"
+        tools:node="merge" >
+      <intent-filter>
+        <action android:name="android.intent.action.VIEW" />
+        <category android:name="android.intent.category.DEFAULT" />
+        <category android:name="android.intent.category.BROWSABLE" />
+        <data android:scheme="file" />
+        <data android:mimeType="*/*" />
+        <data android:pathPattern=".*\\.love" />
+        <data android:host="*" />
+      </intent-filter>
+      <intent-filter>
+        <action android:name="android.intent.action.VIEW" />
+        <category android:name="android.intent.category.DEFAULT" />
+        <category android:name="android.intent.category.BROWSABLE" />
+        <data android:scheme="content" />
+        <data android:mimeType="application/x-love-game" />
+      </intent-filter>
+      <intent-filter>
+        <action android:name="android.intent.action.VIEW" />
+        <category android:name="android.intent.category.DEFAULT" />
+        <category android:name="android.intent.category.BROWSABLE" />
+        <data android:scheme="content" />
+        <data android:mimeType="application/octet-stream" />
+      </intent-filter>
+    </activity>
+    <activity
+        android:name="org.love2d.android.DownloadActivity"
+        android:exported="true"
+        android:noHistory="true"
+        android:theme="@android:style/Theme.NoTitleBar" >
+      <intent-filter>
+        <action android:name="android.intent.action.VIEW" />
+        <category android:name="android.intent.category.DEFAULT" />
+        <category android:name="android.intent.category.BROWSABLE" />
+        <data android:scheme="http"
+            android:host="*"
+            android:mimeType="*/*"
+            android:pathPattern=".*\\.love" />
+        <data android:scheme="https"
+            android:host="*"
+            android:mimeType="*/*"
+            android:pathPattern=".*\\.love" />
+      </intent-filter>
+    </activity>
+  </application>
+</manifest>

+ 5 - 0
build.gradle

@@ -5,6 +5,11 @@ allprojects {
         google()
         mavenCentral()
     }
+    gradle.projectsEvaluated {
+        tasks.withType(JavaCompile) {
+            options.compilerArgs << "-Xlint:deprecation"
+        }
+    }
 }
 
 buildscript {

+ 0 - 8
love/build.gradle

@@ -78,9 +78,6 @@ android {
         normal {
             dimension 'mode'
         }
-        playstore {
-            dimension 'mode'
-        }
         embed {
             dimension 'mode'
             resValue 'bool', 'embed', 'true'
@@ -94,11 +91,6 @@ android {
                 srcDirs += retrieveAll3pModules()
             }
         }
-        playstore {
-            java {
-                srcDir 'src/normal/java'
-            }
-        }
     }
     externalNativeBuild {
         ndkBuild {