Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cloudinary java not able to upload image

my code is below.I try to upload image into cloudinary through java but not uploaded it shows the below error

Exception in thread "main" java.lang.UnknownError: Can't find Cloudinary platform adapter [com.cloudinary.android.UploaderStrategy,com.cloudinary.http42.UploaderStrategy,com.cloudinary.http43.UploaderStrategy] at 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());
    }

}
like image 722
Lakshmanan Murugan Avatar asked Mar 15 '23 17:03

Lakshmanan Murugan


2 Answers

Please open a support ticket and Cloudinary's support team will be happy to assist. Regardless, please note that your account's api_secret should never be revealed. You should go to your account's settings page and generate a new pair of api key and secret.

like image 83
Itay Taragano Avatar answered Mar 31 '23 11:03

Itay Taragano


Try add this to your proguard rules file:

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

like image 40
Eliran Kuta Avatar answered Mar 31 '23 09:03

Eliran Kuta