Install Aspose.Words for Android via Java in B2G App via build.gradle Configuration

We’ve finally changed from building with ant (the ancient way) to building with gradle (the modern way). We’re now getting the following error:

  .../aspose/WordsOperations.java:343: error: cannot access zzF4
        Document document = new Document(stream, options);
                            ^
  class file for asposewobfuscated.zzF4 not found

I’m sure this must be related to proguard. How can we resolve this problem?

thank you for moving my request.

@NBP,

I am afraid, I was unable to reproduce this issue on my end when creating a new Gradle based Java project from scratch. I am sharing content of my simplified build.gradle file here for your reference:

plugins {
    id 'java'
}

repositories {
    mavenCentral()
    maven {
        url "https://repository.aspose.com/repo/"
    }
}

dependencies {
    implementation(
            group: 'com.aspose',
            name: 'aspose-words',
            version: '21.5',
            classifier: 'jdk17')
}

This allows me to use latest (21.5) version of Aspose.Words for Java in Gradle project.

P.S. I have tested compile and implementation in Gradle config and both of them are working fine on my end.

Thank you for trying and sharing your content.

Brian A. Mac Donald

President

National Braille Press

88 Saint Stephen Street

Boston, MA 02115 USA

617-425-2416 (w) 978-406-9717 (m)

www.nbp.org

1 Like

The editor is now running on the B2G but it’s saying that there’s a problem with the license. I think, therefore, that the error should be posted, and that then this should be added:

Since the AsposeWordsApplication object seems to be no longer defined, we thought that the code to load the libraries may be no longer needed so we removed this code:

  private final static AsposeWordsApplication wordsApplication =
                   new AsposeWordsApplication();

  static {
    Context context = ApplicationContext.getContext();
    wordsApplication.loadLibs(context);
  }

Now, however, it’s telling me that there’s a problem with the license so maybe removing that code was a bad idea. What do you suggest that we try next?

@NBP,

Please confirm, what API are you getting this problem with?

Please also create a standalone simplified Java/Android application (source code) that helps us to reproduce your current problem on our end and attach it here for testing. You can compress the project into ZIP format and attach the ZIP file. Please do not include Aspose.Words JAR files in it to reduce the ZIP file size. We will then start further investigation into your scenario and provide you more information.

Edit: can you please also share the stack-trace of the error/exception message that you are observing on your end?

The editor is now running on the B2G but it’s saying that there’s a problem with the license. I think, therefore, that the error should be posted, and that then this should be added:

Since the AsposeWordsApplication object seems to be no longer defined, we thought that the code to load the libraries may be no longer needed so we removed this code:

  private final static AsposeWordsApplication wordsApplication =
                   new AsposeWordsApplication();

  static {
    Context context = ApplicationContext.getContext();
    wordsApplication.loadLibs(context);
  }

Now, however, it’s telling me that there’s a problem with the license so maybe removing that code was a bad idea. What do you suggest that we try next?

From: Awais Hafeez via Free Support Forum - aspose.com <forum@aspose.com>

Please confirm, what API are you getting this problem with?

Perhaps the wrong one. We were instructed to use this code snippet to add it as a dependency to our gradle project:

repositories {
maven {
url "https://repository.aspose.com/repo/"
}
}
dependencies {
implementation(
group: "com.aspose",
name: "aspose-words",
version: "21.5",
classifier: "jdk17"
)
}

What should we be specifying instead?

Please also create a standalone simplified Java/Android application (source code) that helps us to reproduce your current problem on our end and attach it here for testing. You can compress the project into ZIP format and attach the ZIP file. Please do not include Aspose.Words JAR files in it to reduce the ZIP file size. We will then start further investigation into your scenario and provide you more information.

Since we may well be using the wrong API, I’ll wait for your advice on that, first.

Edit: can you please also share the stack-trace of the error/exception message that you are observing on your end?

There is no backtrace. It’s a compile failure. The AsposeWordsApplication object isn’t defined.

@NBP,

I think, you are working on a Java Android application. If that is the case then you need to use/reference “Aspose.Words for Android via Java” API in your project. Please add following configurations to the build.gradle (see also Install Aspose.Words for Android via Java from Maven Repository).

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

implementation (
        group: 'com.aspose',
        name: 'aspose-words',
        version: '21.4',
        classifier: 'android.via.java')

In case the problem still remains, then please provide your simplified Android Studio project (source code) here for further testing on our end.

Thank you again. We will let you know.