Beseting / NesEmulator

Android nes emulator library(Nes/FC/Nintendo game),For fast develop nes emulator useage.
179 stars 18 forks source link

无法加载游戏 #1

Closed Jy1211a closed 11 months ago

Jy1211a commented 1 year ago

加载游戏文件时,执行EmulatorManager.getInstance().startGame(mAct, MyEmulatorActivity::class.java,romFile)后显示无法加载游戏对话框。(权限已经给予)

Beseting commented 1 year ago

加载游戏文件时,执行EmulatorManager.getInstance().startGame(mAct, MyEmulatorActivity::class.java,romFile)后显示无法加载游戏对话框。(权限已经给予)

提供一下日志

rak14967 commented 11 months ago

I also have this problem photo_2023-11-14_14-57-29

rak14967 commented 11 months ago

I did not make any changes in the source. I just wrote the following path to read the nes file

val romFile = File(Environment.getExternalStorageDirectory().path + "/Download/contra.nes")

Although I have given access to the memory, I get the following error

java.io.FileNotFoundException: /storage/emulated/0/Download/contra.nes: open failed: EACCES (Permission denied)

Beseting commented 11 months ago

I did not make any changes in the source. I just wrote the following path to read the nes file

val romFile = File(Environment.getExternalStorageDirectory().path + "/Download/contra.nes")

Although I have given access to the memory, I get the following error

java.io.FileNotFoundException: /storage/emulated/0/Download/contra.nes: open failed: EACCES (Permission denied)

You should grant data read and write permissions to your application first,Android6.0+ need dynamic apply sensitive permissions,Or you can set application settings for open RW permission!

Beseting commented 11 months ago

I did not make any changes in the source. I just wrote the following path to read the nes file

val romFile = File(Environment.getExternalStorageDirectory().path + "/Download/contra.nes")

Although I have given access to the memory, I get the following error

java.io.FileNotFoundException: /storage/emulated/0/Download/contra.nes: open failed: EACCES (Permission denied)

Is that Android Q or higher?You need to adapt to a higher version of the Android API feature.(however you can put the nes rom file in source code of assets,It can also achieve file loading!)

rak14967 commented 11 months ago

Thank Beseting I solved the problem We can only read the files that we have saved in the allowed folders of Android.

For example, we can create a folder named x in the download folder and then save the .nes file in it. And finally call this route download/x/contra.nes

Some allowed Android folders: Download Documents Music Pictures And ...