包括谷歌播放下载库| APK文件扩展库文件、APK

2023-09-07 13:17:33 作者:來不及說愛你

我下面dev的导游 http://developer.android.com /guide/market/expansion-files.html 以额外资产下载到我的apk。

我已经做了有关库的进口,等所有部件.. 我也实现了样品code。在我的主要程序(以检测是否扩展文件已经下载的,如果我们需要下载它们并启动下载,等等。)

我在Eclipse中没有错误,但是当我启动应用程序并开始呼叫从库中的方法和类,我有不同的崩溃:

1 - 首先,在安装时,亚行说,图书馆找不到..:

  [2012-04-17二十二点50分13秒 - 的MyApp]亚洲开发银行运行正常。
[2012-04-17 22点50分一十三秒 - 的MyApp]执行com.gmla.MyApp活动启动
[2012-04-17 22时50分16秒 - 的MyApp]上传MyApp.apk到设备SH16PV801048
[2012-04-17 22时50分16秒 - 的MyApp]安装MyApp.apk ...
[2012-04-17 22点五十零分22秒 - 的MyApp]成功!
[2012-04-17 22点五十零分22秒 - 谷歌播放下载资源库]找不到谷歌播放下载Library.apk!
[2012-04-17 22点五十零分22秒 - 谷歌播放许可证库]找不到谷歌播放许可证Library.apk!
 

下面是我如何试图导入我的图书馆截图: http://floy.fr/perso/floy/expfiles/4.PNG

我已经引进的具有项目导入库中的Java构建路径状部分),在我的主要项目属性: (进口许可证库下载库太)

我也试过部分仅导入罐子例如 B) (在安装这一个没有错误)

和的Andr​​oid库导入像部分的 C)(这似乎是一个建议,在开发指南,但我有编译错误这一个,日食不找一些参考我不能生成项目):

所以,罐子进口似乎是最好的,在编译和安装没有错误,但我以后有其他错误,当我拨打电话,以从库中methodes和类:

2 - 在应用程序中:

google Play商店的apk文件怎么下载到电脑上 google Play商店apk文件下载方法详解 飞翔教程

当我试图使用助手,以便检查这种方法的XAPKFiles的presence:

 布尔expansionFilesDelivered(){

        XAPKFile [] xAPKS = {新XAPKFile(真,3,687801613L)
        只有//主文件
        };

        对于(XAPKFile XF:xAPKS){
            字符串文件名= Helpers.getExpansionAPKFileName(这一点,xf.mIsMain,xf.mFileVersion);
            如果(!Helpers.doesFileExist(这一点,文件名,xf.mFileSize,FALSE))
                返回false;
        }
        返回true;
    }
 

我有这样的暴跌DDMS:

  04-17 23:14:24.614:I / dalvikvm(23201):找不到方法com.google.android.vending.expansion.downloader.Helpers.getExpansionAPKFileName,从引用方法com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.expansionFilesDelivered
04-17 23:14:24.614:W / dalvikvm(23201):VFY:无法解析静态方法1295:LCOM /谷歌/安卓/自动售货机/扩张/下载/助手; .getExpansionAPKFileName(Landroid /内容/语境,ZI) Ljava /朗/字符串;
04-17 23:14:24.614:D / dalvikvm(23201):VFY:在0x001b更换运code 0x71
04-17 23:14:24.614:W / dalvikvm(23201):无法解析LCOM / gmla / guideaudio / apkexp / GmlaDownloaderService的父类; (250)
04-17 23:14:24.614:W / dalvikvm(23201):类的链接LCOM / gmla / guideaudio / apkexp / GmlaDownloaderService;失败
04-17 23:14:24.614:E / dalvikvm(23201):找不到类的com.gmla.guideaudio.apkexp.GmlaDownloaderService,从法com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.onCreate引用
04-17 23:14:24.614:W / dalvikvm(23201):VFY:无法解析常量级135(LCOM / gmla / guideaudio / apkexp / GmlaDownloaderService;)在LCOM / gmla / guideaudio / apkexp / GmlaCheckExpFiles;
04-17 23:14:24.614:D / dalvikvm(23201):VFY:在0x001c更换运code为0x1C
04-17 23:14:24.624:V /性能(23201):>> com.gmla.guideaudio.apkexp.GmlaCheckExpFiles@40db32b0的onCreate
04-17 23:14:24.624:D / AndroidRuntime(23201):关闭虚拟机
04-17 23:14:24.624:W / dalvikvm(23201):主题ID = 1:螺纹退出与未捕获的异常(组= 0x40abf228)
04-17 23:14:24.624:E / AndroidRuntime(23201):致命异常:主要
04-17 23:14:24.624:E / AndroidRuntime(23201):java.lang.NoClassDefFoundError的:com.google.android.vending.expansion.downloader.Helpers
04-17 23:14:24.624:E / AndroidRuntime(23201):在com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.expansionFilesDelivered(GmlaCheckExpFiles.java:64)
04-17 23:14:24.624:E / AndroidRuntime(23201):在com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.onCreate(GmlaCheckExpFiles.java:22)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.Activity.performCreate(Activity.java:4524)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2189)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.ActivityThread.access $ 600(ActivityThread.java:139)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1261)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.os.Handler.dispatchMessage(Handler.java:99)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.os.Looper.loop(Looper.java:154)
04-17 23:14:24.624:E / AndroidRuntime(23201):在android.app.ActivityThread.main(ActivityThread.java:4894)
04-17 23:14:24.624:E / AndroidRuntime(23201):在java.lang.reflect.Method.invokeNative(本机方法)
04-17 23:14:24.624:E / AndroidRuntime(23201):在java.lang.reflect.Method.invoke(Method.java:511)
04-17 23:14:24.624:E / AndroidRuntime(23201):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:784)
04-17 23:14:24.624:E / AndroidRuntime(23201):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-17 23:14:24.624:E / AndroidRuntime(23201):在dalvik.system.NativeStart.main(本机方法)
 

当我使用方法1或2,当我导入库这个崩溃发生。

我尝试更新蚂蚁最新的1.8.3,因为我读1.7.1可以与库进口的一些问题..对解决我的问题,没有成功。

我的主要应用是在谷歌API 8(Android 2.2的)

我寻觅了很多事情,以​​使这项工作,但..现在我完全没了主意!

如果有人知道如何得到这个工作,这将是非常亲切:P

对不起,这么长职位,对不起我的英语水平,如果我做出错误拼写错误,那是因为我是法国人:P

编辑:我曾尝试下载示例code,与库导入方法 C),我没有编译错误这段时间,但在安装过程中

  [2012-04-18 1时56分16秒 -  GuideAudio] Android的推出!
[2012-04-18 1时56分16秒 -  GuideAudio]亚洲开发银行运行正常。
[2012-04-18 1时56分16秒 -  GuideAudio]执行com.gmla.guideaudio.GuideAudio活动启动
[2012-04-18 1时56分十九秒 -  GuideAudio]上传GuideAudio.apk到设备SH16PV801048
[2012-04-18 1时56分十九秒 -  GuideAudio]安装GuideAudio.apk ...
[2012-04-18 1时56分21秒 -  GuideAudio]安装错误:INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-04-18 1时56分21秒 -  GuideAudio]请logcat的输出获取更多信息。
[2012-04-18 1时56分21秒 -  GuideAudio]启动取消!
 

我不明白,因为库似乎得到了很好的进口... 我可以看到他们在引用的库在Eclipse。

我也写在清单:

 <使用库机器人:名称=com.google.android.vending.expansion.downloader/>
         <使用库机器人:名称=com.google.android.vending.licensing/>
 

解决方案

答案可能是这个回答类似的问题: http://stackoverflow.com/a/10109546/180538

我有这个问题,前两天,也和答案解决它。尤其是读的最后一段。

<使用库> 标签的目的不是用于第三方的东西,只适合安装在设备已经存在的库。如地图,它是安装在每个官方Android设备上的(亚马逊的Kindle是不是一个官方的Andr​​oid设备,只是作为一个例子)。

我也不能肯定,如果您已将库项目到项目的和的链接的罐子在同一时间。这也可能引起麻烦。

PS:欢迎社会各界:)大问题

I'm following dev guide at http://developer.android.com/guide/market/expansion-files.html in order to download additional assets to my apk.

I've done all the part about the importation of libraries, etc .. I've also implemented the samples code in my main program (in order to detect if expansion files are already downloaded, if we need to download them and launch the download, etc ..)

I have no errors in eclipse, but when I launch the app and starting to call the methods and classes from the library, I have various crashes:

1 - First, at the installation, adb says that the libraries couldn't be found.. :

[2012-04-17 22:50:13 - MyApp] adb is running normally.
[2012-04-17 22:50:13 - MyApp] Performing com.gmla.MyApp activity launch
[2012-04-17 22:50:16 - MyApp] Uploading MyApp.apk onto device 'SH16PV801048'
[2012-04-17 22:50:16 - MyApp] Installing MyApp.apk...
[2012-04-17 22:50:22 - MyApp] Success!
[2012-04-17 22:50:22 - Google Play Downloader Library] Could not find Google Play Downloader Library.apk!
[2012-04-17 22:50:22 - Google Play License Library] Could not find Google Play License Library.apk!

Here is a screenshot of how I have tried to import my libraries: http://floy.fr/perso/floy/expfiles/4.PNG

I have imported the libraries with project import in the Java Build Path like part a), in my main project properties: (imported the licence library in the download library that way too)

I've also tried to import only the jars like in part b) (no error at installation with this one)

and with the Android Library import like in part c) (It seems to be the one recommended in the dev guide, but I have compilation errors with this one, eclipse don't find some references and i can't build the project):

So, the jar importation seems to be the best, no errors at compilation and installation, but I have other errors after, when I'm making a call to the methodes and classes from the library:

2 - In the app :

When i'm trying to use the helper in order to check the presence of the XAPKFiles with this method :

boolean expansionFilesDelivered() {

        XAPKFile[] xAPKS = {new XAPKFile(true, 3, 687801613L)
        // main file only
        };

        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;
    } 

I have this crash in DDMS:

04-17 23:14:24.614: I/dalvikvm(23201): Could not find method com.google.android.vending.expansion.downloader.Helpers.getExpansionAPKFileName, referenced from method com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.expansionFilesDelivered
04-17 23:14:24.614: W/dalvikvm(23201): VFY: unable to resolve static method 1295: Lcom/google/android/vending/expansion/downloader/Helpers;.getExpansionAPKFileName (Landroid/content/Context;ZI)Ljava/lang/String;
04-17 23:14:24.614: D/dalvikvm(23201): VFY: replacing opcode 0x71 at 0x001b
04-17 23:14:24.614: W/dalvikvm(23201): Unable to resolve superclass of Lcom/gmla/guideaudio/apkexp/GmlaDownloaderService; (250)
04-17 23:14:24.614: W/dalvikvm(23201): Link of class 'Lcom/gmla/guideaudio/apkexp/GmlaDownloaderService;' failed
04-17 23:14:24.614: E/dalvikvm(23201): Could not find class 'com.gmla.guideaudio.apkexp.GmlaDownloaderService', referenced from method com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.onCreate
04-17 23:14:24.614: W/dalvikvm(23201): VFY: unable to resolve const-class 135 (Lcom/gmla/guideaudio/apkexp/GmlaDownloaderService;) in Lcom/gmla/guideaudio/apkexp/GmlaCheckExpFiles;
04-17 23:14:24.614: D/dalvikvm(23201): VFY: replacing opcode 0x1c at 0x001c
04-17 23:14:24.624: V/Performance(23201): >>com.gmla.guideaudio.apkexp.GmlaCheckExpFiles@40db32b0 onCreate
04-17 23:14:24.624: D/AndroidRuntime(23201): Shutting down VM
04-17 23:14:24.624: W/dalvikvm(23201): threadid=1: thread exiting with uncaught exception (group=0x40abf228)
04-17 23:14:24.624: E/AndroidRuntime(23201): FATAL EXCEPTION: main
04-17 23:14:24.624: E/AndroidRuntime(23201): java.lang.NoClassDefFoundError: com.google.android.vending.expansion.downloader.Helpers
04-17 23:14:24.624: E/AndroidRuntime(23201):    at com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.expansionFilesDelivered(GmlaCheckExpFiles.java:64)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at com.gmla.guideaudio.apkexp.GmlaCheckExpFiles.onCreate(GmlaCheckExpFiles.java:22)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.Activity.performCreate(Activity.java:4524)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2115)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2189)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.ActivityThread.access$600(ActivityThread.java:139)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1261)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.os.Looper.loop(Looper.java:154)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at android.app.ActivityThread.main(ActivityThread.java:4894)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at java.lang.reflect.Method.invokeNative(Native Method)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at java.lang.reflect.Method.invoke(Method.java:511)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
04-17 23:14:24.624: E/AndroidRuntime(23201):    at dalvik.system.NativeStart.main(Native Method)

This crash happen when i'm using the method 1 or 2 when i'm importing the libraries.

I have tried to update ant to latest 1.8.3 because I read that 1.7.1 could have some issues with library imports .. with no success on resolving my problems .

My main application is on Google API 8 (Android 2.2)

I have searched a lot of things in order to make this to work but .. now i'm completely out of ideas !

If someone knows how to get this working that would be very kind :p

Sorry for this long post and sorry for my english, if i made misspelling mistakes, that's because i'm french :p

EDIT: I have tried the downloader sample code, with the library import method c), I have no compilation errors this time, but during the installation :

[2012-04-18 01:56:16 - GuideAudio] Android Launch!
[2012-04-18 01:56:16 - GuideAudio] adb is running normally.
[2012-04-18 01:56:16 - GuideAudio] Performing com.gmla.guideaudio.GuideAudio activity launch
[2012-04-18 01:56:19 - GuideAudio] Uploading GuideAudio.apk onto device 'SH16PV801048'
[2012-04-18 01:56:19 - GuideAudio] Installing GuideAudio.apk...
[2012-04-18 01:56:21 - GuideAudio] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-04-18 01:56:21 - GuideAudio] Please check logcat output for more details.
[2012-04-18 01:56:21 - GuideAudio] Launch canceled!

I don't understand because the library seems to be well imported ... I can see them under "Referenced Library" in Eclipse.

I've also write on the manifest :

<uses-library android:name="com.google.android.vending.expansion.downloader" />
         <uses-library android:name="com.google.android.vending.licensing" />

解决方案

The answer might be in this answer to a similar question: http://stackoverflow.com/a/10109546/180538

I had this issue two days ago, too, and the answer solved it. Especially read the last paragraph.

The <uses-library> tags are not meant to be used for third party stuff, only for already existing libraries installed on the devices. Like Maps, which is installed on each official android device (Amazon Kindle is not an official android device, just as an example).

I am also not sure if you have added your library projects to your project and linking the jars at the same time. That might also cause trouble.

PS: Welcome to the community :) Great question!