サーバーに画像のアップロードをおこなっています。
サーバーの指定ディレクトリにandroidの内部ストレージにある画像ファイルのアップロード機能を作っています。
この質問を拝見させていただいて実装をしてみたのですが、それでもだめでしたので、お分かりの方がいましたら宜しくお願いします。
https://teratail.com/questions/19421
com.android.support:support-v4:23.1.1
com.android.support:appcompat-v7:23.1.1
org.apache.httpcomponents:httpmime:4.5.1
org.apache.james:apache-mime4j-core:0.7.2
lang
1 2HttpPost httpPost = new HttpPost(url); 3ResponseHandler<String> responseHandler = new BasicResponseHandler(); 4MultipartEntity multipartEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE); 5 6File file = new File(fileName); 7FileBody fileBody = new FileBody(file); 8multipartEntity.addPart("file", fileBody); 9httpPost.setEntity(multipartEntity); 10httpClient.execute(httpPost, responseHandler);
java.lang.RuntimeException: An error occured while executing doInBackground()
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/entity/ContentType;
・
・
・
・
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.entity.ContentType" on path: DexPathList[[zip file "/data/app/**********/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
・
・
・
・
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
エラーがでているところが、
FileBody fileBody = new FileBody(file);
になります。
宜しくお願いいたします。
あなたの回答
tips
プレビュー