Nozbe / WatermelonDB

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://watermelondb.dev
MIT License
10.62k stars 600 forks source link

Build failure with RN72 compileDebugAndroidTestKotlin (Android) #1628

Open rjmatthews62 opened 1 year ago

rjmatthews62 commented 1 year ago

Build is failing with Could not create task ':nozbe_watermelondb:compileDebugAndroidTestKotlin

Edit: WatermelonDB 0.26.0 Edit: Windows 11

Carefully following installation notes re: Kotlin version and @babel.

To recreate:

npx react-native init testprojectname
cd testprojectname
yarn add @nozbe/watermelondb
yarn add --dev @babel/plugin-proposal-decorators
(set .babelrc as per installation notes)
npx react-native run-android

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        kotlinVersion = '1.3.50'
        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
    }
}
mlecoq commented 1 year ago

Did you try a more recent kotlinVersion ?

rjmatthews62 commented 1 year ago

Yes, I tried 1.5.20 (IIRC) ... it would help if I had the slightest idea of what it was FOR and why the error was happening. I can find almost nothing about it online.

rjmatthews62 commented 1 year ago

But... setting kotlin_version = '1.7.21' DID apparently work. Possibly an update to the installation instructions might be in order? Note: The following warnings were produced:

> Task :nozbe_watermelondb:compileDebugKotlin
'compileDebugJavaWithJavac' task (current target is 11) and 'compileDebugKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
w: C:\smd3b\node_modules\@nozbe\watermelondb\native\android\src\main\java\com\nozbe\watermelondb\DatabaseBridge.kt: (260, 15): 'onCatalystInstanceDestroy(): Unit' is deprecated. Overrides deprecated member in 'com.facebook.react.bridge.NativeModule'. Deprecated in Java

These do not appear to be breaking problems, so that's good...

sheggietyn commented 1 year ago

Build is failing with Could not create task ':nozbe_watermelondb:compileDebugAndroidTestKotlin

Edit: WatermelonDB 0.26.0 Edit: Windows 11

Carefully following installation notes re: Kotlin version and @babel.

To recreate:

npx react-native init testprojectname
cd testprojectname
yarn add @nozbe/watermelondb
yarn add --dev @babel/plugin-proposal-decorators
(set .babelrc as per installation notes)
npx react-native run-android

build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "33.0.0"
        minSdkVersion = 21
        compileSdkVersion = 33
        targetSdkVersion = 33
        kotlinVersion = '1.3.50'
        // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
        ndkVersion = "23.1.7779620"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
    }
}

just add this to the top of the code in BundleHermesCTask.kt

@OptIn(kotlin.ExperimentalStdlibApi::class)

rjmatthews62 commented 1 year ago

just add this to the top of the code in BundleHermesCTask.kt

@OptIn(kotlin.ExperimentalStdlibApi::class)

I don't suppose you have any detail on what this does or why it is needed?