Merge pull request #1500 from player-03/DeprecatedGradleFeatures

Fix warnings and errors in the Android build process
This commit is contained in:
player-03
2022-12-29 19:26:54 -05:00
committed by GitHub
10 changed files with 63 additions and 52 deletions

View File

@@ -215,7 +215,7 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11
- uses: krdlab/setup-haxe@v1
with:
@@ -460,7 +460,7 @@ jobs:
- uses: actions/setup-java@v1
with:
java-version: 8
java-version: 11
- uses: krdlab/setup-haxe@v1
with:

View File

@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}

View File

@@ -1,15 +1,21 @@
import groovy.swing.SwingBuilder
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout
import java.awt.GridBagConstraints
import javax.swing.border.EmptyBorder
apply plugin: 'com.android.application'
System.setProperty('java.awt.headless','false')
//Uncomment to debug deprecation warnings.
/* tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
} */
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
::if (ANDROID_GRADLE_PLUGIN>="4.0")::ndkPath '::ANDROID_NDK_ROOT_ESCAPED::'::end::
defaultConfig {
applicationId "::META_PACKAGE_NAME::"
@@ -77,8 +83,8 @@ android {
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
::if (ANDROID_LIBRARY_PROJECTS)::::foreach (ANDROID_LIBRARY_PROJECTS)::api project(':deps:::name::')
implementation fileTree(dir: 'libs', include: ['*.jar'])
::if (ANDROID_LIBRARY_PROJECTS)::::foreach (ANDROID_LIBRARY_PROJECTS)::implementation project(':deps:::name::')
::end::::end::
}

View File

@@ -7,9 +7,7 @@
::if (ANDROID_PERMISSIONS != null)::::foreach ANDROID_PERMISSIONS::<uses-permission android:name="::__current__::" />
::end::::end::
<uses-sdk android:minSdkVersion="::ANDROID_MINIMUM_SDK_VERSION::" android:targetSdkVersion="::ANDROID_TARGET_SDK_VERSION::"/>
<application android:label="::APP_TITLE::" ::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar::if (WIN_FULLSCREEN)::.Fullscreen::end::" android:hardwareAccelerated="true">
<application android:label="::APP_TITLE::" ::if (HAS_ICON):: android:icon="@drawable/icon"::end:: android:allowBackup="true" android:theme="@android:style/Theme.NoTitleBar::if (WIN_FULLSCREEN)::.Fullscreen::end::" android:hardwareAccelerated="true" ::if (ANDROID_TARGET_SDK_VERSION>=30):: android:allowNativeHeapPointerTagging="false" ::end::>
::if (WIN_ORIENTATION=="portrait")::
<meta-data android:name="SDL_ENV.SDL_IOS_ORIENTATIONS" android:value= "Portrait PortraitUpsideDown" />

View File

@@ -2,7 +2,7 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
dependencies {
@@ -15,7 +15,7 @@ buildscript {
allprojects {
repositories {
jcenter()
mavenCentral()
google()
}::if ANDROID_GRADLE_BUILD_DIRECTORY::
buildDir = "::ANDROID_GRADLE_BUILD_DIRECTORY::/::APP_FILE::/${project.name}"::end::
@@ -32,7 +32,7 @@ wrapper {
configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('build.xml').exists()}) {
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
@@ -46,6 +46,7 @@ configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('bui
android {
compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)
buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION
::if (ANDROID_GRADLE_PLUGIN>="4.0")::ndkPath '::ANDROID_NDK_ROOT_ESCAPED::'::end::
sourceSets {
main {
@@ -57,7 +58,6 @@ configure(subprojects.findAll {!it.file('build.gradle').exists() && it.file('bui
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
api project(':deps:extension-api')
implementation project(':deps:extension-api')
}
}

View File

@@ -20,7 +20,10 @@ ANDROID_BUILD_TARGET_SDK_VERSION=::ANDROID_TARGET_SDK_VERSION::
ANDROID_BUILD_MIN_SDK_VERSION=::ANDROID_MINIMUM_SDK_VERSION::
ANDROID_BUILD_SDK_VERSION=::ANDROID_TARGET_SDK_VERSION::
ANDROID_BUILD_TOOLS_VERSION=::ANDROID_BUILD_TOOLS_VERSION::
::if (ANDROID_TARGET_SDK_VERSION>=28)::
android.useAndroidX=::ANDROID_USE_ANDROIDX::
android.enableJetifier=::ANDROID_ENABLE_JETIFIER::
::end::
::if KEY_STORE::
KEY_STORE=::KEY_STORE::
KEY_STORE_PASSWORD=::KEY_STORE_PASSWORD::

View File

@@ -4,4 +4,6 @@
# Location of the SDK. This is only used by Gradle.
#
sdk.dir=::ANDROID_SDK_ESCAPED::
::if (ANDROID_GRADLE_PLUGIN<"4.0")::
ndk.dir=::ANDROID_NDK_ROOT_ESCAPED::
::end::

View File

@@ -1,6 +1,6 @@
buildscript {
repositories {
jcenter()
mavenCentral()
google()
}
@@ -17,5 +17,5 @@ android {
}
dependencies {
api project(':deps:extension-api')
implementation project(':deps:extension-api')
}

View File

@@ -451,7 +451,7 @@ class AndroidPlatform extends PlatformTarget
context.OUTPUT_DIR = targetDirectory;
context.ANDROID_INSTALL_LOCATION = project.config.getString("android.install-location", "auto");
context.ANDROID_MINIMUM_SDK_VERSION = project.config.getInt("android.minimum-sdk-version", 21);
context.ANDROID_TARGET_SDK_VERSION = project.config.getInt("android.target-sdk-version", 28);
context.ANDROID_TARGET_SDK_VERSION = project.config.getInt("android.target-sdk-version", 30);
context.ANDROID_EXTENSIONS = project.config.getArrayString("android.extension");
context.ANDROID_PERMISSIONS = project.config.getArrayString("android.permission", [
"android.permission.WAKE_LOCK",
@@ -459,8 +459,10 @@ class AndroidPlatform extends PlatformTarget
"android.permission.VIBRATE",
"android.permission.ACCESS_NETWORK_STATE"
]);
context.ANDROID_GRADLE_VERSION = project.config.getString("android.gradle-version", "5.6.3");
context.ANDROID_GRADLE_PLUGIN = project.config.getString("android.gradle-plugin", "3.5.1");
context.ANDROID_GRADLE_VERSION = project.config.getString("android.gradle-version", "7.4.2");
context.ANDROID_GRADLE_PLUGIN = project.config.getString("android.gradle-plugin", "7.3.1");
context.ANDROID_USE_ANDROIDX = project.config.getString("android.useAndroidX", "true");
context.ANDROID_ENABLE_JETIFIER = project.config.getString("android.enableJetifier", "false");
context.ANDROID_LIBRARY_PROJECTS = [];

View File

@@ -589,7 +589,7 @@ class PlatformSetup
Log.println("\x1b[1mIn order to build applications for Android, you must have recent");
Log.println("versions of the Android SDK, Android NDK and Java JDK installed.");
Log.println("");
Log.println("You must also install the Android SDK Platform-tools and API 19 using");
Log.println("You must also install the Android SDK Platform-tools and API 30 using");
Log.println("the SDK manager from Android Studio.\x1b[0m");
Log.println("");