【问题标题】:NoClassDefFoundError in pdfbox android studiopdfbox android studio中的NoClassDefFoundError
【发布时间】:2017-07-28 00:02:19
【问题描述】:

我想在我的 android 应用程序中使用 pdfbox。但我遇到了这个错误:

致命异常:主要 进程:com.android.app.spritzing,PID:12534 java.lang.NoClassDefFoundError:解析失败: Ljava/awt/color/ColorSpace;*

我的 gradle.build 文件是这样的:

> apply plugin: 'com.android.application'  android {
> 
>     compileSdkVersion 24
>     buildToolsVersion "24.0.0"
>     defaultConfig {
>         applicationId "com.android.app.spritzing"
>         minSdkVersion 15
>         targetSdkVersion 24
>         versionCode 1
>         versionName "1.0"
>     }
>     buildTypes {
>         release {
>             minifyEnabled false
>             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
>         }
>     }
>     packagingOptions {
>         exclude 'META-INF/DEPENDENCIES'
>         exclude 'META-INF/NOTICE'
>         exclude 'META-INF/LICENSE'
>         exclude 'META-INF/LICENSE.txt'
>         exclude 'META-INF/NOTICE.txt'
>         exclude 'META-INF/maven/edu.ucar/udunits/pom.xml'
>         exclude 'META-INF/maven/edu.ucar/udunits/pom.properties'
>         exclude 'META-INF/maven/edu.ucar/netcdf4/pom.xml'
>         exclude 'META-INF/maven/edu.ucar/netcdf4/pom.properties'
>         exclude 'META-INF/maven/edu.ucar/cdm/pom.xml'
>         exclude 'META-INF/maven/edu.ucar/cdm/pom.properties'
>         exclude 'META-INF/maven/edu.ucar/grib/pom.xml'
>         exclude 'META-INF/maven/edu.ucar/grib/pom.properties'
>         exclude 'META-INF/maven/org.apache.xmlbeans/xmlbeans/pom.xml'
>         exclude 'META-INF/maven/org.apache.xmlbeans/xmlbeans/pom.properties'
>         exclude 'META-INF/maven/edu.ucar/httpservices/pom.xml'
>         exclude 'META-INF/maven/edu.ucar/httpservices/pom.properties'
>     }  } 
> 
> dependencies {
>     compile fileTree(dir: 'libs', include: ['*.jar'])
>     testCompile 'junit:junit:4.12'
>     compile 'com.android.support:appcompat-v7:24.2.1'
>     compile 'org.apache.pdfbox:pdfbox:2.0.4'  }

【问题讨论】:

标签: android android-studio noclassdeffounderror pdfbox


【解决方案1】:

您的库 pdfbox 使用了一个在 Java SDK 中定义的类 java.awt.color.ColorSpace,而该类不包含在 Android SDK 中

【讨论】:

  • 我认为这是个坏主意
  • @Rastinof 使用 PDFBox 的 Android 端口。
  • 谢谢@mkl。基于PDFBox库开源链接到PdfBox-Android
猜你喜欢
  • 2023-04-09
  • 1970-01-01
  • 2019-01-06
  • 2023-03-22
  • 2013-05-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-04-01
相关资源
最近更新 更多