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

MrC*_*Off 6 apache-flex air android air-native-extension

也许我的问题听起来像之前被问过100次,但相信我,我已经阅读了100个类似问题的每个答案,而不是他们解决了我的问题.因此,我原生扩展的目的是在我的应用缓存文件夹(doc,pdf等)中与第三方应用(Quick Office,Adobe Reader等)共享文档.我发现FileProvider和Intents应该可以解决我的问题.

我的应用说明文件包含:

<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>
Run Code Online (Sandbox Code Playgroud)

在Eclipse中的Project属性 - > Java Build Path - > Order and Export selected:Android Private libraries和Android Dependencies.android-support-v4.jar位于项目的libs文件夹中.

FREFunction代码摘录:

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);

.....
Run Code Online (Sandbox Code Playgroud)

我正在使用

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
Run Code Online (Sandbox Code Playgroud)

原生扩展结构:

+android
      -libs/android-support-v4.jar
      -res/xml/file_paths
      -library.swf
      -openwithdefaultapp.jar
+default
      -library.swf
-extension.xml
Run Code Online (Sandbox Code Playgroud)

但我遇到了错误:

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]]
Run Code Online (Sandbox Code Playgroud)

任何帮助,将不胜感激.谢谢

小智 0

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