在过去的几天里,我一直试图将git项目https://github.com/spacecowboy/NoNonsense-FilePicker导入到我正在android studio中开发的应用程序中。不幸 我尝试从我的程序中启动filePicker活动时因为以下错误而无法执行此操作:
12-29 20:24:41.451 18856-18856/no.trappsoft.passitory E/AndroidRuntime: FATAL EXCEPTION: main
Process: no.trappsoft.passitory, PID: 18856
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/nononsenseapps/filepicker/FilePickerActivity;
at no.trappsoft.passitory.EditKeys$1.onClick(EditKeys.java:116)
at android.view.View.performClick(View.java:5254)
at android.widget.TextView.performClick(TextView.java:10557)
at android.view.View$PerformClick.run(View.java:21203)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6897)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.nononsenseapps.filepicker.FilePickerActivity" on path: DexPathList[[zip file "/data/app/no.trappsoft.passitory-1/base.apk"],nativeLibraryDirectories=[/data/app/no.trappsoft.passitory-1/lib/arm, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
at no.trappsoft.passitory.EditKeys$1.onClick(EditKeys.java:116)
at android.view.View.performClick(View.java:5254)
at android.widget.TextView.performClick(TextView.java:10557)
at android.view.View$PerformClick.run(View.java:21203)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6897)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1404)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1199)
Suppressed: java.lang.NoClassDefFoundError: com.nononsenseapps.filepicker.FilePickerActivity
at dalvik.system.DexFile.defineClassNative(Native Method)
at dalvik.system.DexFile.defineClass(DexFile.java:226)
at dalvik.system.DexFile.loadClassBinaryName(DexFile.java:219)
at dalvik.system.DexPathList.findClass(DexPathList.java:321)
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:54)
... 14 more
Suppressed: java.lang.ClassNotFoundException: com.nononsenseapps.filepicker.FilePickerActivity
at java.lang.Class.classForName(Native Method)
at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
... 13 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
我无法解决此错误。看似导入的filpicker库的路径是错误的,但是路径是正确的。
我的gradle文件如下
apply plugin: 'com.android.application'
apply plugin: 'android'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
configurations{
all*.exclude module: 'support-v4'
}
defaultConfig {
applicationId "no.trappsoft.passitory"
minSdkVersion 19
targetSdkVersion 21
multiDexEnabled=true
}
repositories {
jcenter()
}
buildTypes {
release {
minifyEnabled false
//proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.txt'
}
}
}
dependencies {
compile files('libs/android-support-v13.jar')
compile files('libs/sqlcipher-javadoc.jar')
compile files('libs/sqlcipher.jar')
compile 'com.github.clans:fab:1.6.2'
compile 'com.madgag.spongycastle:core:1.53.0.0'
compile 'com.madgag.spongycastle:prov:1.53.0.0'
compile 'com.madgag.spongycastle:pkix:1.53.0.0'
compile 'com.madgag.spongycastle:pg:1.53.0.0'
compile 'com.nononsenseapps:filepicker:2.4.2'
}
我必须添加multiDexEnabled行和配置部分才能使用 使用包含的filepicker项目编译应用程序。不过这些构建过程会因其他错误而中断。
代码实际中断的文件位于EditKeys Activity中的以下行:
Intent i = new Intent(EditKeys.this,FilePickerActivity.class);
我的清单文件包含filePicker活动的以下活动定义:
<activity
android:name="com.nononsenseapps.filepicker.FilePickerActivity"
android:label="@string/app_name"
android:theme="@style/FilePickerTheme">
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
以下是外部库及其位置的屏幕截图: FilePicker Path Problem
我目前无法做什么。 T任何和所有帮助都非常有用。