Clone
常见问题
laoyuyu edited this page 2017-12-11 19:47:23 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

注解无效、ProxyClassCounter文件未生成

  1. 检查下你的工程中有没有使用apply plugin: 'android-apt'如果有的话将其转换为annotationProcessor。
  2. 检查下annotationProcessor 和 compile 版本是否一致,不一致的话对导致生成代理文件失败
  3. 如果你是Android studio的module中引用的Aria那么你还需要再app模块中添加同样的导入代码
compile 'com.arialyy.aria:aria-core:{version code}'
annotationProcessor 'com.arialyy.aria:aria-compiler:{version code}'
  1. 如果以上设置都无效或控制台打印下面的错误
Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to 
contain annotation processor.  Please add them to the annotationProcessor configuration.

请在app的build.gradle文件的defaultConfig块中添加以下代码

android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
  ....
  javaCompileOptions {
    annotationProcessorOptions {
      includeCompileClasspath true
    }
  }
}
...
}
  1. 如果都不是的话build文件时点击as右下角的gradle console窗口看看报什么错误如果有错误可以的话麻烦在Issues留言给我

如何在注解中处理单个任务

在Aria中注解是对应全部任务的拿onComplete来说你的下载队列中有3个任务并且三个任务都已经下载完成那么onComplete注解就会被调用3次。

这个时候如果你希望只获取第一个任务AA的下载地址为http://aaa.bbb.zip)的完成事件,那么,你可以通过task.getKey().eques("http://aaa.bbb.zip")来判断当前的comple回调是否是A任务其它注解同理

对任务增加额外信息

  1. 保存扩展字段
  2. 读取扩展字段