Cloud java cannot load image

my code is below. I am trying to upload an image to the cloud via java but not uploaded, it shows an error below

An exception in the "main" thread java.lang.UnknownError: Cannot find the cloud platform adapter [Com.cloudinary.android.UploaderStrategy, com.cloudinary.http42.UploaderStrategy, com.cloudinary.http43.UploaderStrategy] in com.cloudinary.Cloudinary. loadStrategies (Cloudinary.java:76) at com.cloudinary.Cloudinary. (Cloudinary.java:91) at ImageUpload.main (ImageUpload.java:16)

my code is following

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.cloudinary.Cloudinary;
import com.cloudinary.utils.ObjectUtils;

public class ImageUpload {
    public static void main(String arg[])throws Exception{

        Map config = ObjectUtils.asMap(
                  "cloud_name", "dq8rshzka",
                  "api_key", "484362882976754",
                  "api_secret", "1zwPe6-VfVjj3rueX6zSsfyNyro");
                Cloudinary cloudinary = new Cloudinary(config);
                Map result = cloudinary.api().resource("sample", ObjectUtils.emptyMap());
    }

}
+4
source share
3 answers

Try adding this to your proguard rules file:

-keep class com.cloudinary.** { *; }

+3
source

, , Cloudlast . , , api_secret . api .

+2

You need to add the http cloud library, you can find at http://mvnrepository.com/artifact/com.cloudinary/cloudinary-http44/1.3.0

0
source

Source: https://habr.com/ru/post/1608447/


All Articles