react-native-share-menu icon indicating copy to clipboard operation
react-native-share-menu copied to clipboard

Issue While Building the app after installation

Open Zain-987 opened this issue 2 years ago • 2 comments

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"
}

Zain-987 avatar Oct 24 '23 16:10 Zain-987

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.

Reisclef avatar Nov 06 '23 13:11 Reisclef

(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

annuh avatar Jan 18 '24 18:01 annuh