包括Google Play Downloader Library | APK文件扩展库 [英] Including Google Play Downloader Library | APK File Expansion Library

查看:547
本文介绍了包括Google Play Downloader Library | APK文件扩展库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 http://developer.android.com上关注dev指南/guide/market/expansion-files.html ,以便将其他资源下载到我的apk。



我已经完成了关于导入图书馆等。
我还在我的主程序中实现了示例代码(为了检测扩展文件是否已经下载,如果我们需要下载并启动下载等)。 p>

我在eclipse中没有错误,但是当我启动应用程序并开始从库中调用方法和类时,我有各种崩溃:



1 - 首先,在安装过程中,adb表示无法找到图书馆..:

  [2012-04-17 22:50:13  -  MyApp] adb正常运行。 
[2012-04-17 22:50:13 - 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:50:22 - MyApp]成功!
[2012-04-17 22:50:22 - Google Play Downloader Library]找不到Google Play Downloader Library.apk!
[2012-04-17 22:50:22 - Google Play许可证库]无法找到Google Play许可证Library.apk!

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



在我的主要项目属性中,我已经在Java构建路径中导入了项目导入的库,如部分 a)
(导入b)

$ b

我也试图导入只有这些jar, b(在这个安装时没有错误)



和Android库导入一样 c)(似乎是一个推荐在开发指南中,但是我有这个编译错误,eclipse没有找到一些引用,我不能构建项目):



所以, jar进口似乎是最好的,在编译和安装时没有错误,但是当我打电话时我有其他的错误来自图书馆的方法和类:



2 - 在应用程序中:



当我试图使用帮助器,以便通过这种方法来检查薰文件的存在:

  boolean expansionFilesDelivered (){

ReferralFile [] xAPKS = {newgrapFile(true,3,687801613L)
//仅主文件
};

for(BlossFile xf:xAPKS){
String fileName = Helpers.getExpansionAPKFileName(this,xf.mIsMain,xf.mFileVersion);
if(!Helpers.doesFileExist(this,fileName,xf.mFileSize,false))
return 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 / google / android /自动售货机/扩展/下载器/助手; .getExpansionAPKFileName(Landroid / content / Context; ZI)Ljava / lang / String;
04-17 23:14:24.614:D / dalvikvm(23201):VFY:将操作码0x71替换为0x001b
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:无法解析Lcom / gmla / guideaudio / apkexp / GmlaCheckExpFiles中的const-class 135(Lcom / gmla / guideaudio / apkexp / GmlaDownloaderService;);
04-17 23:14:24.614:D / dalvikvm(23201):VFY:替换操作码0x1c在0x001c
04-17 23:14:24.624:V /性能(23201):>> ; com.gmla.guideaudio.apkexp.GmlaCheckExpFiles@40db32b0 onCreate
04-17 23:14:24.624:D / AndroidRuntime(23201):关闭VM
04-17 23:14:24.624:W / dalvikvm(23201):threadid = 1:线程退出与未捕获的异常(组= 0x40abf228)
04-17 23:14:24.624:E / AndroidRuntime(23201):致命例外: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):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) .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):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):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):at java.lang.reflect.Method.invokeNative(Native Method)
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):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):在dalvik.system.NativeStart.main(Native Method)

当我使用方法1或2,当我导入库。



我已经尝试更新蚂蚁最新的1.8.3,因为我看到1.7.1可能有一些问题我的主要应用是在Google API 8(Android 2.2)上。



我搜索了很多东西,以使其工作,但现在我完全没有了想法!



如果有人知道如何使这项工作变得非常友善:p



对我的英语抱歉,如果我拼错了,那是因为我是法国人:p



编辑:代码,使用库导入方法 c),这次我没有编译错误,但在安装过程中:

  [2012-04-18 01:56:16  -  GuideAudio] Android发布! 
[2012-04-18 01:56:16 - GuideAudio] adb正常运行。
[2012-04-18 01:56:16 - GuideAudio]执行com.gmla.guideaudio.GuideAudio活动启动
[2012-04-18 01:56:19 - GuideAudio]上传GuideAudio.apk到设备'SH16PV801048'
[2012-04-18 01:56:19 - GuideAudio]安装GuideAudio.apk ...
[2012-04-18 01:56:21 - GuideAudio]安装错误:INSTALL_FAILED_MISSING_SHARED_LIBRARY
[2012-04-18 01:56:21 - GuideAudio]请查看logcat输出了解更多详细信息。
[2012-04-18 01:56:21 - GuideAudio]启动取消!

我不明白,因为图书馆似乎很好导入...
I可以在Eclipse中的参考库下看到它们。



我还在清单上写:

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


解决方案

答案可能在这个答案中类似的问题:
https://stackoverflow.com/a/10109546/180538



两天前我有这个问题,答案解决了。特别是阅读最后一段。



< uses-library> 标签不适用于第三派对的东西,只为设备上已经存在的库安装。像地图,它安装在每个官方的Android设备上(亚马逊Kindle不是一个官方的Android设备,就像一个例子)。



我也不确定你是否有将您的图书馆项目添加到您的项目同时链接jar。这可能也会造成麻烦。


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: https://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.

这篇关于包括Google Play Downloader Library | APK文件扩展库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆