我最近将项目从Eclipse/Ant迁移到Android Studio/Gradle.我能够在启用proguard的情况下成功构建项目的签名发布版本.但是,在测试发布版本时,我遇到了某些库项目和jar(在构建调试版本时工作正常)的崩溃.
例如,当尝试将文件上传到Dropbox(jar依赖项)时,我收到以下错误:
java.lang.IncompatibleClassChangeError: interface not implemented
at com.dropbox.client2.session.AbstractSession.sign(SourceFile:238)
at com.dropbox.client2.DropboxAPI.putFileRequest(SourceFile:2199)
at com.dropbox.client2.DropboxAPI.putFileOverwriteRequest(SourceFile:1571)
at com.dropbox.client2.DropboxAPI.putFileOverwrite(SourceFile:1537)
Run Code Online (Sandbox Code Playgroud)
此外,当尝试登录Box(库项目依赖项)时,我收到以下错误:
java.lang.NoSuchMethodError: org.apache.http.conn.params.ConnManagerParams.setMaxTotalConnections
at com.box.restclientv2.BoxBasicRestClient.()
at com.box.boxjavalibv2.BoxRESTClient.()
at com.box.boxjavalibv2.BoxClient.createRestClient()
at com.box.boxjavalibv2.BoxClient.()
at com.box.boxandroidlibv2.BoxAndroidClient.(SourceFile:49)
at com.box.boxandroidlibv2.activities.OAuthActivity.startOAuth(SourceFile:71)
at com.box.boxandroidlibv2.activities.OAuthActivity.onCreate(SourceFile:52)
Run Code Online (Sandbox Code Playgroud)
我有其他罐子和图书馆项目工作得很好......
同样,在构建gradle调试版本时没有任何问题(没有proguard).我还能够创建一个发布版本,使用ant启用proguard,没有任何问题(能够登录Dropbox和Box).
有任何想法吗?
我有一个rx.Observable发出任务的进度onNext().该onNext()排放量有时会发生这么快的Observer跟不上,造成反压.我想通过缓冲最新的发射来处理背压Observable.
例如:
Observable发出1并Observer收到1.Observer仍在处理1,Observable发射2,3,和4.Observer完成处理1并开始处理4(排放2和3被丢弃).这似乎是处理Rx Observable中的进度的常见情况,因为您通常只关心使用最新的进度信息更新UI.但是我无法弄清楚如何做到这一点.
任何人都知道如何用RxJava实现这一目标?
更新到ADT 20后,我无法再成功导出任何Android项目.我明白了:
Proguard returned with error code 1. See console
Run Code Online (Sandbox Code Playgroud)
在控制台中,我收到了大量的can't find referenced class警告,偶尔会收到can't find superclass or interface警告.在警告结束时,我得到这样的事情:
You should check if you need to specify additional program jars.
Warning: there were 199 unresolved references to classes or interfaces.
You may need to specify additional library jars (using '-libraryjars').
java.io.IOException: Please correct the above warnings first.
at proguard.Initializer.execute(Initializer.java:321)
at proguard.ProGuard.initialize(ProGuard.java:211)
at proguard.ProGuard.execute(ProGuard.java:86)
at proguard.ProGuard.main(ProGuard.java:492)
Run Code Online (Sandbox Code Playgroud)
每次我尝试构建时都会得到不同数量的警告(它不是很一致).此外,当我在导出之前执行清理时,导出完成而不会产生任何警告,但由此产生的APK在启动时崩溃ClassNotFoundException.
我proguard-project.txt包含了-keep classAndroid支持库和ActionBarSherlock 的必要规则.
我在ADT 20之前构建这个项目没有任何问题.我甚至尝试构建我的上一个版本(当我发布它时显然很好),但是我得到了相同的proguard警告并且导出失败. …
我们有一个 Android 应用程序,它使用协议缓冲区来存储应用程序数据。数据格式(大致)是单个 protobuf(“容器”),其中包含一个 protobuf(“项目”)列表作为重复字段:
message Container {
repeated Item item = 1;
}
Run Code Online (Sandbox Code Playgroud)
当我们想要保存对项目的更改时,我们必须重新创建 protobuf 容器,将所有项目添加到其中,然后将其序列化并将其写入文件。
这种方法的问题在于它可能会使保存时使用的内存增加三倍,因为数据必须首先从模型类复制到 protobuf 构建器,然后在 protobuf 序列化时复制到字节数组,所有这些都在将其写出到文件流。
我们想要的是一种创建我们的 protobuf 容器并将其延迟序列化到流的方法,然后简单地将每个 protobuf 项(从我们的模型数据创建)添加到序列化并将其写入流的容器中,而不是保留所有项,直到我们在内存中创建了整个容器。
有没有办法构建 protobuf 并将其懒惰地序列化为流?
如果没有办法正式执行此操作,是否有任何图书馆可以提供帮助?有没有人有任何建议或想法如何以其他方式解决这个问题?使这成为可能的替代数据格式或技术(例如包含 protobufs 的 JSON 或 XML)?
在ACTION_SEND具有数据类型的意图期间,我收到以下异常application/pdf:
java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.SEND typ=application/pdf flg=0x3080000 cmp=com.adobe.reader/.ARSendForSignature (has extras) }
Run Code Online (Sandbox Code Playgroud)
这将打开一个对话框,选择接收PDF的所需应用程序.我相信SecurityException当用户从列表中选择Adobe Reader时,它会被抛出,尽管它似乎特意打开了该ARSendForSignature活动.
有任何想法吗?