首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >java.lang.ClassNotFoundException:在Adone AIR本机扩展中找不到类"android.support.v4.content.FileProvider“错误

java.lang.ClassNotFoundException:在Adone AIR本机扩展中找不到类"android.support.v4.content.FileProvider“错误
EN

Stack Overflow用户
提问于 2014-08-14 00:23:18
回答 2查看 10.3K关注 0票数 6

也许我的问题听起来像是被问了100次,但相信我,我已经读过这100个类似问题的每一个答案,没有一个解决了我的问题。因此,我的本机扩展的目的是共享我的应用缓存文件夹中的文档(doc、pdf等)。使用第三方应用程序(Quick Office、Adobe Reader等)。我发现FileProvider和Intents应该可以解决我的问题。

我的app描述文件包含:

代码语言:javascript
复制
<application android:enabled="true"
                android:launchMode="singleInstance">
                <provider
                    android:name="android.support.v4.content.FileProvider"
                    android:authorities="com.test.fileprovider"
                    android:exported="false"
                    android:grantUriPermissions="true">
                    <meta-data
                        android:name="android.support.FILE_PROVIDER_PATHS"
                        android:resource="@xml/file_paths" />
                </provider>
            </application>

在Eclipse的项目属性、->、Java Build Path、-> Order和Export selected中选择: Android Private libraries和Android Dependencies。android-support-v4.jar在项目的libs文件夹中。

FREFunction代码摘录:

代码语言:javascript
复制
package com.test.OpenWithDefaultApp.functions;

.....

import android.content.Intent;
import android.net.Uri;
import android.support.v4.content.FileProvider;

.....

Uri contentUri = FileProvider.getUriForFile(context.getActivity(), "com.test.OpemWithDefaultApp.fileprovider", file);
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(contentUri, fileType);

.....

context.getActivity().startActivity(intent);

.....

我正在使用

代码语言:javascript
复制
Eclipse Luna 4.4.0
Eclipse Android Plugin 23.0.3
Android SDK Tools 23.0.2
Android SDK Platform-tools 20
Android SDK Build-tools 20
Android SDK from 14 upto 20
Android Support Library 20
Google Play services 19

原生扩展结构:

代码语言:javascript
复制
+android
      -libs/android-support-v4.jar
      -res/xml/file_paths
      -library.swf
      -openwithdefaultapp.jar
+default
      -library.swf
-extension.xml

但是我被错误所困扰:

代码语言:javascript
复制
java.lang.RuntimeException: Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/air.testFileProvider-2.apk"],nativeLibraryDirectories=[/data/app-lib/air.testFileProvider-2, /vendor/lib, /system/lib]]

任何帮助都将不胜感激。谢谢

EN

回答 2

Stack Overflow用户

发布于 2017-09-07 18:20:52

android:authorities="com.test.fileprovider""com.test.OpemWithDefaultApp.fileprovider",这两个名称应该相同

票数 0
EN

Stack Overflow用户

发布于 2021-05-10 02:07:52

在AndroidManifest.xml中

变化

代码语言:javascript
复制
<provider android:name="android.support.v4.content.FileProvider"

代码语言:javascript
复制
<provider android:name="androidx.core.content.FileProvider"

经过测试并为我工作

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25291350

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档