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

Free Support Forum - aspose.com

Cannot find license 'Aspose.PDF.Android.Java'

having problem in setting license

Error: “Cannot find license ‘Aspose.PDF.Android.Java’.”

@saadshafqat

I request you to check if the license file is accessible with needed rights and access permissions. Try to change file path because it looks like a normal IO error.

Kindly guide me how to set license which permissions needed and where to put license file. Kindly help

@saadshafqat69

You can please verify for the permissions to read/write to the external storage. Please check the below code snippet:

// Storage Permissions
    private static final int REQUEST_EXTERNAL_STORAGE = 1;
    private static String[] PERMISSIONS_STORAGE = {
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.WRITE_EXTERNAL_STORAGE
    };

    /**
     * Checks if the app has permission to write to device storage
     *
     * If the app does not has permission then the user will be prompted to grant permissions
     *
     * @param activity
     */
    public static void verifyStoragePermissions(Activity activity) {
        // Check if we have write permission
        int permission = ActivityCompat.checkSelfPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
        int permissionR = ActivityCompat.checkSelfPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);

        if (permission != PackageManager.PERMISSION_GRANTED) {
            // We don't have permission so prompt the user
            ActivityCompat.requestPermissions(
                    activity,
                    PERMISSIONS_STORAGE,
                    REQUEST_EXTERNAL_STORAGE
            );
        }
        if (permissionR != PackageManager.PERMISSION_GRANTED) {
            // We don't have permission so prompt the user
            ActivityCompat.requestPermissions(
                    activity,
                    PERMISSIONS_STORAGE,
                    REQUEST_EXTERNAL_STORAGE
            );
        }
    }

You can then call the verifyStoragePermissions() method in the onCreate() method of the main activity:

protected void onCreate(Bundle savedInstanceState) {
        // verify permissions
        verifyStoragePermissions(this);
}

You can put the license file in any folder of external storage of the Device or Emulator and then access it using Environment.getExternalStorageDirectory()+"/Documents/license.lic" or getExternalFilesDir("license.lic").toString(). In case issue still persists, please share complete information of the use case with us along with the stack trace information of the error that you are facing. We will further proceed to assist you accordingly.

Cannot find “ImageCompressionOptions” class in Aspose.PDF Library in Android

@saadshafqat

Please try to use the complete namespace in order to use the option like com.aspose.pdf.optimization.ImageCompressionOptions. In case it still does not resolve the issue, please let us know.

Still having issue Cannot resolve symbol ‘optimization’ in com.aspose.pdf.optimization.ImageCompressionOptions

Capture.JPG (4.0 KB)

@saadshafqat

Aspose.PDF for Android via Java is driven from Aspose.PDF for Java and ImageCompressionOptions exists in Java API. Nevertheless, we have also noticed that the required class is missing in 20.11 version of the API. Therefore, an issue as PDFANDROID-621 has been logged in our issue management system. We will further look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.