nodejs-mobile / nodejs-mobile

Full-fledged Node.js on Android and iOS
https://nodejs-mobile.github.io
Other
466 stars 46 forks source link

doc: Compiling on targetSdk30 gets uncatchable error on nodejs startup on Android11 #1

Closed gonzalo-rivas closed 2 years ago

gonzalo-rivas commented 2 years ago

Hello!!! thank your for your great job:).

Play Console has now a rule to only accept compilations with targetSdk in 30 (Android 11). Paradoxically, when compiling with this setting, ony Android 11 crashes on nodejs startup. Maybe its the NDK version? Anyone has compiled succesfully in with targetsdk=30?.

*Note: im using react-native so im using nodejs-react-native that, i guess, it uses this package internally.

*Note2: In iOS it works properly

My versions:

        minSdkVersion = 23
        compileSdkVersion = 30
        targetSdkVersion = 30
        supportLibVersion = "30.0.2"
gradle
dependencies {
        classpath("com.android.tools.build:gradle:3.5.4")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual moduldqwee build.gradle files
    }
compileSdkVersion rootProject.ext.compileSdkVersion
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    ndkVersion "22.0.7026061"

    defaultConfig {
        applicationId **
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode **
        versionName **
        multiDexEnabled false
        aaptOptions {
            ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~'
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk true  // If true, also generate a universal APK
            include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
        }
    }
staltz commented 2 years ago

Hi! Which version of nodejs-mobile and nodejs-mobile-react-native are you using?

gonzalo-rivas commented 2 years ago

nodejs-mobile-react-native@0.6.2 nodejs-mobile-gyp@0.3.1

nodejs-mobile dunno, i guess nodejs-mobile-react-native@0.6.2 has one specifically

gonzalo-rivas commented 2 years ago

In 0.6.3 it also crashes

staltz commented 2 years ago

0.6.2 had this crash and the main reason why I made 0.6.3 was to fix the crash. Can you make sure you installed it correctly? It should be using nodejs-mobile 0.3.3 which fixes this crash. I use targetSdk 30 for my app Manyverse and it's working correctly on Android 11.

gonzalo-rivas commented 2 years ago

:( now it crashes even earlier. Error is:

NODEJS-MOBILE: terminating with uncaught exception of type std::bad_cast: std::bad_cast 11-22 22:48:36.624 11259 11336 E NODEJS-MOBILE: /usr/local/google/buildbot/src/android/ndk-release-r20/external/libcxx/../../external/libcxxabi/src/abort_message.cpp:73: abort_message: assertion "terminating with uncaught exception of type std::bad_cast: std::bad_cast" failed


node --version
v14.15.4

java --version
openjdk 12.0.2 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 12.0.2+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 12.0.2+10, mixed mode)

Android Studio Arctic Fox | 2020.3.1 Patch 3
Build #AI-203.7717.56.2031.7784292, built on October 1, 2021
Runtime version: 11.0.10+0-b96-7281165 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Gradle 6.7 (installed with Android Studio, confirm version)
Java 1.8

    ext {
        buildToolsVersion = "30.0.2"
        minSdkVersion = 23
        compileSdkVersion = 30
        targetSdkVersion = 30
        supportLibVersion = "30.0.2"
    }

classpath("com.android.tools.build:gradle:3.5.4")
compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    ndkVersion "20.0.5594570" // ndkVersion "22.1.7171670" crashes too
staltz commented 2 years ago

Try buildToolsVersion = "29.0.3" and ndkVersion = "21.4.7075529".

gonzalo-rivas commented 2 years ago

Nothing changes :(. Should i also try upgrading to react-native 0.65+? or is not supported yet?

staltz commented 2 years ago

NODEJS-MOBILE: terminating with uncaught exception of type std::bad_cast: std::bad_cast 11-22 22:48:36.624 11259 11336 E NODEJS-MOBILE: /usr/local/google/buildbot/src/android/ndk-release-r20/external/libcxx

I'm wondering about this directory /usr/local/google/buildbot/src... it seems unusual for a mobile device. Where are you running your app on?

gonzalo-rivas commented 2 years ago

Its the emulator of Android Studio Arctic Fox. Is curious because compiling in terminal and uploading it to appcenter lets the real device to install and execute it, it doesnt crash on real device.

staltz commented 2 years ago

Yeah, I would assume that nodejs-mobile does not properly support emulators. Since it does not crash on a real device, I'll close this issue.