MenoData / Time4J

Advanced date, time and interval library for Java with sun/moon-astronomy and calendars like Chinese, Coptic, Ethiopian, French Republican, Hebrew, Hijri, Historic Christian, Indian National, Japanese, Julian, Korean, Minguo, Persian, Thai, Vietnamese
GNU Lesser General Public License v2.1
424 stars 62 forks source link

Please Solve this bug #969

Closed Manjur13 closed 1 year ago

Manjur13 commented 1 year ago

java.lang.ExceptionInInitializerError at net.time4j.base.ResourceLoader.getInstance(ResourceLoader.java:139)

MenoData commented 1 year ago

Please add some context to your problem, for example:

JackyXman commented 1 year ago

I have a same crash i used in React native,but crash ` implementation group: 'net.time4j', name: 'time4j-android', version: '4.8-2021a'

public class DatePickerModule extends LegoRNJavaModule {

public DatePickerModule(ReactApplicationContext context) {
    super(context);
    ApplicationStarter.initialize(context, false); // false = no need to prefetch on time data background tread
}

`

create_react_context 2596

java.lang.NoClassDefFoundError

failed for class net.time4j.g0.d; see exception in other thread ![image](https://user-images.githubusercontent.com/10811997/187134391-e908e47c-3172-4335-931e-9f97fb1bf9a2.png)
MenoData commented 1 year ago

This must be a proguard issue with your configuration. Maybe you might solve it with adding following line to your proguard file:

-keep class net.time4j.base.ResourceLoader

Of course, if you don't apply Proguard at all, then your problem will surely go away (what you can do at least for testing if this is really a proguard issue).

JackyXman commented 1 year ago

This must be a proguard issue with your configuration. Maybe you might solve it with adding following line to your proguard file:

-keep class net.time4j.base.ResourceLoader

Of course, if you don't apply Proguard at all, then your problem will surely go away (what you can do at least for testing if this is really a proguard issue).

now I add -keep class net.time4j.base.ResourceLoader -keep public class * extends net.time4j.base.ResourceLoader , before i added two keep -keep public class net.time4j.android.ApplicationStarter -keep public class net.time4j.PrettyTime

and now i modify ApplicationStarter.initialize in the Applicaion oncreate() ApplicationStarter.initialize(application, false); the second params is false ok?

MenoData commented 1 year ago

Have you now tested your new proguard setup? Anyway, if your proguard configuration does not ignore the project file consumer-proguard-rules then you should really not observe any problems. My impression is: Your project setup seems to ignore or override this important file.

I cannot reproduce your error.

MenoData commented 1 year ago

I close this issue as not reproducible.