Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple issues trying to set up dev environment #178

Open
jasmeralia opened this issue Jul 19, 2021 · 12 comments
Open

Multiple issues trying to set up dev environment #178

jasmeralia opened this issue Jul 19, 2021 · 12 comments

Comments

@jasmeralia
Copy link

I've been working on trying to get gradle/kotlin/etc set up on one of my machines so I can debug changes for Android 11 access, and I'm running into some issues. Even if I check out the saf branch and run scripts/ci.sh, I fail some of the tests like so:

> Task :kotlin-hslog:jvmTest

net.hearthsim.hslog.PowerParserTest[jvm] > battlegrounds heroes are correctly detected[jvm] FAILED
    java.lang.AssertionError at PowerParserTest.kt:253

net.hearthsim.hslog.PowerParserTest[jvm] > battlegrounds games are correctly parsed[jvm] FAILED
    java.lang.AssertionError at PowerParserTest.kt:220

9 tests completed, 2 failed

> Task :kotlin-hslog:jvmTest FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':kotlin-hslog:jvmTest'.

I've attached the test output as a zip file: jvmTestLog.zip

I can work around these failures by updating line 220 to be KING_MUKLA2 instead of KING_MUKLA1 and line 253 to be LORD_JARAXXUS3 from LORD_JARAXXUS2, but I'm not really understanding why I would need to do so... I would have assumed that the tests for a given build would be passing with the log files contained in that build? I'll note that I specifically avoided running scripts/update_card_json.kts to prevent the card DB getting updated and causing the testing code to fail.

Once I get past the jvmTest errors, I have some problems with the Gradle daemon crashing, which seems to be based on some plugin versions and the kotlin version I had installed (from homebrew).

w: Skipping "/Users/nclemons/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio-macosx64/2.5.0/f74ced137964a3d37c7dd95a4aa48c090e257def/okio.klib" as it is a pre 1.4 library
e: Could not find "/Users/nclemons/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio-macosx64/2.5.0/f74ced137964a3d37c7dd95a4aa48c090e257def/okio.klib" in [/Users/nclemons/git/stormerider/Arcane-Tracker-stock-saf, /Users/nclemons/.konan/klib, /Users/nclemons/.konan/kotlin-native-prebuilt-macos-1.4.31/klib/common, /Users/nclemons/.konan/kotlin-native-prebuilt-macos-1.4.31/klib/platform/macos_x64].
Daemon vm is shutting down... The daemon has exited normally or was terminated in response to a user interrupt.
----- End of the daemon log -----


FAILURE: Build failed with an exception.

* What went wrong:
Gradle build daemon disappeared unexpectedly (it may have been killed or may have crashed)

I see that scripts/ci.sh uses sdkman to install kotlin and kscript, but it doesn't actually specify any versions in that script, nor is there a .sdkmanrc file in the repository for versions to be specified. Digging further, I found that buildSrc/build.gradle.kts points at version 1.4.31, but even after removing other versions and letting gradle install 1.4.31 for me, it's still erroring on the okio dependency.

I've also been unable to run ./gradlew :detector:pushTrainingData to see if that code is working on my setup, but that fails with:

FAILURE: Build failed with an exception.

* What went wrong:
Task 'pushTrainingData' not found in project ':detector'.

* Try:
Run gradlew tasks to get a list of available tasks. Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

I see the Kotlin code to add it as a build task in DetectorPlugin.kt, is there a particular gradle task that I have to run before being able to run the detector code? I'm pretty new to working on iOS/Android builds, most of my experience has been with other languages, so I'm not really familiar with gradle internals.

@martinbonnin
Copy link
Collaborator

Hi 👋 , sorry about that, the CI (as well as the project in general) hasn't been super maintained lately. I'd recommend using Gradle directly instead of ci.sh:

cp app/google-services.json.mock app/google-services.json
 ./gradlew assembleDebug
# you now have an apk in app/build/outputs/apk/debug/app-debug.apk

To edit the code, I'd use the latest version of IntelliJ commmunity instead of Android Studio but haven't checked that in a while so your milage may vary.

@jasmeralia
Copy link
Author

Thanks, using Android Studio and IntelliJ, I've run into much fewer issues than trying to get thing running from the CLI. Not entirely sure why, but I'll take it. I'm curious as to the IntelliJ suggestion, is it really worth the extra $? It looks pretty similar to Android Studio to me, but I might be missing some things.

@martinbonnin
Copy link
Collaborator

IntelliJ community is free and has most of what's needed for development. It usually has better support for Kotlin multiplatform that this project uses but TBH, it's not without issues.

@jasmeralia
Copy link
Author

Ah, good to know, thanks.

I’m still getting the error on the detector app from the CLI, and I don’t see any grade task for it in the IDE. I did get a warning in game that it had issues trying to detect my rank, so I’m guessing I need to run that to get things updated.

@Dracklifex
Copy link

🙏🏻

@jasmeralia
Copy link
Author

In my fork, I’ve updated for the mini set and the cosmetic bartenders. I have not yet tried to add support for Stormwind.

I’m also not sure if the permission checks for MANAGE_EXTERNAL_ACCESS will cause issues on lower versions of Android, or if the API will indicate they have the access to a permission not supported at that API level. Any feedback on that front would help.

I’ll probably try to work on Stormwind this weekend, but I don’t currently really understand the logic around how secret detection is handled. Likewise, I want to try to work on fixing things for Duels, but I’m not sure where to start there. Does Arcane Tracker write its own logs somewhere, or do I need to have an active adb debug session open to see what’s going on?

Im also interested in signing the CLA to help out more directly.

@Dracklifex
Copy link

Android 11 support 😢

@jasmeralia
Copy link
Author

@martinbonnin: After looking into United in Stormwind in more detail, I realized there were no new secrets, so that concern is moot for now.

I have the warning message from the app about the detector here: Screenshot_20210817-015628_Hearthstone - it definitely looks like the push of the training data and generation of rank data need to occur, but I still can't see a way to do so. I see the tasks created via a Gradle plugin applied to the detector app, but if I look at the Gradle task list it doesn't show up, and using -q doesn't help, either. I'm at a bit of a loss as to how to proceed. That said, the app works; it's just kind of spammy with regards to that pop-up. Oh, I also noticed some of the code/markdown files for the detector reference net.arcanetracker.detector and some reference net.mbonnin.arcanetracker.detector. Could that be causing some of the problems with Gradle not loading it?

@Viktor1926
Copy link

Does the overlay say No Hearthstone logs found for you even after your changes @stormerider ? I've tried running your branch and eventually got it to build. When I open the app+hs it still says that it can't find my logs. Is there a way to check if the permission functionality is successful? I haven't used arcane tracker before but have experience with Android apps and I am keen to help.

@jasmeralia
Copy link
Author

Does the overlay say No Hearthstone logs found for you even after your changes @stormerider ? I've tried running your branch and eventually got it to build. When I open the app+hs it still says that it can't find my logs. Is there a way to check if the permission functionality is successful? I haven't used arcane tracker before but have experience with Android apps and I am keen to help.

I don't get that error and it was working after the update for the last patch (I haven't played much since then, though; things have been too hectic IRL).

First, check the app permissions via Settings > Apps > Arcane Tracker > Permissions.
Screenshot_20210913-213622_Settings
You should see the Storage permission for All files.
Screenshot_20210913-213629_Permission controller
If you see it is Denied, correct that and restart Arcane Tracker.

I will note that once the permissions are fixed, you need to ensure that Hearthstone is fully loaded before starting Arcane Tracker. If Arcane Tracker is what launches Hearthstone, the log files get reopened by Hearthstone and the log messages aren't read by Arcane Tracker. I haven't had any time to investigate a workaround for that. Likewise, if you have to restart Hearthstone (possibly also if you idle out and need to reconnect? Not entirely sure on that score), you need to restart Arcane Tracker afterwards.

I'd really love to get a PR raised, but I haven't heard back on information about the CLA that I would need to complete to do so. And as Arcane Tracker is not under an Open Source license, I can't provide builds of any kind, but I am trying to keep my branch updated each patch for others to build from if they want. I'm glad you were able to successfully build it; hopefully the two things I mentioned will make it work for you.

I'm not sure if I'll be able to figure out necessary changes for new secret cards or card sets being rotated out in future sets, though. I was able to support United in Stormwind only because there were no new secrets and no rotation was involved. Likewise, I don't think I'll be able to fix tracking for Duels mode; I simply don't understand the code well enough to address the issue, although I've captured debug logs for a Duels game vs a Practice game. It seems like a part of the image based detection is failing and it throws an error around that, but I'm not sure what it's looking for to determine why it's breaking. There are a number of things that I can think of as possibilities, such as if it were trying to check ladder rank or something present in normal Adventures that is not displayed in the Duels mode. I'd really be happy if I could help resolve that, as I've been finding Duels more enjoyable lately than Standard.

@Viktor1926
Copy link

I actually got it working properly shortly after writing my comment - everything that you've noted I've experienced too - from the permission to starting hearthstone before Arcane Tracker.
I am mostly playing battlegrounds so I can't really help with Duels problems - I've never really played it...
I noticed that the "Record screen" dialog only appears when you play your 2nd game (if playing normal hearthstone, no dialog at all for battlegrounds).
Another thing to note is that it seems like the Tracker gets "slow" at some point - you only see results (opponent board in tracker when playing BGs) a good while after actually playing that opponent. Haven't figured out why yet.

On the patch support - I couldn't work out what's the new process for adding new cards - I saw the two gradle tasks (mentioned in the developer readme) which for some reason aren't really registered when I open the project in Android Studio - I registered them manually but they still fail.

I'll try to follow your branch and also happy to provide a 2nd pair of eyes or any other help possible, drop me a message if needed and thanks for your effort to keep this moving.

@jasmeralia
Copy link
Author

On the patch support - I couldn't work out what's the new process for adding new cards - I saw the two gradle tasks (mentioned in the developer readme) which for some reason aren't really registered when I open the project in Android Studio - I registered them manually but they still fail.

There's a kscript file that you have to run to update things like so:

[ryder Arcane-Tracker (android11)]$ scripts/update_card_json.kts 
https://api.hearthstonejson.com/v1/latest/all/cards.json...done.
done.
[ryder Arcane-Tracker (android11)]$

That will update app/src/main/res/raw/cards.json and kotlin-hsmodel/src/commonMain/kotlin/net/hearthsim/hsmodel/enum/CardId.kt.

If you run it on my branch at the moment, you'll see it doesn't actually update either file, since my branch is current with the JSON hosted at that URL. (I've periodically checked to make sure the various Battlegrounds heroes that have appeared in the shop haven't caused it to get updated.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants