在本文中,我们将给您介绍关于无法找到包含/data/data/com.company.app/files的详细内容,并且为您解答无法找到包含兼容版本和架构的程序包的相关问题,此外,我们还将为您提供关于
在本文中,我们将给您介绍关于无法找到包含 /data/data/com.company.app/files的详细内容,并且为您解答无法找到包含兼容版本和架构的程序包的相关问题,此外,我们还将为您提供关于android – 如何删除root app / app / files?、android 中的文件 data/data/com.app.myapp/files/PersistedInstallation.XXXX.json 似乎包含一个身份验证令牌为了什么?、Android:无法找到包含 /data/data/com.app.myapp/files/myfile.pdf 的配置根目录、angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在的知识。
本文目录一览:- 无法找到包含 /data/data/com.company.app/files(无法找到包含兼容版本和架构的程序包)
- android – 如何删除root app / app / files?
- android 中的文件 data/data/com.app.myapp/files/PersistedInstallation.XXXX.json 似乎包含一个身份验证令牌为了什么?
- Android:无法找到包含 /data/data/com.app.myapp/files/myfile.pdf 的配置根目录
- angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在
无法找到包含 /data/data/com.company.app/files(无法找到包含兼容版本和架构的程序包)
如何解决无法找到包含 /data/data/com.company.app/files
不知道为什么我会得到这个,因为我认为我正确地遵循了示例 here。
许多其他人就同一件事提出了问题,但在查看了建议后,它仍然被打破。
完整的异常如下所示:
java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.company.app/files/app_videos/VIDEO_20210202_184514.mp4
at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)
清单看起来像这样:
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<Meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths" />
</provider>
provider_paths.xml 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="cache" path="/"/>
<external-cache-path name="external_cache" path="." />
<external-path name="external" path="." />
<external-files-path name="external_files" path="." />
<files-path name="app_videos" path="files/" />
</paths>
我使用的代码(几乎是从 Google 网站上剪切和粘贴的)如下所示:
val imagePath = File(context.filesDir,"app_videos")
Timber.i("imagePath: ${imagePath.name}")
val newFile = File(imagePath,name)
Timber.i("newFile exists: ${newFile.exists()} length: ${newFile.length()}")
val uri = FileProvider.getUriForFile(context.applicationContext,context.packageName + ".provider",newFile)
Timber.i("Adding Uri: $uri")
最后一行永远不会执行,因为崩溃发生在它之前的行上。
现在,我知道我将文件保存在此处: /data/user/0/com.company.app/files/VIDEO_20210202_/data/user/0/com.standardandroid.stalkersport/files/VIDEO_20210202_200455.mp4
我知道它在那里,因为我可以使用其他代码很好地播放它
所以,我知道文件存在。我只是无法为它创建 Uri。
谁能看到我做错了什么?
解决方法
好的……明白了。需要调整一些东西。首先代码应该是这样的
private fun shareMultipleVideos(names: List<String>,context: Context) {
val uris: ArrayList<Uri> = ArrayList()
for (name in names) {
val videoFile = File(context.filesDir,name)
Timber.i("videoFile ${videoFile.name} exists: ${videoFile.exists()}")
val uri = FileProvider.getUriForFile(context.applicationContext,context.packageName + ".provider",videoFile)
Timber.i("Adding Uri: $uri")
uris.add(uri)
}
val intent = Intent()
intent.action = Intent.ACTION_SEND_MULTIPLE
intent.putExtra(Intent.EXTRA_SUBJECT,"Shared files")
intent.type = "video/mp4"
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE,true)
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris)
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
Timber.i("Intent: $intent")
try{
ContextCompat.startActivity(context,Intent.createChooser(intent,"Shared Videos"),null)
} catch (e: Exception) {
Timber.e("Exception starting activity. \\nException was ${e.message}\\n Stack trace to follow:\\n ${e.stackTrace}")
}
}
接下来,需要稍微调整路径 xml 文件。结果如下:
<?xml version="1.0" encoding="utf-8"?>
<paths>
<cache-path name="cache" path="/"/>
<external-cache-path name="external_cache" path="." />
<external-path name="external" path="." />
<external-files-path name="external_files" path="." />
<files-path name="app_videos" path="." />
</paths>
android – 如何删除root app / app / files?
解决方法
以下是我使用from this question的一个简单示例:
process = Runtime.getRuntime().exec("su"); os = new DataOutputStream(process.getoutputStream()); os.writeBytes(command + "\n"); os.writeBytes("exit\n"); os.flush(); process.waitFor();
android 中的文件 data/data/com.app.myapp/files/PersistedInstallation.XXXX.json 似乎包含一个身份验证令牌为了什么?
如何解决android 中的文件 data/data/com.app.myapp/files/PersistedInstallation.XXXX.json 似乎包含一个身份验证令牌为了什么??
我们有一个 Expo 应用程序,使用我们为 Android 分发的托管工作流。 查看应用程序目录中的文件,我们发现了一个 json,它似乎包含一个特定的身份验证令牌。它似乎是由 Expo 本身创建的,但我们在文档中找不到任何关于它的信息。我们想了解如果泄漏会产生什么影响以及它的用途是什么。
Android 上的文件位置:
data/data/(com.app.myapp)/files/PersistedInstallation.(XX-some-random-ID-XX).json
内容:
{
"fid": "some ID different to the file","AuthToken": "A JWT token with ''fid'',''projectNumber'',''appId'',''exp'' fields in the payload"
... (other fields for token validity)
}
你知道这个文件是干什么用的吗?
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
Android:无法找到包含 /data/data/com.app.myapp/files/myfile.pdf 的配置根目录
如何解决Android:无法找到包含 /data/data/com.app.myapp/files/myfile.pdf 的配置根目录
我有一个从 API 下载并使用 Environment.SpecialFolder.MyDocuments
保存到内部存储的 PDF 文件。当我尝试打开文件时,我在标题中收到错误 Failed to find configured root that contains /data/data/com.app.myapp/files/myfile.pdf
。
保存文件的代码:
var filePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),fileName);
System.IO.File.WriteallBytes(filePath,fileBytes);
LaunchIntent(filePath);
发生错误的代码:
public static void LaunchIntent(string fileLocation)
{
// Now create an activity which points to the file
var localPath = global::Android.Net.Uri.Parse(fileLocation).Path;
File javaFile = new File(localPath);
//error occurs at below code
var filePath = global::Android.Support.V4.Content.FileProvider.GetUriForFile(
CrossCurrentActivity.Current.Activity,CrossCurrentActivity.Current.Activity.PackageName + ".fileprovider",javaFile);
var actionView = new Intent(Intent.ActionView);
actionView.AddFlags(ActivityFlags.GrantReadUriPermission);
var extension = localPath.Substring(localPath.LastIndexOf(''.'') + 1);
var mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
actionView.SetDataAndType(filePath,mimeType);
CrossCurrentActivity.Current.Activity.StartActivity(actionView);
}
我的文件路径文件:
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external" path="." />
<external-files-path name="external_files" path="." />
<cache-path name="cache" path="." />
<external-cache-path name="external_cache" path="."/>
</paths>
解决方法
根据您的描述,您的pdf保存在内部存储中,具体路径的Provider路径如下:
<files-path/> --> Context.getFilesDir()
<cache-path/> --> Context.getCacheDir()
<external-path/> --> Environment.getExternalStorageDirectory()
<external-files-path/> --> Context.getExternalFilesDir(String)
<external-cache-path/> --> Context.getExternalCacheDir()
<external-media-path/> --> Context.getExternalMediaDirs()
您可以参考:https://developer.android.com/reference/androidx/core/content/FileProvider
所以改变你的resources/xml/file_paths.xml
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="external_files" path="."/>
<files-path name="internal_files" path="." />
</paths>
并在 AndroidManifest.xml 文件 Application 标签中添加一个提供者。
<provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
</provider>
</application>
angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在
当我运行新的myapp命令时,我得到以下命令
新的你好
Error: Path "/app/app.module.ts" does not exist. Path "/app/app.module.ts" does not exist.
谁能帮我吗???
解决方法
Please make sure that your new folder have write permission
如果您使用的是ubuntu,请将以下命令运行到该文件夹
sudo chmod 644 -R foldername
然后运行新的appname
并检查您的节点版本
今天关于无法找到包含 /data/data/com.company.app/files和无法找到包含兼容版本和架构的程序包的介绍到此结束,谢谢您的阅读,有关android – 如何删除root app / app / files?、android 中的文件 data/data/com.app.myapp/files/PersistedInstallation.XXXX.json 似乎包含一个身份验证令牌为了什么?、Android:无法找到包含 /data/data/com.app.myapp/files/myfile.pdf 的配置根目录、angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在等更多相关知识的信息可以在本站进行查询。
本文标签: