Fate-Grand-Automata / FGA

Auto-battle app for F/GO Android
https://fate-grand-automata.github.io
MIT License
1.37k stars 267 forks source link

Built-in recorder bug and crash #282

Open LeiCiel opened 3 years ago

LeiCiel commented 3 years ago

I wanted to test out using the built-in recorder, since I remember that I couldn't use it before, but the same thing is happening.

I switch on the recorder in the settings and then run the app. When I tap the 'Play' button, the pop-up asking me to confirm which Auto-skill setup to use appears, but the Play/Stop button disappears completely. Even after confirming the skill setup, nothing happens afterwards.

If I try to do it a second time (going back to FGA to start it up then back to FGO), this time it freezes and I get that pop-up that tells me that FGA stopped running. But then the whole screen freezes. I can either leave it alone for several minutes before FGA is closed and FGO is running normally again, or I can turn off my display and turn it back on to find FGO running normally. Either way, FGA closes.

If I try to start up FGA a third time, I get redirected to allow the app Accessibility. When I check, the App is still allowed to do everything it needs. I just turn it off, then turn it back on again. Even so, I can't start up FGA again as it keeps redirecting me to give it permission to access what it needs even though it has it already.

I uninstall the app and reinstall it, give it access again, and everything works. EXCEPT for the recorder.

I've tried it with the "Notch Calculation" both on and off with the same results. I've switched off Game Launcher. Same result. I've switched off the Game Booster. Same result.

Not sure if anyone else is having this issue.

Device Info:

MathewSachin commented 3 years ago

I really don't have any clue why this is happening on your phone. Can you try running adb logcat and get me the logs? See https://github.com/MathewSachin/Fate-Grand-Automata/issues/205#issuecomment-664056031 for instructions.

LeiCiel commented 3 years ago

Does that work on a phone though?

MathewSachin commented 3 years ago

No, you'll need a computer for that.

LeiCiel commented 3 years ago

I'm confused though since the problem is on my phone.

If I'm reading the instructions right, does this mean I'll be running FGA and FGO on my phone while connected to the computer where the other program will be running with Bluestacks?

MathewSachin commented 3 years ago

FGA and FGO will be running on your phone. You don't have to use Bluestacks. Just run that adb command on your computer. Your phone should have USB debugging turned ON in developer options.

reconman commented 3 years ago

Guide for 2nd step for Android devices: https://www.embarcadero.com/starthere/xe5/mobdevsetup/android/en/enabling_usb_debugging_on_an_android_device.html

LeiCiel commented 3 years ago

Ok, so the program's installed, USB debugging is ON, and the phone's connected to my PC. Tried running adb.exe but after the command window popped up for a second it just closed by itself. Should I be running FGO and FGA first or something?

Sorry for the trouble. I'm no good at this sort of thing.

reconman commented 3 years ago

I guess you double clicked on adb.exe instead of starting it from the command line.

  1. Start the Windows command line
  2. Enter cd <adb-directory> to switch to that folder
  3. Enter adb devices, now your phone should show a pop up if you want to allow USB debugging from that computer
  4. Enter adb logcat *:E > C:\logcat.log
LeiCiel commented 3 years ago

It doesn't seem like it can detect my phone though my computer's detecting the connection well enough. I'm typing adb devices but all it's returning is a line saying "List of Devices attached" and nothing else. Just another command line waiting for my next input.

LeiCiel commented 3 years ago

Nvm, got it running somehow.

LeiCiel commented 3 years ago
  1. Enter adb logcat *:E > C:\logcat.log

Btw, I assume the E and the C here are the drives? E being the phone while C is where the program is installed? Will there be a problem since my phone isn't showing up as a specific drive on my computer.

Also, I'm not getting any popup asking for permission for USB debugging. Is it because I already enabled USB debugging or should it still be asking?

reconman commented 3 years ago

C: is the drive, *:E means get only error logs

LeiCiel commented 3 years ago

Oh. Well, I'm getting an Access Denied message back when I type that in. Also not getting a popup asking for USB Debugging permission.

Upload

reconman commented 3 years ago

Looks like it still doesn't detect your phone. Try installing the USB drivers for your phone: http://org.downloadcenter.samsung.com/downloadfile/ContentsFile.aspx?CDSite=US&CttFileID=6967517&CDCttType=SW&ModelType=C&ModelName=SM-A716UZKNXAA&VPath=SW/201801/20180104065633029/SAMSUNG_USB_Driver_for_Mobile_Phones_ver_1.5.65.0.exe

LeiCiel commented 3 years ago

That did the job. But now I think my phone just doesn't want me to get the problem fixed.

Upload

reconman commented 3 years ago

I think the Access is denied is related to you not having any rights to C:\logcat.log. Try another path.

LeiCiel commented 3 years ago

I just ran it as Admin and I think it's working. I assume it will take a while?

Nvm, just saw the file. Give me a sec to look up the time when it crashed.

reconman commented 3 years ago

Cancel it with Ctrl+C

LeiCiel commented 3 years ago

logcat.log

reconman commented 3 years ago

@MathewSachin I found this regarding the error message, does it help us? https://stackoverflow.com/questions/46445265/android-8-0-java-lang-illegalstateexception-not-allowed-to-start-service-inten

LeiCiel commented 3 years ago

I couldn't find the exact time when it crashed so I just re-did the whole thing after running the recorder again so I had a more recent time frame.

It should be right after the line that says "--Beginning of main"

Time stamp starts at 17:37 to a little after 17:39. Which... is a fucking lot of lines to go through I'm sorry to say.

If it's a lot of work I don't mind if it doesn't get fixed immediately, or at all, since it seems like this is an issue that's only happening on my phone.

Sorry for the trouble.

MathewSachin commented 3 years ago

This is the part relevant to us:

FATAL EXCEPTION: main
08-22 17:05:01.893  5616  5616 E AndroidRuntime: Process: com.mathewsachin.fategrandautomata, PID: 5616
08-22 17:05:01.893  5616  5616 E AndroidRuntime: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1047)
08-22 17:05:01.893  5616  5616 E AndroidRuntime: Caused by: java.lang.reflect.InvocationTargetException
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    ... 1 more
08-22 17:05:01.893  5616  5616 E AndroidRuntime: Caused by: java.io.IOException: prepare failed.
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.media.MediaRecorder._prepare(Native Method)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.media.MediaRecorder.prepare(MediaRecorder.java:1374)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at f.a.a.g.d.<init>(MediaProjectionRecording.kt:17)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at f.a.a.g.e.y(MediaProjectionScreenshotService.kt:1)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at f.a.a.j.x.b(ScriptManager.kt:3)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at f.a.a.j.y.a(ScriptManager.kt:2)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at f.a.a.j.v.a(ScriptManager.kt:7)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at f.a.a.e.e$c.onClick(ScriptRunnerDialog.kt:1)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.view.View.performClick(View.java:7870)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.widget.TextView.performClick(TextView.java:14959)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.view.View.performClickInternal(View.java:7839)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.view.View.access$3600(View.java:886)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.view.View$PerformClick.run(View.java:29363)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:883)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:100)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:237)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:7814)
08-22 17:05:01.893  5616  5616 E AndroidRuntime:    ... 3 more

@reconman I think that's a separate problem.

The error pretty much means MediaRecorder isn't able to initialize. I think CamcorderProfile.QUALITY_HIGH should be the problem. I hadn't read about it before, but these profiles seem to vary depending on the phone. Let me search about it a bit more.

reconman commented 3 years ago

The people in this stackoverflow thread say that you need RECORD_AUDIO permission: https://stackoverflow.com/questions/14640734/mediarecorder-ioexception-prepare-failed

MathewSachin commented 3 years ago

No, we don't need that. We're not recording audio here.

MathewSachin commented 3 years ago

@LeiCiel can you try the APK from this page?: https://github.com/MathewSachin/Fate-Grand-Automata/actions/runs/219618053

I just reduced the quality of the recording. I think maybe your phone's default quality is too high.

LeiCiel commented 3 years ago

Turning on the Recorder still causes it to close without warning.

MathewSachin commented 3 years ago

I still don't know how to fix the recorder for you, but, in the release I did just now, I made it so that instead of crashing it will show a message that recording could not be started.

LeiCiel commented 3 years ago

It's fine. At least it's not something that'll outright keep me from using FGA as a whole. Maybe someone will have the same or a similar issue somewhere down the line that'll help.

Thanks. (^_^)b