|
14 | 14 | SCRCPY_DEBUG=false |
15 | 15 | SCRCPY_VERSION_NAME=1.19 |
16 | 16 |
|
17 | | -PLATFORM=${ANDROID_PLATFORM:-30} |
18 | | -BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-30.0.0} |
| 17 | +PLATFORM_VERSION=31 |
| 18 | +PLATFORM=${ANDROID_PLATFORM:-$PLATFORM_VERSION} |
| 19 | +BUILD_TOOLS=${ANDROID_BUILD_TOOLS:-31.0.0} |
19 | 20 |
|
20 | 21 | BUILD_DIR="$(realpath ${BUILD_DIR:-build_manual})" |
21 | 22 | CLASSES_DIR="$BUILD_DIR/classes" |
@@ -55,16 +56,33 @@ javac -bootclasspath "$ANDROID_JAR" -cp "$CLASSES_DIR" -d "$CLASSES_DIR" \ |
55 | 56 |
|
56 | 57 | echo "Dexing..." |
57 | 58 | cd "$CLASSES_DIR" |
58 | | -"$ANDROID_HOME/build-tools/$BUILD_TOOLS/dx" --dex \ |
59 | | - --output "$BUILD_DIR/classes.dex" \ |
60 | | - android/view/*.class \ |
61 | | - android/content/*.class \ |
62 | | - com/genymobile/scrcpy/*.class \ |
63 | | - com/genymobile/scrcpy/wrappers/*.class |
64 | 59 |
|
65 | | -echo "Archiving..." |
66 | | -cd "$BUILD_DIR" |
67 | | -jar cvf "$SERVER_BINARY" classes.dex |
68 | | -rm -rf classes.dex classes |
| 60 | +if [[ $PLATFORM_VERSION -lt 31 ]] |
| 61 | +then |
| 62 | + # use dx |
| 63 | + "$ANDROID_HOME/build-tools/$BUILD_TOOLS/dx" --dex \ |
| 64 | + --output "$BUILD_DIR/classes.dex" \ |
| 65 | + android/view/*.class \ |
| 66 | + android/content/*.class \ |
| 67 | + com/genymobile/scrcpy/*.class \ |
| 68 | + com/genymobile/scrcpy/wrappers/*.class |
| 69 | + |
| 70 | + echo "Archiving..." |
| 71 | + cd "$BUILD_DIR" |
| 72 | + jar cvf "$SERVER_BINARY" classes.dex |
| 73 | + rm -rf classes.dex classes |
| 74 | +else |
| 75 | + # use d8 |
| 76 | + "$ANDROID_HOME/build-tools/$BUILD_TOOLS/d8" --classpath "$ANDROID_JAR" \ |
| 77 | + --output "$BUILD_DIR/classes.zip" \ |
| 78 | + android/view/*.class \ |
| 79 | + android/content/*.class \ |
| 80 | + com/genymobile/scrcpy/*.class \ |
| 81 | + com/genymobile/scrcpy/wrappers/*.class |
| 82 | + |
| 83 | + cd "$BUILD_DIR" |
| 84 | + mv classes.zip "$SERVER_BINARY" |
| 85 | + rm -rf classes |
| 86 | +fi |
69 | 87 |
|
70 | 88 | echo "Server generated in $BUILD_DIR/$SERVER_BINARY" |
0 commit comments