2017-03-07 3 views
1

Je veux utiliser PDFBox dans mon Android application.but je faisais face à cette erreur:NoClassDefFoundError dans PDFBox studio android

FATAL EXCEPTION: main Process: com.android.app.spritzing, PID: 12534 java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/color/ColorSpace;*

mon fichier gradle.build est comme ceci:

> 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' } 
+2

Copie possible de [Comment ajouter PDFBox à un projet Android ou suggérer une alternative] (http://stackoverflow.com/questions/8980668/how-to-add-pdfbox-to-an-android-project-or-suggest- alternative) –

Répondre

1

Votre bibliothèque pdfbox utilise une classe java.awt.color.ColorSpace définie dans Java SDK et cette classe n'est pas incluse dans Android SDK

+0

alors comment puis-je l'inclure dans Android SDK ??? – Rastinof

+0

Je pense que c'est une mauvaise idée – KosWarm

+1

@Rastinof Utilisez un port Android de PDFBox. – mkl