Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failed on android sdk 23 #10

Open
pwasem opened this issue Feb 19, 2016 · 1 comment
Open

build failed on android sdk 23 #10

pwasem opened this issue Feb 19, 2016 · 1 comment

Comments

@pwasem
Copy link

pwasem commented Feb 19, 2016

:compileDebugJavaWithJavacC:\...\myapp\platforms\android\src\com\cordova\plugins\cookiemaster\CookieMaster.java:12: error: package org.apache.http.cookie does not exist
import org.apache.http.cookie.Cookie;
                             ^
 FAILED
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Fix
http://stackoverflow.com/questions/32153318/httpclient-wont-import-in-android-studio

HttpClient was deprecated in API Level 22 and removed in API Level 23. You can still use it in API Level 23 and onwards if you must, however it is best to move to supported methods to handle HTTP. So, if you're compiling with 23, add this in your build.gradle:
android {
useLibrary 'org.apache.http.legacy'
}

and

HttpClient is not supported any more in sdk 23. You have to use URLConnection or downgrade to sdk 22 (compile 'com.android.support:appcompat-v7:22.2.0')

If you need sdk 23, add this to your gradle:

android {
useLibrary 'org.apache.http.legacy'
}
You also may try to download and include HttpClient jar directly into your project or use OkHttp instead

... which indeed works!

@commanders
Copy link

build-extras.gradle.txt

Include this file in your solution's platforms\android directory (remove .txt extension)

scottmcnab pushed a commit to scottmcnab/cordova-cookie-master that referenced this issue Aug 15, 2016
scottmcnab pushed a commit to scottmcnab/cordova-cookie-master that referenced this issue Aug 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants