We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose Words for Android: Get page count

Hi there!

I am trying to get page count from office document using the following code:

try {
Document doc = new Document(path);//such as: “/storage/emulated/0/Download/Document.docx”
//Get page count
int pageCount = doc.getPageCount();

} catch (Exception e) {

However, application stops due to fatal exception:
java.lang.NoClassDefFoundError: com.aspose.words.Document

I am using jdk-1.7 and I have downloaded aspose-words-1.12-android.
Please advise.

Hi Luna,

Thanks for your inquiry. We have now divided the library into following two archives:

  • aspose-words-1.12-android-jdk15.jar: The first one includes public API and its auxiliary methods.
  • aspose-words-1.12-libs-android-jdk15.apk: The second one includes third party jars, basic classes and resources.

To include Aspose.Words for Android into the project you should place “aspose-words-1.12-android-jdk16.jar” in the folder “libs” of your project, and the archive “aspose-words-1.12-libs-android-jdk16.apk” into the folder “assets". After that you need to indicate in “AndroidManifest.xml” file that you are going to use AsposeWords application as the basic one. Please see the following markup:
android:theme="@style/AppTheme" >
I hope, this helps.

Best regards,