APK 擴展文件下載不起作用 (APK Expansion file download doesn´t work)


問題描述

APK 擴展文件下載不起作用 (APK Expansion file download doesn´t work)

我需要將擴展支持集成到我的應用中。到目前為止,我的應用程序中有示例 DownloaderActivity、Service 和 Receiver。

現在我設置了 XAPKFile

        return new XAPKFile[]{new XAPKFile(
            true,//is main?
            3,//Version
            4550105L)};//File size

文件大小是正確的,它不是“磁盤大小”,但我也試過了。

版本號始終等於我的 apk 包版本。

我將這兩個版本都作為 alhpa 版本上傳到市場上以對其進行測試並使其他人無法訪問。

測試帳戶是開發者帳戶。

問題是現在,下載不會開始。我總是收到提示“下載失敗,因為您可能沒有購買此應用程序”。

我昨天在下載器服務中調試了很多應用程序,以找到實際問題。我在 LicenseValidator.java 驗證方法中從服務器返回的響應代碼始終為 NOT_LICENSED。

RSA 密鑰是正確的。

為什麼我的應用沒有獲得許可?

編輯:

我現在在另一個帳戶上對其進行了測試,得到了不同的錯誤:

enter image description here

該帳戶已作為測試帳戶添加到開發者控制台的許可中


參考解法

方法 1:

I´ve waited one day and now it magically works. Seems that Google needed some time for progressing.

Edit:

Now it stopped working again with the error "Download failed because the resources could not be found", how funny...

方法 2:

When I use Android 5.0.1 I set targetSdkVersion 19 after then my problem solved.

<uses‑sdk
    android:minSdkVersion="9" 
    android:targetSdkVersion="19" />

enter image description here

Wehn I use Android 5.0.1 I set targetSdkVersion 21 I have below error.

<uses‑sdk
        android:minSdkVersion="9" 
        android:targetSdkVersion="21" />

download failed because you may not have purchased this app

LogCat error like this:

12‑28 15:06:34.521: E/AndroidRuntime(14153): FATAL EXCEPTION: main
12‑28 15:06:34.521: E/AndroidRuntime(14153): Process: your_app_package_name, PID: 14153
12‑28 15:06:34.521: E/AndroidRuntime(14153): java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.licensing.ILicensingService }
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1674)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1773)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.app.ContextImpl.bindService(ContextImpl.java:1751)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.content.ContextWrapper.bindService(ContextWrapper.java:538)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at com.google.android.vending.licensing.LicenseChecker.checkAccess(LicenseChecker.java:150)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at com.google.android.vending.expansion.downloader.impl.DownloaderService$LVLRunnable.run(DownloaderService.java:768)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.os.Handler.handleCallback(Handler.java:739)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.os.Handler.dispatchMessage(Handler.java:95)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.os.Looper.loop(Looper.java:135)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at android.app.ActivityThread.main(ActivityThread.java:5221)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at java.lang.reflect.Method.invoke(Native Method)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at java.lang.reflect.Method.invoke(Method.java:372)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
12‑28 15:06:34.521: E/AndroidRuntime(14153):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

方法 3:

Make sure the file size same as expansion file uploaded to the android console,

 return new XAPKFile[]{new XAPKFile(
        true,//is main?
        3,//Version
        99695373L)};//File size

enter image description here

And I had the same problem also, but the problem come from here

boolean expansionFilesDelivered() {
    for (XAPKFile xf : xAPKS) {
        String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);
        if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
            return false;
    }
    return true;
}

It returning false, so the app can not validated the expansion file even the file is downloaded, so I fixed by adding else

boolean expansionFilesDelivered() {
    for (XAPKFile xf : xAPKS) {
        String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsMain, xf.mFileVersion);

        if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, true)) {
            return false;
        }else{
            return true;
        }
    }
    return true;
}

and on account setting, setting licensed test response to LICENSEDenter image description here

Hope that can help you :)

(by Marian KlühspiesMarian Klühspiesethemsulanilovebali)

參考文件

  1. APK Expansion file download doesn´t work (CC BY‑SA 2.5/3.0/4.0)

#android-lvl #apk-expansion-files #Android






相關問題

這種 Google LVL 政策實施是否合理安全? (Would this Google LVL policy implementation be reasonably secure?)

在 SDK 管理器中找不到 Google 市場許可包 (Cant find Google Market Licensing package in SDK Manager)

在 Google Play 上查詢應用程序當前版本的更快方法? (Faster Way to Query Application's Current Version on Google Play?)

Android 應用許可檢查 (Android app licensing check)

Ứng dụng Giấy phép Android hiển thị Không được cấp phép? (Android License App showing Not-licensed?)

導入 com.google.android.vending 無法在導入的 android 項目中解析 (The import com.google.android.vending cannot be resolved in an imported android project)

Android“Not_Market_Managed”錯誤 (Android “Not_Market_Managed” error)

是否可以向服務添加許可證檢查(使用許可證驗證庫)? (Is it possible to add a license check (using License Verification Library) to a Service?)

應用程序許可和 android 唯一 ID (Application Licensing and android unique id)

Android 許可 - 每個 Android 開發者帳戶只有一個公鑰? (Android Licensing - Only one public key per Android Developer account?)

測試 Android LVL,許可證檢查總是失敗,沒有網絡 (Testing Android LVL, license check always fails with no network)

什麼時候從服務器返回 LICENSED_OLD_KEY? (When is LICENSED_OLD_KEY returned from server?)







留言討論