<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="gt.otomat">
<uses-feature android:name="android.hardware.camera2" android:required="true"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<uses-permission
android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="28" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".otomat">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"
></meta-data>
</provider>
</application>
</manifest>
我从 github 复制了这段代码,但我有一个错误。我正在使用 ocr 的 tesstwo 库。(tesseract ocr) 我在这个地方有一个错误“android:resource="@xml/file_paths"。我复制了所有 list 、主要 Activity 和 activity_main.xml,但它给出了一个错误。
谢谢你的帮助....
最佳答案
试试这个:
首先在应用程序中添加您的提供商标签
<application
...
android:theme="@style/AppTheme">
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="zm.mytestapplication.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
</provider>
像这样在您的 xml 文件夹中创建一个 file_path
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path
name="my_images"
path="Android/data/org.projects.cameraapp/files/Pictures" />
</paths>
确保 .xml 文件中的路径正确
关于android list 错误@xml/文件路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51625488/