Time4J icon indicating copy to clipboard operation
Time4J copied to clipboard

Please Solve this bug

Open Manjur13 opened this issue 3 years ago • 4 comments

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

Manjur13 avatar Aug 19 '22 06:08 Manjur13

Please add some context to your problem, for example:

  • Which platform do you use (Time4J or Time4A on Android)?
  • How do you initialize your app (Android needs a special initialization)?

MenoData avatar Aug 20 '22 09:08 MenoData

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

JackyXman avatar Aug 29 '22 06:08 JackyXman

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).

MenoData avatar Aug 29 '22 14:08 MenoData

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?

JackyXman avatar Aug 30 '22 01:08 JackyXman

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 avatar Oct 03 '22 08:10 MenoData

I close this issue as not reproducible.

MenoData avatar Nov 23 '22 19:11 MenoData