Forge Android App
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
Re: Forge Android App
by Myrd » 30 Dec 2014, 18:57
Are there any instructions somewhere on how to build forge for Android when developing?
I've been trying to get it to work without luck. (I want to actually build an APK to deploy to my phone - I realise that I can also test on desktop using forge-mobile-dev).
I've been trying to get Eclipse to be able to run/debug the app on the device, but with no luck. Is this simply not a supported use case and I have to do things from mvn command-line? If so, what's the right way to do this? (Sorry, I don't know mvn and it doesn't seem to be very user friendly - a lot of cryptic goals and such - not sure what I should be running.)
Would be very helpful if the docs for this were posted on the wiki, so it would benefit others too. Thanks!
I've been trying to get it to work without luck. (I want to actually build an APK to deploy to my phone - I realise that I can also test on desktop using forge-mobile-dev).
I've been trying to get Eclipse to be able to run/debug the app on the device, but with no luck. Is this simply not a supported use case and I have to do things from mvn command-line? If so, what's the right way to do this? (Sorry, I don't know mvn and it doesn't seem to be very user friendly - a lot of cryptic goals and such - not sure what I should be running.)
Would be very helpful if the docs for this were posted on the wiki, so it would benefit others too. Thanks!
Re: Forge Android App
by drdev » 30 Dec 2014, 19:03
You need to do a Maven build using this goal:
-U -B -e clean -P android-debug install
-U -B -e clean -P android-debug install
- drdev
- Programmer
- Posts: 1958
- Joined: 27 Jul 2013, 02:07
- Has thanked: 189 times
- Been thanked: 565 times
Re: Forge Android App
by Myrd » 30 Dec 2014, 19:33
Okay, will try that.
By the way, one thing I noticed that can help with method limit is to cut the dependency on freemarker (which is a 1MB jar). Looks like it's only used by DeckHtmlSerializer which is only referenced from the desktop code.
By the way, one thing I noticed that can help with method limit is to cut the dependency on freemarker (which is a 1MB jar). Looks like it's only used by DeckHtmlSerializer which is only referenced from the desktop code.
Re: Forge Android App
by Myrd » 30 Dec 2014, 19:40
From the Eclipse UI right?drdev wrote:You need to do a Maven build using this goal:
-U -B -e clean -P android-debug install
When I do that, I get the following error:
- Code: Select all
1) No implementation for org.eclipse.aether.impl.ArtifactDescriptorReader was bound.
while locating org.eclipse.aether.internal.impl.DefaultRepositorySystem
at ClassRealm[extension>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.1, parent: sun.misc.Launcher$AppClassLoader@b2fd8f]
at ClassRealm[extension>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.1, parent: sun.misc.Launcher$AppClassLoader@b2fd8f]
while locating org.eclipse.aether.RepositorySystem
while locating com.jayway.maven.plugins.android.phase_prebuild.AarMavenLifecycleParticipant
at ClassRealm[extension>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.1, parent: sun.misc.Launcher$AppClassLoader@b2fd8f]
at ClassRealm[extension>com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.9.0-rc.1, parent: sun.misc.Launcher$AppClassLoader@b2fd8f]
while locating org.apache.maven.AbstractMavenLifecycleParticipant annotated with @com.google.inject.name.Named(value=AarMavenLifecycleListener)
Has anyone had this problem before and managed to resolve it? If not, perhaps you're using a different version of Eclipse maven plugin? If so, which one?
EDIT: Nevermind, looks like the Maven Plugin version is specified in the pom.xml file in the project. I wonder why -rc1 is specified there given it actually appears to have problems with forge.
Re: Forge Android App
by Myrd » 30 Dec 2014, 21:06
I've now committed this change, which was actually necessary for my build to work (as I was hitting the 65k method limit). Woot!Myrd wrote:By the way, one thing I noticed that can help with method limit is to cut the dependency on freemarker (which is a 1MB jar). Looks like it's only used by DeckHtmlSerializer which is only referenced from the desktop code.
However, I can't seem to use the DDMS android dev tools from Eclipse on the app built through Maven. I was hoping to investigate some GC performance issues I saw with the alloc analyzer. Any idea on how to get this to work? If not, I can try to figure it out.
EDIT: Looks like its just a matter of adding android:debuggable="true" to the manifest.
Re: Forge Android App
by Myrd » 31 Dec 2014, 05:12
I've been observing a freezing issue with the Forge Android app. It usually happens when some number of permanents are removed from the battlefield - e.g. from an Eldrazi attack or e.g. Armageddon.
What happens is the UI freezes and eventually the system kills the app. I found that some call stacks are saved when this happens, and here's what they look like:
I looked at how this linked list is set up, and there's two places that set these - one adds to the list and another nulls out a card's next/prev links. While the latter is strange because it doesn't update the prev's next link or the next's prev link, I don't see how that would result in a cycle.
My other theory is there's a multi-thread access issue going on here - i.e. either two threads try to stack cards at the same time - or perhaps cards are being stacked while their state is being edited by the main thread. But I'm not familiar with the threading set up of Forge here. What ensures that the GL thread (which appears to be setting up stacking based on game state) doesn't act on inconsistent state due to it being modified by the game thread?
What happens is the UI freezes and eventually the system kills the app. I found that some call stacks are saved when this happens, and here's what they look like:
- Code: Select all
"Game-0" prio=5 tid=18 WAIT
| group="main" sCount=1 dsCount=0 obj=0x45904778 self=0x7a5f6870
| sysTid=22731 nice=0 sched=0/0 cgrp=apps handle=2053074120
| state=S schedstat=( 69016492136 12658408178 780673 ) utm=5377 stm=1524 core=1
at java.lang.Object.wait(Native Method)
- waiting on <0x45903a70> (a java.lang.VMThread) held by tid=18 (Game-0)
at java.lang.Thread.parkFor(Thread.java:1205)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:813)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:973)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1281)
at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:202)
at forge.match.input.InputSyncronizedBase.awaitLatchRelease(InputSyncronizedBase.java:21)
at forge.match.input.InputSyncronizedBase.showAndWait(InputSyncronizedBase.java:34)
at forge.player.PlayerControllerHuman.chooseSpellAbilityToPlay(PlayerControllerHuman.java:892)
at forge.game.phase.PhaseHandler.startFirstTurn(PhaseHandler.java:917)
at forge.game.GameAction.startGame(GameAction.java:1383)
at forge.game.Match.startGame(Match.java:71)
at forge.match.MatchUtil$2.run(MatchUtil.java:201)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
"GLThread 59682" prio=5 tid=11 SUSPENDED
| group="main" sCount=1 dsCount=0 obj=0x425d8fd0 self=0x75a81008
| sysTid=22593 nice=0 sched=0/0 cgrp=apps handle=1973949536
| state=S schedstat=( 266790584294 24654784951 953037 ) utm=24666 stm=2013 core=0
at forge.screens.match.views.VField.tryStackCard(VField.java:~112)
at forge.screens.match.views.VField.access$1(VField.java:98)
at forge.screens.match.views.VField$1.run(VField.java:74)
at forge.FThreads.invokeInEdtNowOrLater(FThreads.java:32)
at forge.screens.match.views.VField.update(VField.java:44)
at forge.screens.match.MatchController.refreshCardDetails(MatchController.java:81)
at forge.control.FControlGameEventHandler$1.run(FControlGameEventHandler.java:94)
at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:409)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1523)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
I looked at how this linked list is set up, and there's two places that set these - one adds to the list and another nulls out a card's next/prev links. While the latter is strange because it doesn't update the prev's next link or the next's prev link, I don't see how that would result in a cycle.
My other theory is there's a multi-thread access issue going on here - i.e. either two threads try to stack cards at the same time - or perhaps cards are being stacked while their state is being edited by the main thread. But I'm not familiar with the threading set up of Forge here. What ensures that the GL thread (which appears to be setting up stacking based on game state) doesn't act on inconsistent state due to it being modified by the game thread?
Re: Forge Android App
by drdev » 07 Mar 2015, 22:23
So I again ran into the issue where there were too many methods to compile the Android app. This time, my investigation led me to realize we weren't using ProGuard to minify the app. To give you an idea of just how much this reduces the size of the app, see this output:
[DEBUG] Original number of program classes: 7501
[DEBUG] Final number of program classes: 3242
I'm currently trying to work out a few kinks that are preventing the app from running, but hopefully I'll be able publish a trimmed down version of the app soon.
[DEBUG] Original number of program classes: 7501
[DEBUG] Final number of program classes: 3242
I'm currently trying to work out a few kinks that are preventing the app from running, but hopefully I'll be able publish a trimmed down version of the app soon.
- drdev
- Programmer
- Posts: 1958
- Joined: 27 Jul 2013, 02:07
- Has thanked: 189 times
- Been thanked: 565 times
Re: Forge Android App
by drdev » 11 Mar 2015, 17:12
Yesterday I discovered a YouTube video somebody created about this app about a month ago, and it's pretty well done. Any objection to me linking it on the first post of the main Android app thread? It doesn't have that many views, so I'm not too worried about it being an advertising concern for the sake of Wizards.
https://www.youtube.com/watch?v=SEWsM7pp4yY
https://www.youtube.com/watch?v=SEWsM7pp4yY
- drdev
- Programmer
- Posts: 1958
- Joined: 27 Jul 2013, 02:07
- Has thanked: 189 times
- Been thanked: 565 times
Re: Forge Android App
by maykohli0503 » 02 Apr 2021, 06:50
is there any update on forge android app recently?
- maykohli0503
- Posts: 1
- Joined: 02 Apr 2021, 06:48
- Has thanked: 0 time
- Been thanked: 0 time
Re: Forge Android App
by amuseum » 27 Apr 2022, 06:18
I got serious problem. Android Forge crashes pretty often. Not only that, it crashes other apps that are running in the background. So not only do I have to restart Forge, all my other apps also need to be restarted.
- amuseum
- Posts: 14
- Joined: 05 Feb 2012, 02:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Forge Android App
by kevlahnota » 27 Apr 2022, 12:30
Device specs? If you have at least 6GB RAM, Android 10+ and good SOC (Snapdragon 855+, or any 2019 Flagship Specs SOCs) you can run it without problems. I have Galaxy S10+ and it works great for Forge Snapshot (Classic/Adventure Modes). Sample: https://www.youtube.com/watch?v=IBef9433ACMamuseum wrote:I got serious problem. Android Forge crashes pretty often. Not only that, it crashes other apps that are running in the background. So not only do I have to restart Forge, all my other apps also need to be restarted.
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Forge Android App
by amuseum » 28 Apr 2022, 01:25
Moto G Stylus 5G, 4GB RAM, Android 11, Snapdragon 480 5G (I think)
I can play FPS and MMOs just fine, and never crash.
It's not just the latest Forge Android. Older versions also crash frequently on my other phones and tablets. But it's more annoying now because I would constantly lose progress in Adventure mode. I save often, after every battle. Which is tedious when exploring dungeons, especially deeper ones. I have to leave the dungeon after every fight, lest I risk losing the cards I won. Unfortunately, the dungeons reset after a crash. So I have to fight the enemies all over.
It would crash even when I'm roaming towns, browsing shops, or editing decks.
I can play FPS and MMOs just fine, and never crash.
It's not just the latest Forge Android. Older versions also crash frequently on my other phones and tablets. But it's more annoying now because I would constantly lose progress in Adventure mode. I save often, after every battle. Which is tedious when exploring dungeons, especially deeper ones. I have to leave the dungeon after every fight, lest I risk losing the cards I won. Unfortunately, the dungeons reset after a crash. So I have to fight the enemies all over.
It would crash even when I'm roaming towns, browsing shops, or editing decks.
- amuseum
- Posts: 14
- Joined: 05 Feb 2012, 02:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Forge Android App
by kevlahnota » 28 Apr 2022, 01:34
Do you use XLHQ images? better to use SuperLQ or any smaller images since you have just minimum amount of RAM for your device and Forge caches all images and uses more memory on latest versions. Try latest snapshots version but I don't know if it works without a hitch on your devices. My older phone and tablet here have 6GB RAM and Android 10 and I don't have crashes. Earlier Forge versions are not compatible with Android 11 and above. Also try removing all your card pics or disable images on the settings. If it works on your end without crashes, then your problem is memory and you must use lower quality card images.amuseum wrote:Moto G Stylus 5G, 4GB RAM, Android 11, Snapdragon 480 5G (I think)
I can play FPS and MMOs just fine, and never crash.
It's not just the latest Forge Android. Older versions also crash frequently on my other phones and tablets. But it's more annoying now because I would constantly lose progress in Adventure mode. I save often, after every battle. Which is tedious when exploring dungeons, especially deeper ones. I have to leave the dungeon after every fight, lest I risk losing the cards I won. Unfortunately, the dungeons reset after a crash. So I have to fight the enemies all over.
It would crash even when I'm roaming towns, browsing shops, or editing decks.
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Re: Forge Android App
by kevlahnota » 28 Apr 2022, 02:03
Example RAM usage on my other Phone with 8GB RAM, Android 11, Snapdragon 720G, no games played just startup on Forge 1.6.50.427.SNAPSHOT..kevlahnota wrote:Do you use XLHQ images? better to use SuperLQ or any smaller images since you have just minimum amount of RAM for your device and Forge caches all images and uses more memory on latest versions. Try latest snapshots version but I don't know if it works without a hitch on your devices. My older phone and tablet here have 6GB RAM and Android 10 and I don't have crashes. Earlier Forge versions are not compatible with Android 11 and above. Also try removing all your card pics or disable images on the settings. If it works on your end without crashes, then your problem is memory and you must use lower quality card images.amuseum wrote:Moto G Stylus 5G, 4GB RAM, Android 11, Snapdragon 480 5G (I think)
I can play FPS and MMOs just fine, and never crash.
It's not just the latest Forge Android. Older versions also crash frequently on my other phones and tablets. But it's more annoying now because I would constantly lose progress in Adventure mode. I save often, after every battle. Which is tedious when exploring dungeons, especially deeper ones. I have to leave the dungeon after every fight, lest I risk losing the cards I won. Unfortunately, the dungeons reset after a crash. So I have to fight the enemies all over.
It would crash even when I'm roaming towns, browsing shops, or editing decks.
After some matches, MoJhoSto variant, 3 AI Player Match using SuperLQ images...
-
kevlahnota - Programmer
- Posts: 825
- Joined: 19 Jul 2010, 17:45
- Location: Philippines
- Has thanked: 14 times
- Been thanked: 264 times
Who is online
Users browsing this forum: flergeVes and 27 guests