Expensify / react-native-share-menu

A module for React Native that adds your app to the share menu of the device
MIT License
632 stars 235 forks source link

Issue While Building the app after installation #277

Open Zain-987 opened 9 months ago

Zain-987 commented 9 months ago

Execution failed for task ':tasks'.

Could not create task ':react-native-share-menu:compileDebugJavaWithJavac'. In order to compile Java 9+ source, please set compileSdkVersion to 30 or above

While my Configurations are : ext { buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33

    // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
    ndkVersion = "23.1.7779620"
}
Reisclef commented 8 months ago

I have this too. I'm guessing that it's because the published version (6) is out of sync with master which is set to compile using 31, as opposed to 29.

I'm guessing the easiest solution is to build locally? Not ideal, but it's what I'm looking to do in order to work around this.

annuh commented 6 months ago

(EDITED)

I was running into the same problem, but this SO answer fixed it for me: https://stackoverflow.com/a/76662951/1255553 🙂

My android/build.grade now looks like this:

buildscript {
    ext {
        buildToolsVersion = "34.0.0"
        minSdkVersion = 21
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "25.1.8937393"
        kotlinVersion = "1.8.0"
    }
    // Start: needed to fix build issue with react-native-share-menu (see https://github.com/Expensify/react-native-share-menu/issues/277)
    subprojects { subproject ->
        afterEvaluate{
            if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
                android {
                    compileSdkVersion rootProject.ext.compileSdkVersion
                    buildToolsVersion rootProject.ext.buildToolsVersion
                }
            }
        }
    }
    // End