Skip to main content

AbyssalBits — When My Emulator Ran An Old Build

NgDinhNha · DEVLOG

AbyssalBits — When My Emulator Ran An Old Build

I had fixed the bug in the code, but the emulator kept showing the broken version. The fresh build and install matched the current source. The build I was looking at was not the one I thought I was running.

View on Google Play
English

What happened when my emulator ran an old build

AbyssalBits is a pixel-art dark-fantasy action RPG and procedural dungeon crawler for Android. This is what happened when the emulator showed an old build.

The source was current and the game was old

After a round of cleanup, I launched the game on an Android emulator and it showed an old version label on the loading screen, along with older UI that I had already fixed. I opened the source and the newer implementation was right there. Nothing in the code explained what I was seeing.

Why it matters

When the running app disagrees with the source, the tempting move is to start debugging the code. That wastes time, because the code is not what you are looking at. Every test you do on a stale build tells you about an old version of the game.

What was done

So I treated it as a build and deploy problem first. I built a fresh debug APK from the checkout, installed it on the emulator, pulled the installed file back and compared checksums with the build output. They matched byte for byte, and the loading footer showed the current version label. The evidence points to stale local build and deploy state, not the code. What I could not do is name the exact cache or setting behind it.

For verification I also used Gradle's installDebug. In these test runs it did not use Android Studio's incremental delta deployment: it installed the whole APK through the package manager. A second run with 39 of 40 build tasks up to date still reinstalled the app. It was checked on an Android 16 emulator, the installed APK matched the fresh build, and the app launched with no crash. Android Studio has a matching setting, "Always install with package manager", and applying it in the IDE is left as an optional follow-up.

The lesson

Verify the build you are running before you debug the code. A checksum comparison between the installed APK and the one you just built takes a minute and tells you whether what you test is what you built. If something looks old, verify the installed build against the APK you just built before you touch the source.

Tiếng Việt

Chuyện gì đã xảy ra khi emulator chạy bản build cũ

AbyssalBits là game action RPG pixel art, bối cảnh kỳ ảo đen tối, chơi theo kiểu leo hầm ngục ngẫu nhiên trên Android. Đây là chuyện đã xảy ra khi emulator hiện một bản build cũ.

Mã nguồn đã mới, còn game thì cũ

Sau một đợt dọn dẹp, mình chạy game trên emulator Android và thấy màn hình tải hiện nhãn phiên bản cũ, cùng giao diện cũ mà mình đã sửa rồi. Mình mở mã nguồn ra và phần triển khai mới nằm ngay đó. Không có gì trong code giải thích được điều mình đang nhìn thấy.

Vì sao chuyện này quan trọng

Khi ứng dụng đang chạy không khớp với mã nguồn, phản xạ dễ gặp là bắt tay vào gỡ lỗi code. Làm vậy mất thời gian, vì code không phải thứ bạn đang nhìn. Mọi thử nghiệm trên một bản build cũ chỉ cho bạn biết về một phiên bản cũ của game.

Đã làm gì

Vì vậy mình xem đây trước hết là vấn đề build và triển khai. Mình build một APK debug mới từ thư mục làm việc, cài lên emulator, kéo file đã cài về và so checksum với kết quả build. Hai file khớp từng byte, và phần chân màn hình tải hiện đúng nhãn phiên bản hiện tại. Bằng chứng cho thấy đó là trạng thái build và triển khai cũ trên máy, không phải do code. Điều mình không làm được là chỉ ra chính xác bộ nhớ đệm hay thiết lập nào gây ra.

Để kiểm chứng, mình cũng dùng installDebug của Gradle. Trong các lần chạy thử này, nó không dùng cơ chế triển khai gia tăng (delta) của Android Studio: nó cài toàn bộ APK qua package manager. Một lần chạy thứ hai, khi 39 trên 40 tác vụ build đã cập nhật sẵn, vẫn cài lại ứng dụng. Mình kiểm tra trên emulator Android 16: APK đã cài khớp với bản build mới và ứng dụng khởi chạy không bị crash. Android Studio có một thiết lập tương ứng là "Always install with package manager", và việc áp dụng nó trong IDE được để lại như một việc tùy chọn làm sau.

Bài học

Hãy kiểm tra bản build bạn đang chạy trước khi gỡ lỗi code. So checksum giữa APK đã cài và APK vừa build chỉ mất một phút và cho biết thứ bạn đang thử có đúng là thứ bạn đã build hay không. Nếu có gì trông cũ, hãy kiểm tra bản build đã cài so với APK bạn vừa build trước khi đụng vào mã nguồn.

日本語

エミュレーターが古いビルドを動かしていたときの話

AbyssalBits は Android 向けの、ダンジョンを探索するピクセルアートのダークファンタジー・アクション RPG です。エミュレーターに古いビルドが表示されたときに起きたことをまとめます。

ソースは最新なのに、ゲームは古かった

整理作業のあと、Android エミュレーターでゲームを起動すると、ローディング画面に古いバージョン表記が出て、すでに直したはずの古い UI も表示されました。ソースを開くと、新しい実装はちゃんとそこにありました。目の前の挙動を説明できるものは、コードの中にありませんでした。

なぜ重要か

動いているアプリがソースと食い違うと、すぐコードのデバッグを始めたくなります。しかし見ているのはコードではないので、時間の無駄です。古いビルドでしたテストは、すべてゲームの古いバージョンについて教えてくれるだけです。

やったこと

そこで、まずビルドとデプロイの問題として扱いました。チェックアウトから新しいデバッグ APK をビルドしてエミュレーターにインストールし、インストールされたファイルを取り出して、ビルド出力とチェックサムを比べました。バイト単位で一致し、ローディング画面のフッターには現在のバージョン表記が表示されていました。証拠からは、コードではなく、ローカルの古いビルドとデプロイの状態だったと考えられます。原因の具体的なキャッシュや設定までは特定できていません。

検証のために Gradle の installDebug も使いました。今回のテスト実行では、Android Studio の差分デプロイは使われず、APK 全体がパッケージマネージャー経由でインストールされました。ビルドタスク 40 件のうち 39 件が最新の状態だった 2 回目の実行でも、アプリは再インストールされました。Android 16 のエミュレーターで確認し、インストールされた APK は新しいビルドと一致し、アプリはクラッシュせずに起動しました。Android Studio にも同じ働きの設定「Always install with package manager」があり、IDE でのその適用は任意の後続作業として残しています。

この教訓

コードをデバッグする前に、動かしているビルドを確かめましょう。インストールされた APK と今ビルドした APK のチェックサム比較は 1 分で済み、テストしているものがビルドしたものかどうかが分かります。古く見えるなら、ソースに手を付ける前に、インストールされたビルドを今ビルドした APK と照合しましょう。

Comments

Popular Posts

Hướng dẫn sửa lỗi "File is changed: W[2007] L[2]" Đột Kích

Đây là lỗi game rất nhiều người (trong đó có mình mắc phải). Tuy nhiên khi lên diễn đàn hỏi thì các MOD đều trả lời 1 câu là tải game về cài lại rồi close luôn topic. Mình rất không hài lòng về điều đó. Hình ảnh ví dụ về lỗi : Và dưới đây là cách mình sửa. Tải trên mạng File bị lỗi (Có ghi tên file khi CF thông báo lỗi) hoặc copy từ máy tính khác về. Replace vào thư mục của nó. Vậy là ok. Các bạn nào hỏng file nào thì tải về rồi replace nó. Nếu ko có thì comment ở dưới, mình sẽ upload sớm nhất có thể cho các bạn. Video hướng dẫn :

Vì sao nên chơi LOL server NA (Bắc Mĩ)

Dưới đây là những lí do mình khuyên bạn nên chơi Liên minh server Bắc Mỹ : 1. Giá 1 số tướng rẻ hơn server VN 2. Chế độ chọn tướng, chọn vị trí rồi mới chọn đội 3. Quà tặng cho tân thủ nhiều hơn (Tristana (tướng + skin) + Alistar (tướng + skin)) 4. Nhiều icon cho bạn lựa chọn 5. Số lượng gói combo nhiều hơn 6. Có thể chuyển tài khoản đến các vùng khác trên thế giới  7. Có thể hoàn lại những vật phẩm đã mua (Cả bằng IP lẫn RP) 8. Trình độ bên đó cao hơn hẳn server VN và ko có trẻ trâu, cãi nhau rất ít. Hướng dẫn chuyển server VN sang NA :  http://ngdinhnha.blogspot.com/2014/04/chia-se-huong-dan-choi-lol-tat-ca.html Tải game tại :  https://signup.leagueoflegends.com/en/signup/redownload Đăng kí  tài khoản LOL NA tại :  https://signup.leagueoflegends.com/en/signup/index

Domyra — A Strategy of Connected Fronts

Domyra · Android Command the front. Connect the realm. Domyra is a portrait-first real-time strategy game about moving armies between connected territories, choosing when to commit, and shaping a two-skill loadout for each battle. English Tiếng Việt 日本語 A connected map, a changing front Move with purpose Send an army from one territory to another, reinforce friendly positions, and contest enemy ground across a network of connected nodes. Captured territory joins your side's production, so every advance changes the shape of the battle. Read the battlefield City, fortress, shrine and hazard territories create different tactical considerations. Face rival factions in free-for-all battles, protect your borders and choose when to spend a skill. Build a campaign Advance through twelve campaign fronts with briefings, optional objectives and earned stars. Improve skills, choose two for your loadout, and continue with locally saved progress. Designed for portrait play...