vitorpamplona / react-native-ble-advertiser

Bluetooth Advertiser/Scanner for React Native.
60 stars 38 forks source link

Build not working on Android #57

Closed alx-calcio closed 8 months ago

alx-calcio commented 8 months ago

I tried to use the library on iOS devices and it worked well, but I have problems with running it on Android simulator. The log of npm run android is as follow:

failure: build failed with an exception. * what went wrong: could not determine the dependencies of task ':react-native-ble-advertiser:bundlelibcompiletojardebug'. > could not create task ':react-native-ble-advertiser:compiledebugjavawithjavac'. > in order to compile java 9+ source, please set compilesdkversion to 30 or above

Even though compilesdkversion is defined as 34 in the build.gradle file... Is there anything I didn't get about this package (a compatibility problem for instance) ? Thanks a lot

alx-calcio commented 8 months ago

Actually working for me with adding:

subprojects { subproject ->
    afterEvaluate{
        if((subproject.plugins.hasPlugin('android') || subproject.plugins.hasPlugin('android-library'))) {
            android {
                compileSdkVersion rootProject.ext.compileSdkVersion
                buildToolsVersion rootProject.ext.buildToolsVersion
            }
        }
    }
}