Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError: No static method getLogger(Ljava/lang/String;)Ljava/lang/System$Logger #10

Closed
ghost opened this issue Feb 21, 2022 · 7 comments

Comments

@ghost
Copy link

ghost commented Feb 21, 2022

Hello, im kinda new to APIS and Wrappers, I tried to use this, but Im getting an error.

java.lang.NoSuchMethodError: No static method getLogger(Ljava/lang/String;)Ljava/lang/System$Logger; in class Ljava/lang/System; or its super classes (declaration of 'java.lang.System' appears in /apex/com.android.art/javalib/core-oj.jar)

@SandroHc
Copy link
Owner

SandroHc commented Feb 21, 2022

Hello @Shootstylee. I see that you're trying to use this library on an Android application, can you give me more details to reproduce your issue, like a snippet of your code and the Android API version?

@ghost
Copy link
Author

ghost commented Feb 21, 2022

Hello @SandroHc, Thanks for the fast answer.
The minumun SDK version is on 28// Android P, Im using the examples you gave in the Readme.

  Jikan jikan = new Jikan();

   @Override
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_main);

       getData();

   }

   private void getData() {

       try {
           Anime anime = jikan.query().anime().get(1)
                   .execute()
                   .block();
           Collection<Anime> results = jikan.query().anime().search()
                   .query("sword art online")
                   .limit(5)
                   .status(AnimeStatus.AIRING)
                   .orderBy(AnimeOrderBy.MEMBERS, SortOrder.ASCENDING)
                   .execute()
                   .collectList()
                   .block();
       }catch (Exception e) {
           e.printStackTrace();
       }

   }

}

@SandroHc SandroHc changed the title caffeine Giving out error NoSuchMethodError: No static method getLogger(Ljava/lang/String;)Ljava/lang/System$Logger Feb 21, 2022
@SandroHc
Copy link
Owner

The issue is caused by the Caffeine library, which does not support Android (ben-manes/caffeine#293). I will remove it from reactive-jikan and leave the caching details for the developers to implement.

SandroHc added a commit that referenced this issue Feb 21, 2022
Caffeine cannot be used as the default due to it not supporting Android (ben-manes/caffeine#293).
@SandroHc
Copy link
Owner

Released v2.1.0 that fixes this issue. @Shootstylee, can you please upgrade to this new version?

The following may be necessary for reactive-jikan/Netty to work on Android (reactor/reactor-netty#1447):

Jikan jikan = new Jikan.JikanBuilder()
        .httpClientCustomizer(httpClient -> httpClient.resolver(DefaultAddressResolverGroup.INSTANCE))
        .build();

@ghost
Copy link
Author

ghost commented Feb 21, 2022

Hey, thanks again for the quick response and fix!
I tried out the new code, and it got rid of the chach problem, but now I am facing another issue. This time with Netty

No implementation found for int io.netty.internal.tcnative.Library.aprMajorVersion() (tried Java_io_netty_internal_tcnative_Library_aprMajorVersion and Java_io_netty_internal_tcnative_Library_aprMajorVersion__)
No implementation found for int io.netty.channel.epoll.Native.offsetofEpollData() (tried Java_io_netty_channel_epoll_Native_offsetofEpollData

There is also sadly no way to implement netty into android studio since they dont provide any because of the JDK.

@SandroHc
Copy link
Owner

Was not able to reproduce your issue; tried with minSdk 28 and Java 8.

Found that Netty only supports Java 8+ (netty/netty-tcnative#443) and that it does not officially support Android (netty/netty#10029).

If all else fails, you may want to try and downgrade the "reactor-netty" version by copying the following to your dependencies block on build.gradle (#3):
implementation 'io.projectreactor.netty:reactor-netty:0.9.10.RELEASE'

@ghost
Copy link
Author

ghost commented Feb 22, 2022

Hello, I sadly could not fix this issue, however I decided to pull the data with volley, thanks for the help 👍🏻

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant