update to SDK 35 (Android 15), update versionString

This commit is contained in:
Anthony Calosa
2024-10-09 21:25:29 +08:00
parent 644fa46681
commit abdff9bb15
9 changed files with 53 additions and 40 deletions

View File

@@ -43,8 +43,8 @@ jobs:
uses: maxim-lobanov/setup-android-tools@v1
with:
packages: |
platforms;android-34
build-tools;34.0.0
platforms;android-35
build-tools;35.0.0
- name: Install virtual framebuffer (if not available) to allow running GUI on a headless server
run: |
@@ -83,7 +83,7 @@ jobs:
- name: Build/Install/Publish to GitHub Packages Apache Maven
run: |
export _JAVA_OPTIONS="-Xmx2g"
mvn -U -B -P android-release-build,android-release-upload install -e -Dcardforge-repo.username=${{ secrets.FTP_USERNAME }} -Dcardforge-repo.password=${{ secrets.FTP_PASSWORD }} -Dandroid.sdk.path=/usr/local/lib/android/sdk -Dandroid.buildToolsVersion=34.0.0 -Dmaven.test.skip=true
mvn -U -B -P android-release-build,android-release-upload install -e -Dcardforge-repo.username=${{ secrets.FTP_USERNAME }} -Dcardforge-repo.password=${{ secrets.FTP_PASSWORD }} -Dandroid.sdk.path=/usr/local/lib/android/sdk -Dandroid.buildToolsVersion=35.0.0 -Dmaven.test.skip=true
env:
GITHUB_TOKEN: ${{ github.token }}

View File

@@ -46,8 +46,8 @@ jobs:
- name: Set Up Android tools
run: |
JAVA_HOME=${JAVA_HOME_17_X64} ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT "platform-tools"
JAVA_HOME=${JAVA_HOME_17_X64} ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --install "platforms;android-33"
JAVA_HOME=${JAVA_HOME_17_X64} ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --install "build-tools;34.0.0"
JAVA_HOME=${JAVA_HOME_17_X64} ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --install "platforms;android-35"
JAVA_HOME=${JAVA_HOME_17_X64} ${ANDROID_SDK_ROOT}/cmdline-tools/latest/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT --install "build-tools;35.0.0"
- name: Install virtual framebuffer (if not available) to allow running GUI on a headless server
run: |
@@ -89,7 +89,7 @@ jobs:
d=$(date +%m-%d)
# Replace date in forge-gui-mobile/src/forge/Forge.java
sed -i -e "s/-SNAPSHOT/-SNAPSHOT-${d}/g" forge-gui-mobile/src/forge/Forge.java
mvn -U -B -P android-release-build install -e -Dcardforge-repo.username=${{ secrets.FTP_USERNAME }} -Dcardforge-repo.password=${{ secrets.FTP_PASSWORD }} -Dandroid.sdk.path=/usr/local/lib/android/sdk -Dandroid.buildToolsVersion=34.0.0 -Dmaven.test.skip=true
mvn -U -B -P android-release-build install -e -Dcardforge-repo.username=${{ secrets.FTP_USERNAME }} -Dcardforge-repo.password=${{ secrets.FTP_PASSWORD }} -Dandroid.sdk.path=/usr/local/lib/android/sdk -Dandroid.buildToolsVersion=35.0.0 -Dmaven.test.skip=true
mkdir -p forge-gui-android/target/upload
mv forge-gui-android/target/*-signed-aligned.apk forge-gui-android/target/upload/
mv forge-gui-android/target/assets.zip forge-gui-android/target/upload/

View File

@@ -83,12 +83,11 @@ Google no longer supports Android SDK releases for Eclipse. use IntelliJ.
#### Android SDK
Reference SO for obtaining a specific release: https://stackoverflow.com/questions/27043522/where-can-i-download-an-older-version-of-the-android-sdk
TBD
##### Windows
Download the following archived version of the Android SDK: http://dl-ssl.google.com/android/repository/tools_r25.2.3-windows.zip. Install it somewhere on your machine. This is referenced
in the following instructions as your 'Android SDK Install' path.
TBD
##### Linux / Mac OSX
@@ -102,8 +101,8 @@ TBD
In Intellij, if the SDK Manager is not already running, go to Tools > Android > Android SDK Manager. Install the following options / versions:
- Android SDK Build-tools 34.0.0
- Android 14 (API 34) SDK Platform
- Android SDK Build-tools 35.0.0
- Android 15 (API 35) SDK Platform
#### Proguard update

View File

@@ -6,7 +6,7 @@
<uses-sdk
android:minSdkVersion="26"
android:targetSdkVersion="34" />
android:targetSdkVersion="35" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <!-- This one needs Android Runtime Permission for Android 6+ -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

View File

@@ -8,7 +8,8 @@
<build.min.memory>-Xms1024m</build.min.memory>
<build.max.memory>-Xmx1536m</build.max.memory>
<alpha-version>${revision}</alpha-version>
<alpha-versionCode>2</alpha-versionCode>
<!-- the previous android:versionCode was 106650000, so it must be larger or it will not be installed -->
<alpha-versionCode>200000000</alpha-versionCode>
<sign.keystore>keystore</sign.keystore>
<sign.alias>alias</sign.alias>
<sign.storepass>storepass</sign.storepass>
@@ -58,7 +59,7 @@
<dependency>
<groupId>org.robolectric</groupId>
<artifactId>android-all</artifactId>
<version>14-robolectric-10818077</version>
<version>15-robolectric-12468137</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -226,8 +227,8 @@
<debug>true</debug>
</sign>
<sdk>
<platform>34</platform>
<buildTools>34.0.0</buildTools>
<platform>35</platform>
<buildTools>35.0.0</buildTools>
</sdk>
<dexForceJumbo>true</dexForceJumbo>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
@@ -344,8 +345,8 @@
<debug>false</debug>
</sign>
<sdk>
<platform>34</platform>
<buildTools>34.0.0</buildTools>
<platform>35</platform>
<buildTools>35.0.0</buildTools>
</sdk>
<zipalign>
<verbose>false</verbose>

View File

@@ -13,6 +13,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.graphics.Bitmap;
@@ -82,6 +83,7 @@ public class Main extends AndroidApplication {
private View forgeLogo = null, forgeView = null, activeView = null;
private ProgressBar progressBar;
private TextView progressText;
private String versionString;
private AndroidClipboard getAndroidClipboard() {
if (androidClipboard == null)
@@ -132,6 +134,12 @@ public class Main extends AndroidApplication {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
PackageInfo pInfo = getContext().getPackageManager().getPackageInfo(getContext().getPackageName(), 0);
versionString = pInfo.versionName;
} catch (Exception e) {
versionString = "0.0";
}
setContentView(getResources().getIdentifier("main", "layout", getPackageName()));
mShortAnimationDuration = getResources().getInteger(android.R.integer.config_shortAnimTime);
sharedPreferences = getPreferences(Context.MODE_PRIVATE);
@@ -280,7 +288,7 @@ public class Main extends AndroidApplication {
private void loadGame(final String title, final String steps, boolean isLandscape, AndroidAdapter adapter, boolean permissiongranted, int totalRAM, boolean isTabletDevice, AndroidApplicationConfiguration config, boolean exception, String msg) {
try {
forgeLogo = findViewById(getResources().getIdentifier("logo_id", "id", getPackageName()));
forgeView = initializeForView(Forge.getApp(getAndroidClipboard(), adapter, ASSETS_DIR, false, !isLandscape, totalRAM, isTabletDevice, Build.VERSION.SDK_INT, Build.VERSION.RELEASE, getDeviceName()), config);
forgeView = initializeForView(Forge.getApp(getAndroidClipboard(), adapter, ASSETS_DIR, false, !isLandscape, totalRAM, isTabletDevice, Build.VERSION.SDK_INT, Build.VERSION.RELEASE, getDeviceName(), versionString), config);
getAnimator(ObjectAnimator.ofFloat(forgeLogo, "alpha", 0f, 1f).setDuration(1800), null, new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
@@ -378,8 +386,9 @@ public class Main extends AndroidApplication {
private AnimatorSet getAnimator(Animator play, Animator with, AnimatorListenerAdapter adapter) {
AnimatorSet animatorSet = new AnimatorSet();
if (with != null)
animatorSet.play(play).with(with);
if (with != null) {
animatorSet.playTogether(play, with);
}
else
animatorSet.play(play);
animatorSet.addListener(adapter);

View File

@@ -17,6 +17,7 @@ import java.nio.file.Paths;
public class GameLauncher {
public GameLauncher() {
String versionString = BuildInfo.getVersionString();
// Set this to "true" to make the mobile game port run as a full-screen desktop application
boolean desktopMode = true;//cmd.hasOption("fullscreen");
// Set this to the location where you want the mobile game port to look for assets when working as a full-screen desktop application
@@ -44,7 +45,7 @@ public class GameLauncher {
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setResizable(false);
ApplicationListener start = Forge.getApp(new Lwjgl3Clipboard(), new Main.DesktopAdapter(switchOrientationFile),//todo get totalRAM && isTabletDevice
desktopMode ? desktopModeAssetsDir : assetsDir, false, false, 0, false, 0, "", "");
desktopMode ? desktopModeAssetsDir : assetsDir, false, false, 0, false, 0, "", "", versionString);
if (Config.instance().getSettingData().fullScreen) {
config.setFullscreenMode(Lwjgl3ApplicationConfiguration.getDisplayMode());
config.setAutoIconify(true);
@@ -52,7 +53,7 @@ public class GameLauncher {
} else {
config.setWindowedMode(Config.instance().getSettingData().width, Config.instance().getSettingData().height);
}
config.setTitle("Forge - " + BuildInfo.getVersionString());
config.setTitle("Forge - " + versionString);
config.setWindowListener(new Lwjgl3WindowAdapter() {
@Override
public boolean closeRequested() {

View File

@@ -54,7 +54,7 @@ import java.nio.file.Paths;
import java.util.*;
public class Forge implements ApplicationListener {
public static final String CURRENT_VERSION = "1.6.65-SNAPSHOT";
public static String CURRENT_VERSION = "0.0";
private static ApplicationListener app = null;
static Scene currentScene = null;
@@ -127,20 +127,23 @@ public class Forge implements ApplicationListener {
public static boolean createNewAdventureMap = false;
private static Localizer localizer;
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean value, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName) {
app = new Forge();
if (GuiBase.getInterface() == null) {
clipboard = clipboard0;
deviceAdapter = deviceAdapter0;
GuiBase.setUsingAppDirectory(assetDir0.contains("forge.app")); //obb directory on android uses the package name as entrypoint
GuiBase.setInterface(new GuiMobile(assetDir0));
GuiBase.enablePropertyConfig(value);
isPortraitMode = androidOrientation;
totalDeviceRAM = totalRAM;
isTabletDevice = isTablet;
androidVersion = AndroidAPI;
public static ApplicationListener getApp(Clipboard clipboard0, IDeviceAdapter deviceAdapter0, String assetDir0, boolean propertyConfig, boolean androidOrientation, int totalRAM, boolean isTablet, int AndroidAPI, String AndroidRelease, String deviceName, String versionString) {
if (app == null) {
app = new Forge();
if (GuiBase.getInterface() == null) {
CURRENT_VERSION = versionString;
clipboard = clipboard0;
deviceAdapter = deviceAdapter0;
GuiBase.setUsingAppDirectory(assetDir0.contains("forge.app")); //obb directory on android uses the package name as entrypoint
GuiBase.setInterface(new GuiMobile(assetDir0));
GuiBase.enablePropertyConfig(propertyConfig);
isPortraitMode = androidOrientation;
totalDeviceRAM = totalRAM;
isTabletDevice = isTablet;
androidVersion = AndroidAPI;
}
GuiBase.setDeviceInfo(deviceName, AndroidRelease, AndroidAPI, totalRAM);
}
GuiBase.setDeviceInfo(deviceName, AndroidRelease, AndroidAPI, totalRAM);
return app;
}

View File

@@ -3,6 +3,6 @@ This file contains the current build notes for Forge.
-- Compiling Forge for Android: Pre-requisites --
When compiling Forge for Android, make sure the following prerequisites are met:
Java 17, either Oracle or OpenJDK.
Android SDK 34
Android Build-Tools 34 (this is important, build-tools 33 and below do not work with Java 17)
Proguard 7.5.0 (proguard.jar included under "forge-gui-android/tools").
Android SDK 35
Android Build-Tools 35.0.0 (this is important, build-tools 33 and below do not work with Java 17)
Proguard 7.6.0 (proguard.jar included under "forge-gui-android/tools").