Файлы расширения APK - Библиотека загрузчика не поддерживает Android Oreo и Android Studio версии 3.2?

Я считаю, что исходная библиотека расширений APK была немного переработана. И не поддерживает Android Oreo.

Во-первых: я пытаюсь использовать библиотеку загрузчиков Google и службу лицензирования приложений, так как мое приложение будет использовать расширение APK. Я прочитал руководство от https://developer.android.com/google/play/expansion-files#java и https://kitefaster.com/2017/02/15/expansion-apk-files-android-studio/, все идет хорошо. Но error.expansion.downloader не существует. Я сделал все как в инструкции введите здесь описание изображения , введите здесь описание изображения , введите здесь описание изображения

Иконка, я использовал библиотеку из git-hub https://github.com/danikula/Google-Play-Expansion-File Но всегда отображается статус IDownloaderClient.STATE_FAILED_FETCHING_URL при загрузке файла OBB, который не поддерживает Android Oreo с предупреждением разработчика об ошибке. Предупреждение разработчика для пакета Не удалось опубликовать уведомление на канале. Код загрузки файла OBB:

        if (!expansionFilesDelivered()) {

        try {
            Intent launchIntent = SampleDownloaderActivity.this
                    .getIntent();
            Intent intentToLaunchThisActivityFromNotification = new Intent(
                    SampleDownloaderActivity
                    .this, SampleDownloaderActivity.this.getClass());
            intentToLaunchThisActivityFromNotification.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                    Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intentToLaunchThisActivityFromNotification.setAction(launchIntent.getAction());

            if (launchIntent.getCategories() != null) {
                for (String category : launchIntent.getCategories()) {
                    intentToLaunchThisActivityFromNotification.addCategory(category);
                }
            }

            // Build PendingIntent used to open this activity from
            // Notification
            PendingIntent pendingIntent = PendingIntent.getActivity(
                    SampleDownloaderActivity.this,
                    0, intentToLaunchThisActivityFromNotification,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            // Request to start the download
            int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
                    pendingIntent, SampleDownloaderService.class);

            if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
                // The DownloaderService has started downloading the files,
                // show progress
                initializeDownloadUI();
                return;
            } // otherwise, download not needed so we fall through to
              // starting the movie
        } catch (NameNotFoundException e) {
            Log.e(LOG_TAG, "Cannot find own package! MAYDAY!");
            e.printStackTrace();
        }

    } else {
        validateXAPKZipFiles();
    }

Я надеюсь, что кто-нибудь даст мне решение, пожалуйста.



person Thanh Cả Phan    schedule 26.10.2018    source источник


Ответы (2)


Попробуйте перейти на последний код расширения с Github. Google еще не обновил свои документы. Код находится по адресу: https://github.com/google/play-apk-expansion

person Nick Fortescue    schedule 30.10.2018

Я действительно не знаю вашей проблемы, но мой приведенный ниже код использует play-apk-expansion и работает нормально. просто обратите внимание, что при использовании эмулятора для использования поддерживаемого Google Play изображения.

void check_apkx(){
    if (!expansionFilesDelivered()) {
        try {                  
            Intent launchIntent = MainActivity.this.getIntent();
            Intent intentToLaunchThisActivityFromNotification = new Intent(
                    MainActivity.this, MainActivity.this.getClass());
            intentToLaunchThisActivityFromNotification.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
                    Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intentToLaunchThisActivityFromNotification.setAction(launchIntent.getAction());

            if (launchIntent.getCategories() != null) {
                for (String category : launchIntent.getCategories()) {
                    intentToLaunchThisActivityFromNotification.addCategory(category);
                }
            }
            // Build PendingIntent used to open this activity from
            // Notification
            PendingIntent pendingIntent = PendingIntent.getActivity(
                    MainActivity.this,
                    0, intentToLaunchThisActivityFromNotification,
                    PendingIntent.FLAG_UPDATE_CURRENT);
            // Request to start the download
            DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
                    pendingIntent, SampleDownloaderService.class);

        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

    } else {
//            validateXAPKZipFiles();


    }
person Atef Farouk    schedule 03.03.2019