unity发布android平台,项目中使用assetbundle打包资源,资源下载后保存的路径是persistentpath,发布后运行报错:
Autoconnected Player "Autoconnected Player" DirectoryNotFoundException: Could not find a part of the path "/storage/emulated/0/Android/data/com.skm.Alive/files/download/source/uisource/bg/bg_logon.assetbundle"
persistentpath在手机中的存储路径应该是/Android/data/com.skm.Alive/files/,加载时也是用的persistentpath设置的路径,但错误内容中是读的另一个路径(/storage/emulated/0/),查看手机目录发现资源存放在/Android/data/com.skm.Alive/files/中,错误中的路径(/storage/emulated/0/)中是没有资源的。
这里存放的方式也出现了问题,打包的资源都是分类在文件夹中的,但是android手机下载的资源都没有进文件夹,而是与文件夹在同级目录中。
另外由于不知什么原因,发布后用VS调试时无法命中断点,会经过短暂的黑屏后直接运行。根本无法调试找原因
头疼,请有缘人指教。
检查下你的手机联网和adb的配置。
不知道你这个问题是否已经解决, 如果还没有解决的话:是不是需要在Android清单文件中设置
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
tools:replace="android:resource" />
</provider>
<?xml version="1.0" encoding="utf-8"?>
<paths>
<external-path
name="image"
path="image/" />
<external-path
name="files_root"
path="Android/data/包名/" />
<external-path
name="external_storage_root"
path="." />
</paths>