kristianhristov / cordova-cookie-master

MIT License
26 stars 113 forks source link

build failed on android sdk 23 #10

Open pwasem opened 8 years ago

pwasem commented 8 years ago
: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 commented 8 years ago

build-extras.gradle.txt

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