GVKun编程网logo

无法找到包含 /data/data/com.company.app/files(无法找到包含兼容版本和架构的程序包)

1

在本文中,我们将给您介绍关于无法找到包含/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(无法找到包含兼容版本和架构的程序包)

无法找到包含 /data/data/com.company.app/files(无法找到包含兼容版本和架构的程序包)

如何解决无法找到包含 /data/data/com.company.app/files

不知道为什么我会得到这个,因为我认为我正确地遵循了示例 here。

许多其他人就同一件事提出了问题,但在查看了建议后,它仍然被打破。

完整的异常如下所示:

  1. java.lang.IllegalArgumentException: Failed to find configured root that contains /data/data/com.company.app/files/app_videos/VIDEO_20210202_184514.mp4
  2. at androidx.core.content.FileProvider$SimplePathStrategy.getUriForFile(FileProvider.java:744)
  3. at androidx.core.content.FileProvider.getUriForFile(FileProvider.java:418)

清单看起来像这样:

  1. <provider
  2. android:name="androidx.core.content.FileProvider"
  3. android:authorities="${applicationId}.provider"
  4. android:exported="false"
  5. android:grantUriPermissions="true">
  6. <Meta-data
  7. android:name="android.support.FILE_PROVIDER_PATHS"
  8. android:resource="@xml/provider_paths" />
  9. </provider>

provider_paths.xml 文件如下所示:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <paths>
  3. <cache-path name="cache" path="/"/>
  4. <external-cache-path name="external_cache" path="." />
  5. <external-path name="external" path="." />
  6. <external-files-path name="external_files" path="." />
  7. <files-path name="app_videos" path="files/" />
  8. </paths>

我使用的代码(几乎是从 Google 网站上剪切和粘贴的)如下所示:

  1. val imagePath = File(context.filesDir,"app_videos")
  2. Timber.i("imagePath: ${imagePath.name}")
  3. val newFile = File(imagePath,name)
  4. Timber.i("newFile exists: ${newFile.exists()} length: ${newFile.length()}")
  5. val uri = FileProvider.getUriForFile(context.applicationContext,context.packageName + ".provider",newFile)
  6. 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。

谁能看到我做错了什么?

解决方法

好的……明白了。需要调整一些东西。首先代码应该是这样的

  1. private fun shareMultipleVideos(names: List<String>,context: Context) {
  2. val uris: ArrayList<Uri> = ArrayList()
  3. for (name in names) {
  4. val videoFile = File(context.filesDir,name)
  5. Timber.i("videoFile ${videoFile.name} exists: ${videoFile.exists()}")
  6. val uri = FileProvider.getUriForFile(context.applicationContext,context.packageName + ".provider",videoFile)
  7. Timber.i("Adding Uri: $uri")
  8. uris.add(uri)
  9. }
  10. val intent = Intent()
  11. intent.action = Intent.ACTION_SEND_MULTIPLE
  12. intent.putExtra(Intent.EXTRA_SUBJECT,"Shared files")
  13. intent.type = "video/mp4"
  14. intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE,true)
  15. intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM,uris)
  16. intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
  17. intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
  18. Timber.i("Intent: $intent")
  19. try{
  20. ContextCompat.startActivity(context,Intent.createChooser(intent,"Shared Videos"),null)
  21. } catch (e: Exception) {
  22. Timber.e("Exception starting activity. \\nException was ${e.message}\\n Stack trace to follow:\\n ${e.stackTrace}")
  23. }
  24. }

接下来,需要稍微调整路径 xml 文件。结果如下:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <paths>
  3. <cache-path name="cache" path="/"/>
  4. <external-cache-path name="external_cache" path="." />
  5. <external-path name="external" path="." />
  6. <external-files-path name="external_files" path="." />
  7. <files-path name="app_videos" path="." />
  8. </paths>

android – 如何删除root app / app / files?

android – 如何删除root app / app / files?

我的手机扎根了.我正在尝试做一个非常简单的程序.该程序应从app / app文件夹中删除文件.我怎样才能做到这一点?我是新手,所以示例代码很有价值.

解决方法

如果您的手机是root用户,则可以通过su发出命令,只要su二进制文件存在并且在PATH中,因为 Android是Linux的变体.只需通过Runtime.exec()执行删除命令,超级用户应该处理权限提示.

以下是我使用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 似乎包含一个身份验证令牌为了什么?

如何解决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 的配置根目录

如何解决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

保存文件的代码:

  1. var filePath = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),fileName);
  2. System.IO.File.WriteallBytes(filePath,fileBytes);
  3. LaunchIntent(filePath);

发生错误的代码:

  1. public static void LaunchIntent(string fileLocation)
  2. {
  3. // Now create an activity which points to the file
  4. var localPath = global::Android.Net.Uri.Parse(fileLocation).Path;
  5. File javaFile = new File(localPath);
  6. //error occurs at below code
  7. var filePath = global::Android.Support.V4.Content.FileProvider.GetUriForFile(
  8. CrossCurrentActivity.Current.Activity,CrossCurrentActivity.Current.Activity.PackageName + ".fileprovider",javaFile);
  9. var actionView = new Intent(Intent.ActionView);
  10. actionView.AddFlags(ActivityFlags.GrantReadUriPermission);
  11. var extension = localPath.Substring(localPath.LastIndexOf(''.'') + 1);
  12. var mimeType = MimeTypeMap.Singleton.GetMimeTypeFromExtension(extension);
  13. actionView.SetDataAndType(filePath,mimeType);
  14. CrossCurrentActivity.Current.Activity.StartActivity(actionView);
  15. }

我的文件路径文件:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <paths xmlns:android="http://schemas.android.com/apk/res/android">
  3. <external-path name="external" path="." />
  4. <external-files-path name="external_files" path="." />
  5. <cache-path name="cache" path="." />
  6. <external-cache-path name="external_cache" path="."/>
  7. </paths>

解决方法

根据您的描述,您的pdf保存在内部存储中,具体路径的Provider路径如下:

  1. <files-path/> --> Context.getFilesDir()
  2. <cache-path/> --> Context.getCacheDir()
  3. <external-path/> --> Environment.getExternalStorageDirectory()
  4. <external-files-path/> --> Context.getExternalFilesDir(String)
  5. <external-cache-path/> --> Context.getExternalCacheDir()
  6. <external-media-path/> --> Context.getExternalMediaDirs()

您可以参考:https://developer.android.com/reference/androidx/core/content/FileProvider

所以改变你的resources/xml/file_paths.xml

  1. <paths xmlns:android="http://schemas.android.com/apk/res/android">
  2. <external-path name="external_files" path="."/>
  3. <files-path name="internal_files" path="." />
  4. </paths>

并在 AndroidManifest.xml 文件 Application 标签中添加一个提供者。

  1. <provider android:name="androidx.core.content.FileProvider" android:authorities="${applicationId}.fileprovider" android:exported="false" android:grantUriPermissions="true">
  2. <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths"></meta-data>
  3. </provider>
  4. </application>

angular – ng new hello错误:路径“/app/app.module.ts”不存在.路径“/app/app.module.ts”不存在

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”不存在等更多相关知识的信息可以在本站进行查询。

本文标签: