Prechádzať zdrojové kódy

Abstract configurable values to gradle.properties (#243)

* Abstract configurable values to gradle.properties

* Remove gms in AndroidManifest
flamendless 2 rokov pred
rodič
commit
69dcd4b63b

+ 9 - 3
app/build.gradle

@@ -5,11 +5,17 @@ android {
     buildToolsVersion '33.0.0'
     ndkVersion '23.2.8568313'
     defaultConfig {
-        applicationId 'org.love2d.android'
-        versionCode 30
-        versionName '11.4'
+        applicationId project.properties["app.application_id"]
+        versionCode project.properties["app.version_code"].toInteger()
+        versionName project.properties["app.version_name"]
         minSdkVersion 16
         targetSdk 33
+
+        manifestPlaceholders = [
+            NAME:project.properties["app.name"],
+            ACTIVITY_NAME:project.properties["app.activity_name"],
+            ORIENTATION:project.properties["app.orientation"],
+        ]
     }
     buildTypes {
         release {

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

@@ -0,0 +1,36 @@
+<?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="${NAME}"
+      android:usesCleartextTraffic="true"
+      android:hardwareAccelerated="true"
+      tools:node="replace" >
+      <activity
+        android:name="${ACTIVITY_NAME}"
+        android:exported="true"
+        android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
+        android:label="${NAME}"
+        android:launchMode="singleTask"
+        android:screenOrientation="${ORIENTATION}"
+        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>

+ 1 - 1
app/src/main/AndroidManifest.xml

@@ -46,4 +46,4 @@
       </intent-filter>
     </activity>
   </application>
-</manifest> 
+</manifest>

+ 9 - 1
gradle.properties

@@ -1,2 +1,10 @@
 android.enableJetifier=true
-android.useAndroidX=true
+android.useAndroidX=true
+org.gradle.daemon=false
+
+app.name=Love2D
+app.activity_name=org.love2d.android.GameActivity
+app.application_id=org.love2d.unique_game_name
+app.orientation=landscape
+app.version_code=30
+app.version_name=11.4