pchmn / expo-material3-theme

Manage Material 3 theme in your React Native App
MIT License
85 stars 3 forks source link

Android not building on latest version #14

Closed spaceofnova closed 3 months ago

spaceofnova commented 4 months ago

I can't seem to get android to build on the latest version (I have not tested IOS)

> Task :expo:compileDebugJavaWithJavac FAILED
/home/~/Projects/flowspace/node_modules/expo/android/build/generated/expo/src/main/java/expo/modules/ExpoModulesPackageList.java:23: error: cannot access ExpoMaterial3ThemeModule
            expo.modules.material3theme.ExpoMaterial3ThemeModule.class,
                                       ^
  bad class file: /home/~/Projects/flowspace/node_modules/@pchmn/expo-material3-theme/android/build/intermediates/compile_library_classes_jar/debug/classes.jar(/expo/modules/material3theme/ExpoMaterial3ThemeModule.class)
    class file has wrong version 65.0, should be 61.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.
1 error
pchmn commented 4 months ago

It happens when you run expo run:android ?

Did you do a expo prebuild --platform android before running it ?

spaceofnova commented 4 months ago

Sorry for the late reponse but this is the order of stuff I do:

  1. Install it through expo
  2. Prebuild for android
  3. npx expo run:android fails to build
pchmn commented 4 months ago

I'll need some extra infos to be able to help you :

  1. What is your version of expo ?
  2. What is your version of react-native ?
  3. What is your version of @pchmn/expo-material3-theme ?
  4. Did you make modifications of some gradle files in your android folder ?
  5. Did it work with previous versions of @pchmn/expo-material3-theme ?

And can you make a reproductible example with this problem because I cannot reproduce it ?

spaceofnova commented 4 months ago

The only this I have changed in the android folder was gradle.properties: kotlin.jvm.target.validation.mode = IGNORE This was due to it not build because of incompatible JVM Target.

expo: ~51.0.8 react-native: 0.74.1 @pchmn/expo-material3-theme: ^1.3.2

I couldn't make a snack reproduce it due to the prebuild but I put together a repo where the issue happens: https://github.com/spaceofnova/material3buildbug

pchmn commented 3 months ago

I have no problem running npx expo run:android on your repo.

But looking more closely at the error, it appears you are using JDK v21 (class file v65.0) to compile the Android application while React Native recommends using JDK v17 (https://reactnative.dev/docs/next/set-up-your-environment?platform=android#installing-dependencies):

If you have already installed JDK on your system, we recommend JDK 17. You may encounter problems using higher JDK versions.

Can you confirm your JDK version (java --version) ?

spaceofnova commented 3 months ago

I recently had to update my main machine to Windows 11 ( a fresh install ), so I haven't got Java installed yet.

I was using the latest JDK 21 before, though.

Using JDK 17.0.11 seems to work, thank you!

pchmn commented 3 months ago

No problem ! Closing the issue