问题:
I have tried to write the file into "/mnt/sdcard" path its return error. Code on JNI layer(C++) using normal fopen("new.txt","w")
And also tried the same with "/mnt/sdcar...
可以将文章内容翻译成中文,广告屏蔽插件会导致该功能失效:
问题:
I have tried to write the file into "/mnt/sdcard" path its return error. Code on JNI layer(C++) using normal fopen("new.txt","w")
And also tried the same with "/mnt/sdcard/Android/data/" even failed.
Device: Android Q Beta4
fopen("/mnt/sdcard/new.txt","w") fopen("/mnt/sdcard/Android/data/new.txt","w")
We already Refer the storage restriction in Android Developer page for Android Q.
Which path used for store the public information?
回答1:
Apps cannot store data in arbitrary locations on external or removable storage in Android Q (by default) or Android R (for all apps). The fact that you happen to be using the NDK does not change this.
Your Java code should pass down a valid filesystem path for your NDK code to use (e.g., getExternalFilesDir()
on Context
).