Free Support Forum - aspose.com

Unable to use Document() method

Hello…
hope you are doing well…!
I am using Android gradle with JDK 1.8.
I am able to implement only implementation ‘com.aspose:words:1.0’ from jCenter other dpendancy like compile group: ‘com.aspose’, name: ‘aspose-words’, version: ‘18.7’ getting problem.

ERROR: Failed to resolve: com.aspose:aspose-words:18.7

with ‘com.aspose:words:1.0’ able to get Document function
but when I passing path as argument it is not accepting.
also do not have save method tried with String Builder still no have save method to export the file


                                       app.gradle

dependencies {
.
.
.
implementation ‘com.aspose:words:1.0’

}



java code


try {
String dir = Environment.getExternalStorageDirectory().toString();

Document doc = new Document(…path…); //problem here not accepting aurg.
doc.save(); //save method not defined
/*
Also Tried

                   Document wpd = new Document(dir + "template.doc");
                    wpd.save(dir + "output.pdf", SaveFormat.PDF);

*/
//End
} catch (Exception e) {
e.printStackTrace();
}


@Amyth

Please try adding the following configurations to your build.gradle file:

maven {
    url "https://repository.aspose.com/repo/" }

and

compile (
        group: 'com.aspose',
        name: 'aspose-words',
        version: '20.10',
        classifier: 'jdk17')

Hope, this helps.

I am using gradle not maven as my whole project is in gradle…please help in Gradle

@Amyth

Please refer to the following link about Gradle dependency declaration.
https://repository.aspose.com/webapp/#/artifacts/browse/tree/General/repo/com/aspose/aspose-words/20.9/aspose-words-20.9.pom

@tahir.manzoor
Getting Error
ERROR: Failed to resolve: com.aspose:aspose-words:20.9
Show in Project Structure dialog
Affected Modules: app
same error for other relies too

@Amyth

Could you please share your working environment e.g. operating system, IDE etc.? Please also share your Java application that you are using. We will investigate the issue and provide you more information on it.

@tahir.manzoor
Sure
OS: WIndows-7
IDE : Android Studio
JDK : jdk1.8.0_91
compileSdkVersion 29
buildToolsVersion “29.0.2”
minSdkVersion 16
targetSdkVersion 29
multiDexEnabled true
androidx.multidex:multidex:2.0.1

Also tried…
implementation files(‘C:\Users\Computer\Downloads\aspose-words-18.12-jdk16’)
such things by adding jar libraries but not worked

@Amyth

In your case, we suggest you please use Aspose.Words for Android via Java. Please read the following article about installing Aspose.Words for Android via Java.

Install Aspose.Words for Android via Java

Tried in 1st reply only…
Tried not working…for gradle

@Amyth

We are really very sorry for your inconvenience. We are working over your query and will get back to you soon.

Ok but almost 3+ day past…Still thank you for support hoping your response soon.

@Amyth

We suggest you please download the latest version of Aspose.Words for Android via Java 20.6 and add its reference to your project manually. You can copy the Jar file in LIB folder and use Aspose.Words’ APIs.

We have logged this problem in our issue tracking system as WORDSJAND-466 . You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Resolve some how…
now facing new issue…
Crashing app showing error while creating document object…
Also…

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/aspose/words/internal/zz2K;
at com.aspose.words.internal.zz90.zzj(Unknown Source:67)

Activity crashing on click button while creating Document object

@Amyth

Please attach the following resources here for testing. We will investigate the issue and provide you more information on it.

  • Your input Word document.
  • Please share your sample application ( source code without compilation errors ) that helps us to reproduce your problem on our end.

PS: To attach these resources, please zip and upload them.