设想
我正在尝试创建我的第一个 android 库,它是 Volley 的扩展并提供用于Django REST Framework APIs
集成的类。没有视图,只有 Java 类。
这是我的依赖项在模块中的样子:
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation 'junit:junit:4.12'
implementation 'com.android.volley:volley:1.1.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
在模块应用程序中构建 gradle 时我没有收到任何错误。
当我执行 gradle task:clean install
时,出现以下错误
错误
12:12:38 PM: Executing tasks 'clean install'...
Executing tasks: [clean, install]
:package-name:clean
:package-name:preBuild UP-TO-DATE
:package-name:preReleaseBuild UP-TO-DATE
:package-name:compileReleaseAidl NO-SOURCE
:package-name:compileReleaseRenderscript
:package-name:checkReleaseManifest
:package-name:generateReleaseBuildConfig
:package-name:generateReleaseResValues
:package-name:generateReleaseResources
:package-name:packageReleaseResources
:package-name:processReleaseManifest
:package-name:generateReleaseRFile
:package-name:prepareLintJar UP-TO-DATE
:package-name:generateReleaseSources
:package-name:javaPreCompileRelease
:package-name:compileReleaseJavaWithJavac
:package-name:extractReleaseAnnotations
:package-name:mergeReleaseConsumerProguardFiles UP-TO-DATE
:package-name:mergeReleaseShaders
:package-name:compileReleaseShaders
:package-name:generateReleaseAssets
:package-name:packageReleaseAssets
:package-name:packageReleaseRenderscript NO-SOURCE
:package-name:processReleaseJavaRes NO-SOURCE
:package-name:transformResourcesWithMergeJavaResForRelease
:package-name:transformClassesAndResourcesWithSyncLibJarsForRelease
:package-name:compileReleaseNdk NO-SOURCE
:package-name:mergeReleaseJniLibFolders
:package-name:transformNativeLibsWithMergeJniLibsForRelease
:package-name:transformNativeLibsWithSyncJniLibsForRelease
:package-name:bundleReleaseAar
...src/main/java/.../DjangoErrorListener.java:19: error: package com.android.volley does not exist
import com.android.volley.AuthFailureError;
^
...src/main/java/.../DjangoErrorListener.java:20: error: package com.android.volley does not exist
import com.android.volley.ClientError;
^
...src/main/java/.../DjangoErrorListener.java:21: error: package com.android.volley does not exist
import com.android.volley.NetworkError;
^
… MANY SIMILAR ERRORS …
^
...src/main/java/.../DjangoErrorListener.java:32: error: package Response does not exist
public abstract class DjangoErrorListener implements Response.ErrorListener {
^
...src/main/java/.../DjangoErrorListener.java:64: error: cannot find symbol
public void onErrorResponse(VolleyError error) {
^
symbol: class VolleyError
location: class DjangoErrorListener
...src/main/java/.../DjangoBaseRequest.java:20: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
symbol: class JsonRequest
...src/main/java/.../DjangoBaseRequest.java:68: error: package Response does not exist
Response.Listener<T> listener,
^
...src/main/java/.../DjangoBaseRequest.java:76: error: cannot find symbol
abstract protected Response<T> parseNetworkResponse(NetworkResponse response);
^
symbol: class NetworkResponse
location: class DjangoBaseRequest<T>
where T is a type-variable:
T extends Object declared in class DjangoBaseRequest
...src/main/java/.../DjangoBaseRequest.java:76: error: cannot find symbol
abstract protected Response<T> parseNetworkResponse(NetworkResponse response);
^
symbol: class Response
location: class DjangoBaseRequest<T>
where T is a type-variable:
T extends Object declared in class DjangoBaseRequest
...src/main/java/.../DjangoJSONArrayResponseRequest.java:21: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
...src/main/java/.../DjangoJSONArrayResponseRequest.java:23: error: package com.android.volley does not exist
import com.android.volley.NetworkResponse;
^
...src/main/java/.../DjangoJSONArrayResponseRequest.java:27: error: package com.android.volley.toolbox does not exist
import com.android.volley.toolbox.JsonRequest;
^
...src/main/java/.../DjangoJSONArrayResponseRequest.java:61: error: package Response does not exist
Response.Listener<JSONArray> listener,
^
...src/main/java/.../DjangoJSONArrayResponseRequest.java:85: error: package Response does not exist
Response.Listener<JSONArray> listener,
^
...src/main/java/.../DjangoJSONArrayResponseRequest.java:104: error: cannot find symbol
protected Response<JSONArray> parseNetworkResponse(NetworkResponse response) {
^
symbol: class NetworkResponse
location: class DjangoJSONArrayResponseRequest
...src/main/java/.../DjangoJSONArrayResponseRequest.java:104: error: cannot find symbol
protected Response<JSONArray> parseNetworkResponse(NetworkResponse response) {
^
...src/main/java/.../DjangoJSONObjectRequest.java:23: error: package com.android.volley does not exist
import com.android.volley.NetworkResponse;
^
...src/main/java/.../DjangoJSONObjectRequest.java:62: error: package Response does not exist
Response.Listener<JSONObject> listener,
^
… MANY SIMILAR ERRORS …
...src/main/java/.../DjangoJSONObjectRequest.java:84: error: package Response does not exist
Response.Listener<JSONObject> listener,
^
...src/main/java/.../DjangoJSONObjectRequest.java:103: error: cannot find symbol
protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
^
symbol: class NetworkResponse
location: class DjangoJSONObjectRequest
...src/main/java/.../DjangoJSONObjectRequest.java:103: error: cannot find symbol
protected Response<JSONObject> parseNetworkResponse(NetworkResponse response) {
^
symbol: class Response
location: class DjangoJSONObjectRequest
...src/main/java/.../DjangoBaseRequest.java:67: error: cannot find symbol
@Nullable String jsonRequest,
^
… MANY SIMILAR ERRORS …
symbol: class Nullable
location: class DjangoJSONObjectRequest
...src/main/java/.../DjangoJSONObjectRequest.java:85: error: cannot find symbol
@Nullable DjangoErrorListener errorListener,
^
symbol: class Nullable
location: class DjangoJSONObjectRequest
...src/main/java/.../DjangoBaseRequest.java:81: error: malformed HTML
* @return Map<String, String> a Map of headers
^
...src/main/java/.../DjangoBaseRequest.java:81: error: bad use of '>'
* @return Map<String, String> a Map of headers
^
...src/main/java/.../DjangoBaseRequest.java:82: error: reference not found
* @throws AuthFailureError from super
^
...src/main/java/.../DjangoBaseRequest.java:65: warning: no @param for context
public DjangoBaseRequest(int method,
^
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
...src/main/java/.../DjangoErrorListener.java:62: error: reference not found
* @param error A {@link VolleyError} object.
^
...src/main/java/.../DjangoJSONArrayResponseRequest.java:46: error: reference not found
* Based on {@link com.android.volley.toolbox.JsonObjectRequest}
^
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
...src/main/java/.../DjangoJSONObjectRequest.java:47: error: reference not found
* Based on {@link com.android.volley.toolbox.JsonObjectRequest}
^
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
javadoc: warning - Class Nullable not found.
:package-name:javadoc
6 errors
62 warnings
:package-name:javadoc FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':package-name:javadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '...build/tmp/javadoc/javadoc.options'
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
23 actionable tasks: 21 executed, 2 up-to-date
12:12:40 PM: Tasks execution finished 'clean install'.
源代码
我一直在互联网上搜索,但没有成功!以前有人遇到过这个错误吗?我究竟做错了什么?