mirror of
https://github.com/love2d/love-android.git
synced 2026-08-12 00:20:57 +02:00
Provide option to easily modify app name and version.
Chery-picked from #243.
This commit is contained in:
+41
-8
@@ -1,18 +1,21 @@
|
|||||||
|
import java.nio.charset.StandardCharsets
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application'
|
id 'com.android.application'
|
||||||
}
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
namespace "org.love2d.android"
|
namespace "org.love2d.android"
|
||||||
compileSdk 33
|
ndkVersion "26.0.10792818"
|
||||||
ndkVersion "25.2.9519653"
|
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "org.love2d.android"
|
applicationId project.properties["app.application_id"]
|
||||||
versionCode 32
|
versionCode project.properties["app.version_code"].toInteger()
|
||||||
versionName "12.0"
|
versionName project.properties["app.version_name"]
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 33
|
compileSdk 34
|
||||||
|
targetSdk 34
|
||||||
|
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
cmake {
|
cmake {
|
||||||
arguments "-DANDROID_STL=c++_shared"
|
arguments "-DANDROID_STL=c++_shared"
|
||||||
@@ -24,6 +27,30 @@ android {
|
|||||||
targets "love_android", "OpenAL", "love"
|
targets "love_android", "OpenAL", "love"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def getAppName = {
|
||||||
|
def nameArray = project.properties["app.name_byte_array"]
|
||||||
|
def name = project.properties["app.name"]
|
||||||
|
if (name != null && nameArray != null) {
|
||||||
|
throw new Exception("Only define either `app.name` or `app.name_byte_array` in gradle.properties, but not both!")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name == null) {
|
||||||
|
def nameArraySplit = nameArray.split(",")
|
||||||
|
def nameBytes = new byte[nameArraySplit.length]
|
||||||
|
def count = 0
|
||||||
|
for (String s: nameArraySplit) {
|
||||||
|
nameBytes[count++] = (byte) Integer.parseInt(s)
|
||||||
|
}
|
||||||
|
return new String(nameBytes, StandardCharsets.UTF_8)
|
||||||
|
}
|
||||||
|
return name
|
||||||
|
}
|
||||||
|
|
||||||
|
manifestPlaceholders = [
|
||||||
|
NAME:getAppName(),
|
||||||
|
ORIENTATION:project.properties["app.orientation"],
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def retrieveAll3pModules = { ->
|
def retrieveAll3pModules = { ->
|
||||||
@@ -33,6 +60,7 @@ android {
|
|||||||
if (details.isDirectory()) {
|
if (details.isDirectory()) {
|
||||||
if (file(details.file.path + "/Android.mk").exists() ||
|
if (file(details.file.path + "/Android.mk").exists() ||
|
||||||
file(details.file.path + "/CMakeLists.mk").exists()) {
|
file(details.file.path + "/CMakeLists.mk").exists()) {
|
||||||
|
def logger = project.getLogger()
|
||||||
logger.lifecycle("3rd-party module: " + details.file.path)
|
logger.lifecycle("3rd-party module: " + details.file.path)
|
||||||
|
|
||||||
def javainfo = file(details.file.path + "/java.txt")
|
def javainfo = file(details.file.path + "/java.txt")
|
||||||
@@ -71,7 +99,7 @@ android {
|
|||||||
prefab true
|
prefab true
|
||||||
}
|
}
|
||||||
|
|
||||||
flavorDimensions 'mode', 'recording'
|
flavorDimensions = ['mode', 'recording']
|
||||||
productFlavors {
|
productFlavors {
|
||||||
normal {
|
normal {
|
||||||
dimension 'mode'
|
dimension 'mode'
|
||||||
@@ -123,7 +151,12 @@ android {
|
|||||||
}
|
}
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
jniLibs {
|
jniLibs {
|
||||||
excludes += ['lib/armeabi-v7a/libOpenSLES.so', 'lib/arm64-v8a/libOpenSLES.so', 'lib/x86/libOpenSLES.so', 'lib/x86_64/libOpenSLES.so']
|
excludes += [
|
||||||
|
'lib/armeabi-v7a/libOpenSLES.so',
|
||||||
|
'lib/arm64-v8a/libOpenSLES.so',
|
||||||
|
'lib/x86/libOpenSLES.so',
|
||||||
|
'lib/x86_64/libOpenSLES.so'
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<application
|
<application
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:icon="@drawable/love"
|
android:icon="@drawable/love"
|
||||||
android:label="LÖVE for Android">
|
android:label="${NAME}">
|
||||||
<!-- You don't have to change the activity class unless you have special needs! !-->
|
<!-- You don't have to change the activity class unless you have special needs! !-->
|
||||||
<activity
|
<activity
|
||||||
android:name="org.love2d.android.GameActivity"
|
android:name="org.love2d.android.GameActivity"
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||||
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
|
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
|
||||||
android:launchMode="singleInstance"
|
android:launchMode="singleInstance"
|
||||||
android:screenOrientation="landscape">
|
android:screenOrientation="${ORIENTATION}">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|||||||
+17
-20
@@ -1,22 +1,19 @@
|
|||||||
# Project-wide Gradle settings.
|
# To set the application display name, only define either `app.name` or `app.name_byte_array`.
|
||||||
# IDE (e.g. Android Studio) users:
|
# For a rule of thumb:
|
||||||
# Gradle settings configured through the IDE *will override*
|
# * Use `app.name` if your app name doesn't contain any non-ANSI characters.
|
||||||
# any settings specified in this file.
|
# * Otherwise, convert your app name to UTF-8 byte array, comma delimited, and put
|
||||||
# For more details on how to configure your build environment visit
|
# it in `app.name_byte_array`
|
||||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
#app.name=LÖVE for Android
|
||||||
# Specifies the JVM arguments used for the daemon process.
|
app.name_byte_array=76,195,150,86,69,32,102,111,114,32,65,110,100,114,111,105,100
|
||||||
# The setting is particularly useful for tweaking memory settings.
|
|
||||||
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
|
app.application_id=org.love2d.android
|
||||||
# When configured, Gradle will run in incubating parallel mode.
|
app.orientation=landscape
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
app.version_code=32
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
app.version_name=12.0
|
||||||
# org.gradle.parallel=true
|
|
||||||
# AndroidX package structure to make it clearer which packages are bundled with the
|
# No need to modify anything past this line!
|
||||||
# Android operating system, and which are packaged with your app"s APK
|
android.enableJetifier=false
|
||||||
# https://developer.android.com/topic/libraries/support-library/androidx-rn
|
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
# Automatically convert third-party libraries to use AndroidX
|
|
||||||
android.enableJetifier=true
|
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
android.defaults.buildfeatures.buildconfig=true
|
||||||
android.nonTransitiveRClass=false
|
android.nonTransitiveRClass=true
|
||||||
android.nonFinalResIds=false
|
android.nonFinalResIds=true
|
||||||
|
|||||||
Reference in New Issue
Block a user