Android的 - 这么多的问题与扩展库 [英] android - so many problems with the expansion library

查看:204
本文介绍了Android的 - 这么多的问题与扩展库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用新的谷歌播放(或市场)的扩展库,和我有很难与它。 我不知道其他人是否使用它,发现同样的问题,我可以看到,所以我会很高兴,如果你能帮助是解决这些问题:

1.sometimes我没有得到重要事件(错误,例如)回下载活动。

2.it不会对某些设备在所有的工作,像XOOM。我想我已经固定它: <一href="http://stackoverflow.com/questions/9807048/download-expansion-files-on-tablet/9873671#9873671">Download在平板电脑上扩展文件

3.even对于相同的设备,一个可以下载​​的文件和其他总能得到一个连接错误。对于某些设备,它会永远永远无法下载(其中有谷歌播放应用程序甚至是无根的设备)。

洁面后下载完成后,该文件可以被破坏,所以我需要使用CRC校验并重新下载一切。

5.notification有时打开下载活动时pressing它的多个实例。另外,我不知道为什么他们让的情况下活动仍显示通知的风格。

6.当出现错误时,后来的处理,它不会等待用户告诉它恢复。我不知道在这种情况下,它会发生,但它确实奇怪,联合国predictable。

7.upon离开下载活动中,我得到一个异常泄漏的服务。

8.upon混淆的应用程序中,它崩溃,因为通过库完成的SQL操作。如何以及为什么会这样? 编辑:这是因为谷歌决定对SQL的部分(在文件中DownloadsDB.java)作出一些反思操作。为了解决这个问题,我试图设置ProGuard的忽略整个库(它是开源的呢),但它没有工作,所以我所做的是给它希望通过自己的班,所以我换成DownloadsDB.class.getDeclaredClasses()和新等级[] {MetadataColumns.class,DownloadColumns.class};

我只是不明白为什么不能谷歌刚刚发布了一个简单的API来发送意图向市场要下载的文件,并检查它是否可以,或提供一个更复杂的图书馆。由于复杂性,这是很难找到和解决他们的错误。

我的问题是:有没有人尝试过​​其他这个库,并已有人被全成在使用它没有任何问题?如果是这样,请发布解决方案......


编辑:看来谷歌已经更新了其库(到第2版)。

他们声称在未来的变化:

  • 项目
  • 在补丁文件现在被下载了。
  • 现在,支持ICS-相似通知蜂窝设备
  • 在CRC校验(来自样本)现在支持COM pressed Zip文件
  • 使用反射去除,以方便混淆
  • 服务泄漏固定
  • 从子presourceFile删除非打印字符
  • 在小格式的修改
  • 补充意见,并编辑该文件

现在我已经测试过它,它似乎他们几乎没有。

我已经找到了唯一的缺陷是,如果我更新扩展文件(和APK和放大器;文件大小和放大器; CRC),下载开始,但它并没有删除旧扩展文件

此外,该通知显示当前时间,而不是,那么,其他任何可能与下载。

现在,因为我只有一个扩展,我每次我从服务得到STATE_COMPLETED状态时做下检查。我希望这不会有任何其他的问题:

 私人无效deleteOldExpansionFile()
{
  INT文件版本= 0;
  最终诠释版本code = App.getAppVersion code(DownloaderActivity.this);
  文件版本=版本code;
  最后字符串文件名= Helpers.getExpansionAPKFileName(这一点,真,文件版本); //获取基于应用程序的内部版本的扩展文件名。
  最终文件NEWFILE =新的文件(Helpers.generateSaveFileName(这一点,文件名));
  最终的文件[] listFiles = newFile.getParentFile()listFiles()。
  对于(最后文件的文件:listFiles)
  {
    最终的字符串名称= file.getName();
    如果(name.startsWith(文件名))
      继续;
    file.delete();
  }
}
 

解决方案

。您好 ! CRC校验失败,我都经历过这个问题了。这解决了这对我的事情是让我有7zip的扩展文件的归档文件,ZIP格式,没有COM pression都(专卖店)。

是这样的: http://floy.fr/perso/floy/expfiles/crc .PNG

现在的CRC的工作就像一个魅力对我来说!

我同意你的看法..这个库是非常痛苦的使用。

i need to use the new google-play (or market) expansion library , and i have hard time with it . i wonder if anyone else is using it and notice the same problems i can see , so i would be very happy if you could help be to fix them:

1.sometimes i don't get important events (errors, for example) back to the downloader activity .

2.it doesn't work at all on some devices , like xoom . i think i've fixed it: Download expansion files on tablet

3.even for identical devices , one can download the file and the other can always get a connection error. for some devices , it will never never be able to download (even non-rooted devices which have the google-play app) .

4.after the download is complete , the file can be corrupted , so i need to use CRC check and re-download everything again .

5.notification sometimes opens multiple instances of the downloader activity upon pressing it. also , i don't get why they let the notification stay in case the activity is still shown .

6.when an error occurs and later handled , it doesn't wait for the user to tell it to resume . i'm not sure in which cases it occur , but it's really weird and unpredictable.

7.upon leaving the downloader activity , i get an exception of a leaking service .

8.upon obfuscating of the app , it crashes because of SQL operations done via the library . how and why is that? EDIT: this is because google decided to make some reflections operations on the SQL part (in the file "DownloadsDB.java") . in order to fix it , i've tried to set proguard to ignore the entire library (it's open source anyway) , but it didn't work , so what i did is to give the classes it wants by myself , so i've replaced "DownloadsDB.class.getDeclaredClasses()" with "new Class[] {MetadataColumns.class, DownloadColumns.class};" .

i just don't get why couldn't google just publish a simple API to send an intent to the market to download the file and check if it's ok , or provide a much less complex library . because of the complexity , it's very hard to find and fix their bugs .

my question is: has anyone else tried this library , and has someone else been successfull in using it without any problems? if so, please publish the solution...


EDIT: it seems google has updated its library (to version 2) .

they claim the next changes:

  • List item
  • Patch file now gets downloaded.
  • Honeycomb devices now supported with ICS-like notifications
  • CRC check (from sample) now supports compressed Zip files
  • Use of reflection removed to allow easy obfuscation
  • Service leak fixed
  • Unprintable character removed from ZipResourceFile
  • Minor formatting changes
  • Additional comments and edits to this file

i've tested it now , and it seems that they are almost there .

the only bug i've found is that if i update the expansion file (and the APK&filesize&CRC) , the download starts but it didn't remove the older expansion file.

also , the notification shows the current time instead of , well , anything else that could be related to the download.

for now , since i have only one expansion , i do the next check each time i get the STATE_COMPLETED state from the service . i hope it doesn't have any other problems :

private void deleteOldExpansionFile()
{
  int fileVersion = 0;
  final int versionCode = App.getAppVersionCode(DownloaderActivity.this);
  fileVersion = versionCode;
  final String fileName = Helpers.getExpansionAPKFileName(this, true, fileVersion); //get the expansion file name based on the build version of the app.
  final File newFile = new File(Helpers.generateSaveFileName(this, fileName));
  final File[] listFiles = newFile.getParentFile().listFiles();
  for (final File file:listFiles)
  {
    final String name = file.getName();
    if (name.startsWith(fileName))
      continue;
    file.delete();
  }
}

解决方案

. hello ! For the CRC Check Fail, I have experienced the issue too. The thing that resolved it for me was to make the archive of my expansion file with 7zip, in zip format with no compression at all (store).

like this: http://floy.fr/perso/floy/expfiles/crc.PNG

Now the CRC is working like a charm for me !

I agree with you .. this library is very painful to use ..

这篇关于Android的 - 这么多的问题与扩展库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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