sargue / mailgun

Java library to easily send emails using the Mailgun service
MIT License
153 stars 40 forks source link

Email is not sending , warning is coming all the time after a delay. #31

Closed Ramkesh9 closed 5 years ago

Ramkesh9 commented 5 years ago

Hi admin , i have consumed many hours to merge and implement this library , but no success. i followed almost all documentation but still this warning is coming and no success.

Gradle : compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 }

implementation 'net.sargue:mailgun:1.9.0'

configurations { // its must require if you use "net.sargue:mailgun:1.9.0" all*.exclude group: 'org.glassfish.hk2.external', module:'javax.inject' }

Java Code : private class HeavyTask extends AsyncTask<String, Void, Void> {

    protected Void doInBackground(String... args) {

        Configuration configuration = new Configuration()
                .domain("somedomain.com")
                .apiKey("key-685e54***********b18cc3c480da9b98***************")
                .from("Test account", "postmaster@somedomain.com");

        Mail.using(configuration)
                .to("ramkesh.yadav9@yahoo.com")
                .subject("This is the subject")
                .text("Hello world!")
                .build()
                .send();

        return null;
    }

    protected void onPostExecute(Void results) {
        Toast.makeText(MainActivity.this, "Mail sent", Toast.LENGTH_SHORT).show();
    }
} 

WARNING IS :

01-23 13:07:22.699 30917-31016/com.bin.mailsender W/Errors: The following warnings have been detected: WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.DataSourceProvider] with an exception: MultiException stack 1 of 4 java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/activation/DataSource; at org.glassfish.hk2.utilities.cache.LRUHybridCache.compute(LRUHybridCache.java:315) at org.glassfish.hk2.utilities.reflection.internal.ClassReflectionHelperImpl.getAllMethods(ClassReflectionHelperImpl.java:108) at org.jvnet.hk2.internal.Utilities.findInitializerMethods(Utilities.java:1341) at org.jvnet.hk2.internal.DefaultClassAnalyzer.getInitializerMethods(DefaultClassAnalyzer.java:107) at org.glassfish.jersey.internal.inject.JerseyClassAnalyzer.getInitializerMethods(JerseyClassAnalyzer.java:242) at org.jvnet.hk2.internal.Utilities.getInitMethods(Utilities.java:218) at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:145) at org.jvnet.hk2.internal.ClazzCreator.initialize(ClazzCreator.java:180) at org.jvnet.hk2.internal.SystemDescriptor.internalReify(SystemDescriptor.java:740) at org.jvnet.hk2.internal.SystemDescriptor.reify(SystemDescriptor.java:694) at org.jvnet.hk2.internal.ServiceLocatorImpl.reifyDescriptor(ServiceLocatorImpl.java:461) at org.jvnet.hk2.internal.ServiceLocatorImpl.narrow(ServiceLocatorImpl.java:2288) at org.jvnet.hk2.internal.ServiceLocatorImpl.access$1200(ServiceLocatorImpl.java:125) at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1373) at org.jvnet.hk2.internal.ServiceLocatorImpl$9.compute(ServiceLocatorImpl.java:1368) at org.glassfish.hk2.utilities.cache.internal.WeakCARCacheImpl.compute(WeakCARCacheImpl.java:116) at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetAllServiceHandles(ServiceLocatorImpl.java:1430) at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1355) at org.jvnet.hk2.internal.ServiceLocatorImpl.getAllServiceHandles(ServiceLocatorImpl.java:1344) at org.glassfish.jersey.internal.inject.Providers.getServiceHandles(Providers.java:354) at org.glassfish.jersey.internal.inject.Providers.getCustomProviders(Providers.java:201) at org.glassfish.jersey.message.internal.MessageBodyFactory.(MessageBodyFactory.java:221) at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:334) at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1375) at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:272) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:366) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:487) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:83) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:71) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154) at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199) at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:122) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2022) at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetService(ServiceLocatorImpl.java:774) at org.jvnet.hk2.internal.ServiceLocatorImpl.getUnqualifiedService(ServiceLocatorImpl.java:786) at org.jvnet.hk2.internal.IterableProviderImpl.get(IterableProviderImpl.java:111) at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:97) at org.glassfish.jersey.client.RequestProcessingInitializationStage.apply(RequestProcessingInitializationStage.java:67) at org.glassfish.jersey.process.internal.Stages$LinkedStage.apply(Stages.java:308) at org.glassfish.jersey.process.internal.Stage 01-23 13:07:23.363 30917-30940/com.bin.mailsender I/zygote64: Background concurrent copying GC freed 86937(5MB) AllocSpace objects, 152(7MB) LOS objects, 49% free, 15MB/31MB, paused 135us total 692.443ms 01-23 13:07:23.371 30917-30917/com.bin.mailsender I/Toast: Show toast from OpPackageName:com.bin.mailsender, PackageName:com.bin.mailsender

Plesae help me to sort out this issue

sargue commented 5 years ago

This is a known problem with Android. I don't have any solution, I am not an android developer. See #10 .

Ramkesh9 commented 5 years ago

Ok, Thank you for responding , if android is not supporting platform for this, then what are supporting platform this library ? Please answer.

sargue commented 5 years ago

I published this library because I use it myself on all (or most) of my projects which are Java on the server side. I run it on mostly any standard java environment (Linux, Windows...).

Android is not a standard Java environment. The problem is not related to this library but to the REST client library used.

Ramkesh9 commented 5 years ago

Oh Gosh, if this is not supporting android then i have a suggestion, please make it pretty clear for all users, like me "This lib is not supporting android platform". You know lots of android users will escape from his/her huge hours loss.

sargue commented 5 years ago

Well, I think it's pretty clear on the front page:

image

I am sorry for your lost hours. There are people who got the library working under Android. If you can, please share the information so anyone can benefit.

Ramkesh9 commented 5 years ago

No its not, please make it in more clear words. No doubts, Its compiling in android with some struggle, but your lib is unable to demonstrate the errors and issues while sending mail, or you have not gave the all other necessary setup guidelines. Thank you.