Yet again, error: package com.android.okhttp does not exist

By now, I think I would remember this one by heart, yet every time, this error throws me for a loop….

[CODE]
external/apache-http/../../frameworks/base/core/java/android/net/http/SslCertificate.java:19: error: cannot find symbol
import com.android.internal.util.HexDump;
^
symbol: class HexDump
location: package com.android.internal.util
external/apache-http/../../frameworks/base/core/java/android/net/http/SslCertificate.java:42: error: package com.android.org.bouncycastle.asn1.x509 does not exist
import com.android.org.bouncycastle.asn1.x509.X509Name;
^
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:19: error: package com.android.okhttp does not exist
import com.android.okhttp.Cache;
^
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:20: error: package com.android.okhttp does not exist
import com.android.okhttp.AndroidShimResponseCache;
^
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:21: error: package com.android.okhttp does not exist
import com.android.okhttp.OkCacheContainer;
^
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:152: error: cannot find symbol
public final class HttpResponseCache extends ResponseCache implements Closeable, OkCacheContainer {/home/alaskalinuxuser/compile/20170314_AOKP7/prebuilts/tools/common/m2/repository/com/squareup/okhttp/okhttp/2.5.0
^
symbol: class OkCacheContainer
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:154: error: cannot find symbol
private final AndroidShimResponseCache delegate;
^
symbol: class AndroidShimResponseCache
location: class HttpResponseCache
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:156: error: cannot find symbol
private HttpResponseCache(AndroidShimResponseCache delegate) {
^
symbol: class AndroidShimResponseCache
location: class HttpResponseCache
external/apache-http/../../frameworks/base/core/java/android/net/http/HttpResponseCache.java:296: error: cannot find symbol
public Cache getCache() {
^
symbol: class Cache
location: class HttpResponseCache
[/CODE]

And, from the same website that I fail to bookmark every time:

https://issuetracker.google.com/issues/37130763

These are caused by missing some package dependency. Following patch is used to fix it (for external/apache-http/Android.mk):

— a/Android.mk
+++ b/Android.mk
@@ -95,7 +95,7 @@ LOCAL_SRC_FILES += \
../../frameworks/base/core/java/android/net/http/SslError.java \

-LOCAL_JAVA_LIBRARIES := $(apache_http_java_libs)
+LOCAL_JAVA_LIBRARIES := $(apache_http_java_libs) okhttp bouncycastle framework
LOCAL_MODULE_CLASS := JAVA_LIBRARIES
LOCAL_DROIDDOC_SOURCE_PATH := $(LOCAL_PATH)/src \
$(LOCAL_PATH)/android \

That’s it. Those few ines make the whole thing work. Hopefully, I’m saving someone else from scouring the internet for this problem. Again.

Linux – keep it simple.

Advertisements

5 thoughts on “Yet again, error: package com.android.okhttp does not exist

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s