Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bartekpacia committed Sep 6, 2024
1 parent 36bdb1a commit b2be6d6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
env:
ANDROID_HOME: /home/runner/androidsdk
ANDROID_SDK_ROOT: /home/runner/androidsdk
ANDROID_USER_HOME: /home/runner/.android
ANDROID_OS_IMAGE: system-images;android-29;google_apis;x86_64

steps:
Expand Down Expand Up @@ -78,8 +79,6 @@ jobs:
--package "$ANDROID_OS_IMAGE" \
--name "MyAVD"
- name: Configure AVD
run: |
cat << EOF >> ~/.android/avd/MyAVD.avd/config.ini
hw.cpu.ncore=2
hw.gpu.enabled=yes
Expand Down
5 changes: 4 additions & 1 deletion dadb/src/main/kotlin/dadb/AdbStream.kt
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ internal class AdbStreamImpl internal constructor(
val bytesWritten = source.read(buffer.array(), buffer.position(), bytesToWrite)

// Cast to prevent NoSuchMethodError when mixing Java versions
// Learn more: https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/
// Learn more: https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror
(buffer as java.nio.Buffer).position(buffer.position() + bytesWritten)
if (buffer.remaining() == 0) flush()

Expand All @@ -103,6 +103,9 @@ internal class AdbStreamImpl internal constructor(

override fun flush() {
adbWriter.writeWrite(localId, remoteId, buffer.array(), 0, buffer.position())

// Cast to prevent NoSuchMethodError when mixing Java versions
// Learn more: https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror
(buffer as java.nio.Buffer).clear()
}

Expand Down

0 comments on commit b2be6d6

Please sign in to comment.