Skip to content

Commit

Permalink
Android 11.0 compatibility (#195)
Browse files Browse the repository at this point in the history
* Update dependencies and target SDK
* Update Gradle to 6.6.1
* Update target API level to 30
* Update AGP to 4.0.1
* Update Android Build Dependencies (androidx.appcompat:appcompat:1.2.0, androidx.multidex:multidex:2.0.1)
* Update readme
* Move /sdcard/lovegame directory. (closes #194)
* Potentially fixes black screen when reopening LOVE from app drawer (fixes #190)
* Downloader cleanup.
* Merge SDL AndroidManifest.xml to LOVE
* Implement partial "Share to LOVE" support.
* Enable resizeableActivity
  • Loading branch information
MikuAuahDark authored Oct 9, 2020
1 parent 6c75410 commit 0e41ef2
Show file tree
Hide file tree
Showing 16 changed files with 214 additions and 212 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ local.properties

# Gradle build files
build
.externalNativeBuild
.externalNativeBuild
.cxx
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,24 @@ In the repository directory. For the last command, add `--depth 1` if needed.
Instructions:
-------------

Detailed instructions can be viewed at https://bitbucket.org/MartinFelis/love-android-sdl2/wiki/Home (at the moment)
Detailed instructions can be viewed at https://github.com/love2d/love-android/wiki

Quick Start:
------------

Install the Android NDK and the Android SDK with SDK API 28, set the
environment variables:
Install the Android SDK with SDK API 30 and Android NDK 21.3.6528147, set the environment variables:

* `ANDROID_HOME` to your Android SDK location.

* `ANDROID_NDK_HOME` to your Android NDK location. NDK r16 or later!

(you may have to adjust the paths to the install directories of the Android
SDK and Android NDK on your system) and run
SDK on your system) and run

```
./gradlew assembleNormal
```

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 .apk flavor is what you normally have
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. If you want to build the ["embed"](https://love2d.org/wiki/Game_Distribution/APKTool
APK, change `assembleNormal` to `assembleEmbedRelease` instead at command above.

Expand All @@ -63,7 +60,7 @@ and on the tab "SDK Tools", select NDK. After that, open the repository root.
Bugs:
-----

Bugs and feature requests should be reported to the issue tracker at https://bitbucket.org/MartinFelis/love-android-sdl2/issues?status=new&status=open
Bugs and feature requests should be reported to the issue tracker at https://github.com/love2d/love-android/issues

Changelog:
----------
Expand All @@ -72,7 +69,7 @@ Changelog:

* Contains all relevant changes for desktop LÖVE [11.3](https://love2d.org/wiki/11.3).
* Added support for microphone recording on Android. **This is disabled in Play Store builds**.
* Added t.audio.mic (false by default). On Android, setting it to true requests microphone recording permission from the user.
* Added t.audio.mic (`false` by default). On Android, setting it to true requests microphone recording permission from the user.
* Fixed performance regression on Android devices with Adreno GPU.
* Fixed video playback support on Android devices with Adreno GPU.

Expand Down
17 changes: 9 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
compileSdkVersion 30
buildToolsVersion '30.0.2'
ndkVersion '21.3.6528147'
defaultConfig {
applicationId "org.love2d.android"
applicationId 'org.love2d.android'
versionCode 29
versionName "11.3a"
versionName '11.3a'
minSdkVersion 14
targetSdkVersion 28
targetSdkVersion 30
}
buildTypes {
release {
Expand All @@ -26,7 +27,7 @@ android {
}
embed {
dimension 'mode'
applicationIdSuffix "embed"
applicationIdSuffix '.embed'
}
}
lintOptions {
Expand All @@ -35,8 +36,8 @@ android {
}

dependencies {
api 'androidx.multidex:multidex:2.0.0'
api 'androidx.multidex:multidex:2.0.1'
api fileTree(dir: 'libs', include: ['*.jar'])
api 'androidx.appcompat:appcompat:1.1.0-alpha01'
api 'androidx.appcompat:appcompat:1.2.0'
api project(':love')
}
6 changes: 1 addition & 5 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,4 @@
# public *;
#}

-keep class br.com.tapps.love.LoveActivity { *; }

-keepclassmembers class br.com.tapps.love.LoveActivity {
public com.naef.jnlua.LuaState createLuaState();
}
-keep class org.love2d.android.GameActivity { *; }
3 changes: 2 additions & 1 deletion app/src/embed/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
android:icon="@drawable/love"
android:label="LÖVE for Android"
android:usesCleartextTraffic="true"
tools:node="replace" >
android:hardwareAccelerated="true"
tools:node="replace" >
<activity
android:name="org.love2d.android.GameActivity"
android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|keyboard|keyboardHidden|navigation"
Expand Down
27 changes: 20 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
<?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">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.VIBRATE"/>
<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" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="23" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="28" />

<!-- OpenGL ES 2.0 -->
<uses-feature android:glEsVersion="0x00020000" />
<!-- Touchscreen support -->
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<!-- Game controller support -->
<uses-feature android:name="android.hardware.bluetooth" android:required="false" />
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
<uses-feature android:name="android.hardware.usb.host" android:required="false" />
<!-- External mouse input events -->
<uses-feature android:name="android.hardware.type.pc" android:required="false" />

<application
android:allowBackup="true"
android:icon="@drawable/love"
android:label="LÖVE for Android"
android:usesCleartextTraffic="true" >
android:usesCleartextTraffic="true"
android:hardwareAccelerated="true" >
<service android:name="org.love2d.android.DownloadService" />
<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:resizeableActivity="true"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -43,17 +53,20 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="content" />
<data android:host="*" />
<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:host="*" />
<data android:mimeType="application/octet-stream" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/*" />
</intent-filter>
</activity>
<activity
android:name="org.love2d.android.DownloadActivity"
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:4.0.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
12 changes: 6 additions & 6 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Nov 18 11:20:03 CET 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
#Thu Oct 01 16:43:18 SGT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
72 changes: 42 additions & 30 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
#!/usr/bin/env bash
#!/usr/bin/env sh

##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
warn () {
echo "$*"
}

die ( ) {
die () {
echo
echo "$*"
echo
Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -85,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand Down Expand Up @@ -150,11 +154,19 @@ if $cygwin ; then
esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
exec "$JAVACMD" "$@"
Loading

0 comments on commit 0e41ef2

Please sign in to comment.