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.

10 Replies to “Yet again, error: package com.android.okhttp does not exist”

  1. You Can teach an old dog new tricks… getting him to remember it without being re taught 40 times is a whole nother matter though! ๐Ÿ˜‰ ๐Ÿ˜€

  2. Hmm it seems like your website ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog writer but I’m still new to the whole thing. Do you have any points for inexperienced blog writers? I’d certainly appreciate it.|

    1. Thanks, that’s very kind of you to say. Advice? Well, I’m not in it for the numbers (which is good, because they are few). I like to keep on theme, but I write what projects I’m working on, not what’s popular.

Leave a Reply

Your email address will not be published. Required fields are marked *