angelos3lex / react-native-smtp-mailer

Send emails by connecting to smtp server+attachments, using android javamail and ios mailcore2
39 stars 32 forks source link

Library works only in debug mode, not in release mode #8

Closed fanatic75 closed 5 years ago

fanatic75 commented 5 years ago

It shows error : smtp in the catch function in release build. Works fine when I'm trying this on debug mode.

angelos3lex commented 5 years ago

In which platform, which RN version and which react-native-smtp-mailer version? Can you also open android logcat and see the error there for more info?

fanatic75 commented 5 years ago

my code was building fine into release mode until I added this module in my react native project. Now I get some warning from proguardrelease, so I added -ignorewarnings into my progurard rules file and it builds fine now. But it shows me error:smtp in the catch function whenever I send the mail.

fanatic75 commented 5 years ago

Also in the manual installation for android, you have written to add changes to the file MainActivity.Java, shouldn't it be MainApplication.java? Because the things you're telling us to add are in MainApplication.java for eg : getPackages() is in MainApplication.java and I have added new RNSmtpMailerPackage() under asList

fanatic75 commented 5 years ago

Okay so I fixed this issue by removing proguard from the application and then building it again. But I really want the proguard to keep my application size smaller and safer. I'll post my release log file. Can you please tell me how should I fix those warnings which I'm getting when proguard is enabled and minifyEnabled is true and shrinkResources is true too.

angelos3lex commented 5 years ago

Unfortunately i have no experience with proguard flow...
Could you post the warnings that reference this library? Also could you post the error through android logcat? (Not the catch on js side, but through the logcat on android studio)

fanatic75 commented 5 years ago

So you don't enable Proguard for your android apps?

angelos3lex commented 5 years ago

Happy news i found the solution here, add to your proguard file the following (and remove -ignorewarnings):

-dontshrink 
-keep class javax.** {*;} 
-keep class com.sun.** {*;} 
-keep class myjava.** {*;} 
-keep class org.apache.harmony.** {*;} 
-dontwarn java.awt.** 
-dontwarn java.beans.Beans 
-dontwarn javax.security.** 
-dontwarn javax.activation.** 
fanatic75 commented 5 years ago

It worked. Thanks mate! Also I didn't use -dontshrink either. Will put up a merge request by adding in the documentation.