Failed to Use Aspose.Slides for Java in an Android System App

Hey,

I’m creating an android application which should convert pptx files to pdf.
It needs to be a system app so I’ve added android:sharedUserId="android.uid.system" into the manifest.
I don’t get errors when this is removed but I need it to be a system app.
When I run it as system app I get these errors:

FATAL EXCEPTION: main (Ask Gemini)
Process: com.prowise.app.pptx_import_android, PID: 5930
java.lang.ExceptionInInitializerError
at com.aspose.slides.PPImage.(Unknown Source:23)
at com.aspose.slides.PPImage.(Unknown Source:0)
at com.aspose.slides.ImageCollection.hj(Unknown Source:39)
at com.aspose.slides.kku.ip(Unknown Source:39)
at com.aspose.slides.kku.hj(Unknown Source:109)
at com.aspose.slides.rha.la(Unknown Source:34)
at com.aspose.slides.rha.hj(Unknown Source:90)
at com.aspose.slides.Presentation.la(Unknown Source:57)
at com.aspose.slides.Presentation.hj(Unknown Source:63)
at com.aspose.slides.Presentation.hj(Unknown Source:35)
at com.aspose.slides.Presentation.(Unknown Source:5)
at com.aspose.slides.Presentation.(Unknown Source:5)
at com.prowise.app.pptx_import_android.MainActivity.convertPPTXToPDF(MainActivity.kt:17)
at com.prowise.app.pptx_import_android.MainActivity.onCreate(MainActivity.kt:12)
at android.app.Activity.performCreate(Activity.java:8305)
at android.app.Activity.performCreate(Activity.java:8284)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3630)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3786)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2311)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7879)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:943)
Caused by: java.lang.NullPointerException: Attempt to read from field ‘com.aspose.slides.ms.backend.System.Drawing.gi com.aspose.slides.ms.backend.System.Drawing.GraphicsEnv.h8’ on a null object reference in method ‘com.aspose.slides.ms.backend.System.Drawing.gi com.aspose.slides.ms.backend.System.Drawing.GraphicsEnv.gi()’
at com.aspose.slides.ms.backend.System.Drawing.GraphicsEnv.gi(Unknown Source:4)
at com.aspose.slides.ms.backend.System.Drawing.gi.hj(Unknown Source:0)
at com.aspose.slides.internal.zw.te.(Unknown Source:3)
at com.aspose.slides.internal.zw.te.(Unknown Source:2)
at com.aspose.slides.PPImage.(Unknown Source:23)
at com.aspose.slides.PPImage.(Unknown Source:0)
at com.aspose.slides.ImageCollection.hj(Unknown Source:39)
at com.aspose.slides.kku.ip(Unknown Source:39)
at com.aspose.slides.kku.hj(Unknown Source:109)
at com.aspose.slides.rha.la(Unknown Source:34)
at com.aspose.slides.rha.hj(Unknown Source:90)
at com.aspose.slides.Presentation.la(Unknown Source:57)
at com.aspose.slides.Presentation.hj(Unknown Source:63)
at com.aspose.slides.Presentation.hj(Unknown Source:35)
at com.aspose.slides.Presentation.(Unknown Source:5)
at com.aspose.slides.Presentation.(Unknown Source:5)
at com.prowise.app.pptx_import_android.MainActivity.convertPPTXToPDF(MainActivity.kt:17)
at com.prowise.app.pptx_import_android.MainActivity.onCreate(MainActivity.kt:12)
at android.app.Activity.performCreate(Activity.java:8305)
at android.app.Activity.performCreate(Activity.java:8284)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1417)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3630)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3786)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2311)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7879)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:943)

The pptx file is zipped:
test.pptx.zip (395.7 KB)

The project (also containing the pptx file) is attached as zip:
pptx_import_android.zip (1.5 MB)

You still need to add the aspose-slides-24.12-android.via.java.jar to the libs folder (Needed to remove it because else the upload was to big).

Also I have removed the signing file because it is a specific key which is needed for my device.

We’ve already bought a license but this sample project doesn’t contain it. Also setting the license has issues with the system app.

I’ve the same problem as this topic, but this isn’t complete:

I’ve also looked into this ticket, but the solutions given here don’t work for me:

@JKorsten

It seems that you are encountering a NullPointerException when trying to use Aspose.Slides in your Android application configured as a system app. This issue often arises due to the way system apps handle resources and permissions differently compared to regular apps.

Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Check Resource Access: Ensure that your app has the necessary permissions to access the resources it needs. System apps may require different permissions or configurations in the manifest.

  2. Initialization of Aspose.Slides: Make sure that the Aspose.Slides library is properly initialized before you attempt to use it. Sometimes, the library may need specific configurations that are not automatically set when running as a system app.

  3. Use of AssetManager: If you are loading the PPTX file from the assets folder, ensure that you are using the correct context to access the assets. For system apps, you might need to use a different method to access the assets.

  4. Testing with a Simple Project: Create a minimal project that only includes the Aspose.Slides functionality you are trying to use. This can help isolate the issue and determine if it is related to your specific implementation or a broader compatibility issue with system apps.

  5. Review Similar Issues: There are other users who have faced similar issues when running Aspose.Slides in a system app context. Reviewing their experiences and solutions might provide insights into resolving your problem.

If the problem persists, consider reaching out to Aspose support with detailed information about your setup, including the specific version of the library you are using, the Android version, and any relevant code snippets.

If you have any further questions or need additional assistance, feel free to ask!

I’ve already looked for more tickets related the issue online and no solution works for me. (also not much solutions are given). I also getting the issue using the easy app which is attached.

@JKorsten,
I need some time to check the issue. I will get back to you soon.

@JKorsten,
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESANDROID-525

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@JKorsten,
Our developers have found the cause of the issue and resolved it. The fix will be available in Aspose.Slides for Android via Java 25.3.

1 Like

Great, when will this version be available?

@JKorsten,
Aspose.Slides for Android via Java 25.3 will be published in the second half of March.

@JKorsten,
The issues you found earlier (filed as SLIDESANDROID-525) have been resolved in Aspose.Slides for Android via Java 25.3 (ZIP, Maven).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.