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

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

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

Финал Я использовал lib из git-hub https://github.com/bolein/better-apk-expansion Но он всегда имеет статус IDownloaderClient.STATE_FAILED_FETCHING_URL при загрузке файла OBB и не поддерживает Android Oreo с ошибкой toast Предупреждение разработчика для пакета Не удалось опубликовать уведомление на канале.Код загрузки файла 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();
    }

Надеюсь, кто-нибудь подскажет, пожалуйста.


Ответы [ 2 ]

0 голосов
/ 03 марта 2019

Я действительно не знаю вашей проблемы, но мой код ниже использует play-apk-extension и работает нормально. просто обратите внимание, что при использовании эмулятора для использования 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();


    }
0 голосов
/ 30 октября 2018

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

...