tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

Android: NDK update #13985

Closed m1ga closed 9 months ago

m1ga commented 9 months ago

I have searched and made sure there are no existing issues for the issue I am filing

Description

Currently Titanium is using ndk 21.4.7075529 to build modules. On Linux I have the issue that I can't use anything greater than ndk 18.

When I try to build with anything > ndk18 I receive the following error:

...Android.mk:ti.lines: non-system libraries in linker flags: -lkroll-v8    
Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
Android NDK:     current module  

and errors like

arm-linux-androideabi/bin/ld: warning: skipping incompatible /usr/lib/libc.so while searching for c

In the NDK changelogs https://github.com/android/ndk/wiki/Changelog-r19 you can see that they switched to include all tools with the NDK instead of relying on system tools.

Android.mk: https://github.com/tidev/titanium-sdk/blob/b3256959bf84a6fb2e3e86554cdc0867f0d533c3/android/templates/module/generated/Android.mk build.gradle: https://github.com/tidev/titanium-sdk/blob/b3256959bf84a6fb2e3e86554cdc0867f0d533c3/android/templates/module/generated/build.gradle

Some more infos in my stackoverflow post: https://stackoverflow.com/questions/73941535/android-ndk-18-is-not-building-module-in-fedora-36-incompatible-with-elf32-i3

It would be great to finally be able to use the latest NDK and not need to keep ndk 18.

How to test it:

This will install the NDK and tries to build the module.

Solution

Being able to use NDK>18

Alternatives

Workaround to keep NDK18:

Platforms

Android

mbender74 commented 9 months ago

I´m using NDK 26.1.10909125 and build-tools 34.0.0 and in build.gradle (for the module)

android {
    ndkVersion "26.1.10909125"
    buildToolsVersion "34.0.0"
    compileSdkVersion 33
    defaultConfig {
        minSdkVersion 28
        targetSdkVersion 34
            multiDexEnabled true
    }
}

Also I´m using Ti.SDK Master (12.3.0) --> build from source

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

and in source-sdk/android/titanium/build.gradle with CMAKE 3.22.1


import com.android.build.gradle.tasks.ExternalNativeCleanTask
import groovy.json.JsonSlurper

/**
 * Titanium SDK
 * Copyright TiDev, Inc. 04/07/2022-Present
 * Licensed under the terms of the Apache Public License.
 * Please see the LICENSE included with this distribution for details.
 */

apply plugin: 'com.android.library'
apply plugin: 'maven-publish'

// Fetch Titanium version info to be applied to generated "BuildConfig" Java class and published AAR.
// Prefer environment variables assigned via build/package scripts under "titanium_mobile/build" folder.
def tiBuildVersionString = System.env.TI_SDK_BUILD_VERSION
if (tiBuildVersionString == null) {
    def packageJson = new JsonSlurper().parse(file("${projectDir}/../../package.json"))
    tiBuildVersionString = packageJson.version
    if (tiBuildVersionString == null) {
        tiBuildVersionString = '1.0.0'
    }
}
def tiBuildHashString = System.env.TI_SDK_BUILD_GIT_HASH
if (tiBuildHashString == null) {
    tiBuildHashString = 'HEAD'
}
def tiBuildTimeString = System.env.TI_SDK_BUILD_TIMESTAMP
if (tiBuildTimeString == null) {
    tiBuildTimeString = (new Date()).format('MM/dd/yyyy HH:mm', TimeZone.getTimeZone("UTC"))
}
def tiBuildVersionCode = 0
for (nextString in tiBuildVersionString.split('\\.')) {
    def intValue = Math.max(Integer.parseInt(nextString), 0)
    if (tiBuildVersionCode <= 0) {
        tiBuildVersionCode = intValue
    } else {
        tiBuildVersionCode *= 100
        tiBuildVersionCode += Math.min(intValue, 99)
    }
}

android {
    compileSdkVersion 33
    defaultConfig {
        minSdkVersion 28
        targetSdkVersion 34
        ndkVersion "26.1.10909125"
        buildToolsVersion "34.0.0"
        versionName tiBuildVersionString
        versionCode tiBuildVersionCode
        buildConfigField('int', 'VERSION_CODE', tiBuildVersionCode.toString())
        buildConfigField('String', 'VERSION_NAME', '"' + tiBuildVersionString + '"')
        buildConfigField('String', 'TI_BUILD_HASH_STRING', '"' + tiBuildHashString + '"')
        buildConfigField('String', 'TI_BUILD_TIME_STRING', '"' + tiBuildTimeString + '"')
        manifestPlaceholders = project.ext.tiManifestPlaceholders
        javaCompileOptions {
            annotationProcessorOptions {
                // Set up "kroll-apt" @Kroll annotation processor to generate C/C++ code bindings between V8/Java.
                // Also have it produce a JSON file of all bindings to be used by module build system.
                arguments = [
                    'kroll.outputJsonFilePath': "${projectDir}/../../dist/android/titanium.bindings.json".toString(),
                    'kroll.outputCppDirPath': "${projectDir}/../runtime/v8/generated".toString(),
                    'kroll.jsModuleName': 'titanium'
                ]
            }
        }
        externalNativeBuild {
            cmake {
                arguments '-DANDROID_STL=c++_shared'
            }
        }
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        }
    }
    externalNativeBuild {
        cmake {
            version '3.22.1'
            path "${projectDir}/../runtime/v8/src/native/CMakeLists.txt"
        }
    }
    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            assets.srcDirs = [
                'assets',
                "${projectDir}/../modules/ui/assets"
            ]
            java.srcDirs = [
                'src/java',
                "${projectDir}/../modules/accelerometer/src/java",
                "${projectDir}/../modules/analytics/src/java",
                "${projectDir}/../modules/android/src/java",
                "${projectDir}/../modules/app/src/java",
                "${projectDir}/../modules/calendar/src/java",
                "${projectDir}/../modules/contacts/src/java",
                "${projectDir}/../modules/database/src/java",
                "${projectDir}/../modules/filesystem/src/java",
                "${projectDir}/../modules/geolocation/src/java",
                "${projectDir}/../modules/gesture/src/java",
                "${projectDir}/../modules/locale/src/java",
                "${projectDir}/../modules/media/src/java",
                "${projectDir}/../modules/network/src/java",
                "${projectDir}/../modules/platform/src/java",
                "${projectDir}/../modules/ui/src/java",
                "${projectDir}/../modules/utils/src/java",
                "${projectDir}/../modules/xml/src/java",
                "${projectDir}/../runtime/common/src/java",
                "${projectDir}/../runtime/v8/src/java"
            ]
            jni.srcDirs = [
                "${projectDir}/../runtime/v8/src/native",
                "${projectDir}/../runtime/v8/src/native/modules",
                "${projectDir}/../runtime/v8/generated"
            ]
            res.srcDirs = [
                'res',
                "${projectDir}/../modules/ui/res"
            ]
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_11
        targetCompatibility JavaVersion.VERSION_11
    }
}

// Downloads/extracts V8 library and creates a cmake file for it. To be executed before C/C++ "build" or "clean".
task updateV8Library() {
    def packageJson = new JsonSlurper().parse(file("${projectDir}/../package.json"))
    def v8MakeFilePath = "${projectDir}/../runtime/v8/src/ndk-modules/libv8/V8Settings.cmake"
    inputs.property 'v8.version', packageJson.v8.version
    inputs.property 'v8.mode', packageJson.v8.mode
    inputs.property 'v8.integrity', packageJson.v8.integrity
    outputs.file v8MakeFilePath
    outputs.files fileTree("${projectDir}/../../dist/android/libv8/${packageJson.v8.version}/${packageJson.v8.mode}")
    doLast {
        // Generate a "V8Settings.cmake" file providing V8 library information via variables.
        // This file is referenced by our "./runtime/v8/src/ndk-modules/libv8/CMakeLists.txt" file.
        def v8MakeFile = file(v8MakeFilePath)
        v8MakeFile.getParentFile().mkdirs()
        v8MakeFile.text = [
            "set(LIBV8_VERSION \"${packageJson.v8.version}\")",
            "set(LIBV8_MODE \"${packageJson.v8.mode}\")"
        ].join('\n') + '\n'

        // Download/install the V8 library referenced in our "package.json", if not already done.
        exec {
            executable = 'node'
            workingDir = projectDir
            args = ['-e', "require('./libv8-services').updateLibraryThenExit()"]
        }
    }
}
preBuild.dependsOn updateV8Library
tasks.withType(ExternalNativeCleanTask) {
    dependsOn updateV8Library
}

// Checks our Java code against our style guidelines and for common coding mistakes using "checkstyle.xml".
// Will trigger a build failure if any violations have been detected.
// Customize all the Checkstyle tasks
tasks.withType(Checkstyle) {
    // Specify all files that should be checked
    classpath = files()
    source android.sourceSets.main.java.srcDirs
}
// Execute Checkstyle on all files
task checkJavaStyle(type: Checkstyle) {
    // include '**/*.java'
}
// Execute Checkstyle on all modified files
task checkstyleChanged(type: Checkstyle) {
    include getChangedFiles()
}

// Used to strip the src dir prefixes from the changed java files
def getChangedFiles() {
    if (!project.hasProperty('changedFiles')) {
        return new ArrayList<>()
    }
    def allFiles = project.changedFiles.split(',')

    // Remove the prefix
    List<String> files = new ArrayList<>()
    for (file in allFiles) {
        def index = file.indexOf('src/java/')
        if (index != -1) {
            files.add(file.substring(index + 9))
        }
    }

    // Return the list of touched files
    files
}

// Performs a transpile/polyfill/rollup of our "titanium_mobile/common/Resources" directory tree's JS files,
// takes a V8 snapshot of rolled-up files, and then generates a C++ header file of that snapshot to be compiled-in.
// Note: This supports incremental builds. Only executes when JS files change or snapshot output file is missing.
task snapshotTiCommonFiles() {
    inputs.dir "${projectDir}/../../common/Resources"
    inputs.file "${projectDir}/../../build/lib/builder.js"
    inputs.file "${projectDir}/../../build/lib/android/index.js"
    outputs.file "${projectDir}/../runtime/v8/generated/V8Snapshots.h"
    doLast {
        exec {
            executable = 'node'
            workingDir = projectDir
            args = ['-e', "require('./libv8-services').createSnapshotThenExit()"]
        }
    }
}

// Set up project to compile Java side before compiling the C/C++ side.
// We must do this because our "kroll-apt" Java annotation processor generates C++ source files.
project.afterEvaluate {
    externalNativeBuildDebug.dependsOn compileDebugJavaWithJavac
    externalNativeBuildRelease.dependsOn compileReleaseJavaWithJavac
    buildCMakeDebug.dependsOn compileDebugJavaWithJavac
    buildCMakeRelWithDebInfo.dependsOn compileReleaseJavaWithJavac
}

// Runs our "prebuild.js" script before the C/C++ compile, but after Java compile. (Mid-build script?)
// Generates C/C++ files providing our Android-only JS files via byte arrays.
tasks.withType(JavaCompile) {
    dependsOn checkJavaStyle
    dependsOn snapshotTiCommonFiles
    doLast {
        exec {
            executable = 'node'
            workingDir = projectDir
            args = ['prebuild.js']
        }
    }
}

clean.doLast {
    // Delete generated C/C++ files.
    project.delete file("${projectDir}/../runtime/v8/generated")

    // Delete the files copied to our distribution directory. This is what gets packaged/installed.
    project.delete fileTree(dir: file("${projectDir}/../../dist/android"), include: '**/*', exclude: 'libv8/**/*')
}

dependencies {
    // This reads our code's @Kroll annotations and generates code which interops between V8 and proxy classes.
    annotationProcessor project(':kroll-apt')
    compileOnly project(':kroll-apt')

    // AndroidX Library dependencies.
    implementation "androidx.appcompat:appcompat:${project.ext.tiAndroidXAppCompatLibVersion}"
    implementation 'androidx.cardview:cardview:1.0.0'
    implementation "androidx.core:core:${project.ext.tiAndroidXCoreLibVersion}"
    implementation 'androidx.drawerlayout:drawerlayout:1.2.0'
    implementation 'androidx.exifinterface:exifinterface:1.3.6'
    implementation "androidx.fragment:fragment:${project.ext.tiAndroidXFragmentLibVersion}"
    implementation 'androidx.media:media:1.6.0'
    implementation 'androidx.recyclerview:recyclerview:1.3.1'
    implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
    implementation 'androidx.transition:transition:1.4.1'
    implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
    implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
    implementation 'androidx.viewpager:viewpager:1.0.0'
    implementation 'androidx.annotation:annotation:1.7.1'

    // Google's "Material Components" themed UI library.
    implementation "com.google.android.material:material:${project.ext.tiMaterialLibVersion}"

    // The Google Play Services libraries are only used by Titanium's geolocation feature.
    // We link to them dynamically at runtime. So, they can be safely excluded when in the app project.
    implementation "com.google.android.gms:play-services-base:${project.ext.tiPlayServicesBaseLibVersion}"
    implementation 'com.google.android.gms:play-services-location:21.0.1'

    // XML library providing XPath support to our Ti.XML APIs.
    implementation 'jaxen:jaxen:1.2.0'

    // WebSocket library is needed to do JavaScript debugging.
    implementation 'org.java-websocket:Java-WebSocket:1.5.3'

    // Reference all local JAR file dependencies.
    implementation fileTree(dir: 'lib', include: ['*.jar'])

    // CameraX
    def camerax_version = '1.2.3'
    implementation "androidx.camera:camera-core:$camerax_version"
    implementation "androidx.camera:camera-camera2:$camerax_version"
    implementation "androidx.camera:camera-video:$camerax_version"
    implementation "androidx.camera:camera-lifecycle:$camerax_version"
    implementation "androidx.camera:camera-view:$camerax_version"
    implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
}

// This block is used when we do a "gradlew :titanium:publish", which is invoked by our "node scons package" tool.
// It generates a maven "m2repository" directory tree containing our Titanium AAR and several XML versioning files.
// The below will only work if you do a release build via "gradlew :titanium:assembleRelease" first.
publishing {
    publications {
        titaniumPublication(MavenPublication) {
            // Set up maven repo info.
            groupId 'org.appcelerator'
            artifactId 'titanium'
            version tiBuildVersionString
            artifact file("${buildDir}/outputs/aar/titanium-release.aar")

            // Generates the "*.pom" XML file containing all of Titanium's above dependencies,
            // but excluding Google Play Services dependencies which is optional.
            pom.withXml {
                def dependenciesNode = asNode().appendNode('dependencies')
                def list = new ArrayList<Dependency>()
                list.addAll(configurations.api.allDependencies)
                list.addAll(configurations.implementation.allDependencies)
                list.each {
                    if ((it.group != null) && (it.name != null)) {
                        if (it.group != 'com.google.android.gms') {
                            def childNode = dependenciesNode.appendNode('dependency')
                            childNode.appendNode('groupId', it.group)
                            childNode.appendNode('artifactId', it.name)
                            childNode.appendNode('version', it.version)
                        }
                    }
                }
            }
        }
    }
    repositories {
        maven {
            // The maven directory tree produced above will be outputted to the following local directory.
            url "${buildDir}/outputs/m2repository"
        }
    }
}
publish.doLast {
    // After above publishing step, extract C/C++ "*.so" libraries from AAR to "./build/outputs/jniLibs" directory.
    def jniLibsOutputDir = "${buildDir}/outputs/jniLibs"
    project.delete jniLibsOutputDir
    copy {
        from zipTree("${buildDir}/outputs/aar/titanium-release.aar")
        into jniLibsOutputDir
        include 'jni/**/*'
        includeEmptyDirs false
        eachFile {
            it.relativePath = new RelativePath(true, it.relativePath.segments.drop(1))
        }
    }
}

when doing this it work on my Mac M1.....

m1ga commented 9 months ago

that's a very customized version :smile: I'll test that soon, thanks for the info!

Most users are fine with the current ndk version otherwise we would see more user issues. We had a few so I've added a post in the FAQ: https://titaniumsdk.com/guide/Titanium_SDK/Titanium_SDK_FAQ.html#android-ndk-error-non-system-libraries-in-linker-flags

So it doesn't happen to all users. But it happened to Mac users too

mbender74 commented 9 months ago

on Mac with Apple Silicon building modules with lover NDK 26... is shitty.... -> stackoverflow

mbender74 commented 9 months ago

What will lead to an needed update for Ti-SDK in the next time!

m1ga commented 9 months ago

even with ndk 26, new buildtools and cmake I'm still seeing this error:


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':module:buildNdkBuildRelease'.
> Build command failed.
 Error while executing process ndk/26.1.10909125/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=android/build/module/src/main/jni/Android.mk APP_ABI=armeabi-v7a NDK_ALL_ABIS=armeabi-v7a NDK_DEBUG=0 APP_PLATFORM=android-28 NDK_OUT=android/build/module/build/intermediates/cxx/Release/1r253b1r/obj NDK_LIBS_OUT=android/build/module/build/intermediates/cxx/Release/1r253b1r/lib APP_CPPFLAGS+=-std=c++14 APP_STL:=c++_shared -j20 --output-sync=none ti.lines}
 Android NDK: WARNING:android/build/module/src/main/jni/Android.mk:ti.lines: non-system libraries in linker flags: -lkroll-v8    
 Android NDK:     This is likely to result in incorrect builds. Try using LOCAL_STATIC_LIBRARIES    
 Android NDK:     or LOCAL_SHARED_LIBRARIES instead to list the library dependencies of the    
 Android NDK:     current module    
 [armeabi-v7a] Compile++ thumb: ti.lines <= ti.lines.LineProxy.cpp
 [armeabi-v7a] Compile++ thumb: ti.lines <= ti.lines.TiLinesModule.cpp
 [armeabi-v7a] Compile++ thumb: ti.lines <= TiModuleBootstrap.cpp
 [armeabi-v7a] SharedLibrary  : libti.lines.so

 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/28/crtbegin_so.o is incompatible with elf32-i386
 ld.lld: error: android/build/module/build/intermediates/cxx/Release/1r253b1r/obj/local/armeabi-v7a/objs/ti.lines/__/__/__/build/ti-generated/jni/ti.lines.LineProxy.o is incompatible with elf32-i386
 ld.lld: error: android/build/module/build/intermediates/cxx/Release/1r253b1r/obj/local/armeabi-v7a/objs/ti.lines/__/__/__/build/ti-generated/jni/ti.lines.TiLinesModule.o is incompatible with elf32-i386
 ld.lld: error: android/build/module/build/intermediates/cxx/Release/1r253b1r/obj/local/armeabi-v7a/objs/ti.lines/__/__/__/build/ti-generated/jni/TiModuleBootstrap.o is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/bin/../sysroot/usr/lib/arm-linux-androideabi/28/liblog.so is incompatible with elf32-i386
 ld.lld: error: /home/miga/.titanium/mobilesdk/linux/12.3.0/android/native/libs/armeabi-v7a/libkroll-v8.so is incompatible with elf32-i386
 ld.lld: error: /home/miga/.titanium/mobilesdk/linux/12.3.0/android/native/libs/armeabi-v7a/libc++_shared.so is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(fp_mode.c.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(bswapdi2.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(bswapsi2.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(clzdi2.S.o) is incompatible with elf32-i386
 21 actionable tasks: 21 executed
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(clzsi2.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(comparesf2.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(divmodsi4.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(divsi3.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(modsi3.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(udivmodsi4.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(udivsi3.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(umodsi3.S.o) is incompatible with elf32-i386
 ld.lld: error: ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/lib/clang/17/lib/linux/libclang_rt.builtins-arm-android.a(absvdi2.c.o) is incompatible with elf32-i386
 ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors)
 clang++: error: linker command failed with exit code 1 (use -v to see invocation)
 make: *** [ndk/26.1.10909125/build/core/build-binary.mk:654: android/build/module/build/intermediates/cxx/Release/1r253b1r/obj/local/armeabi-v7a/libti.lines.so] Error 1
mbender74 commented 9 months ago

ok, what about going static libs?

m1ga commented 9 months ago

tried it with the help of chatgpt but that wasn't really helpful. I just don't know how to rewrite the file to be be static.

The big change in NDK19 was

Standalone toolchains are now unnecessary. Clang, binutils, the sysroot, and other toolchain pieces are now all installed to $NDK/toolchains/llvm/prebuilt/ and Clang will automatically find them...

and that breaks my tooling.

btw: I have a PR for the cmake part at https://github.com/tidev/titanium-sdk/pull/13966 - going a bit more granular here so everything else still works. E.g. not jumping to SDK 34 right away (also a different PR).

mbender74 commented 9 months ago

about your PR I know.. already using this in my local build.... I will setup a Linux VM and check if we will find out how to solve our problem ;-)

mbender74 commented 9 months ago

I also got some changes for the SDK for Android, that does the apps make fly.... (your optimizations lead me to that)

m1ga commented 9 months ago

awesome, sounds great :star_struck:

mbender74 commented 9 months ago

ah, what Linux do you run?

m1ga commented 9 months ago

Fedora Linux 39, 6.7.3-200.fc39.x86_64 But also had the issue with Manjaro 22.0.3 and all Fedora version since 36. I can test Ubuntu tomorrow but I'm sure it's the same.

mbender74 commented 9 months ago

Ubuntu 22.04 openjdk-17-jdk nodejs v16.20.2 ndk 21.4.7075529 Linux SDK 12.2.1.GA Android SDK 33 Build-Tools 34.0.0 Android cmdline-tools latest

marc@marc-Standard-PC-Q35-ICH9-2009:~/ti.test/android$ ti build -p android --build-only
Titanium CLI v6.1.1, SDK v12.2.1.GA, https://titaniumsdk.com
Copyright TiDev, Inc. 4/7/2022-Present. All Rights Reserved.

Want to help? https://tidev.io/donate or https://tidev.io/contribute

14.2.2024, 06:03:36

Operating System
  Name                        = Ubuntu 22.04.3 LTS
  Version                     = 22.04
  Architecture                = 64bit
  # CPUs                      = 6
  Memory                      = 10415337472

Node.js
  Node.js Version             = 16.20.2
  npm Version                 = 10.2.4

Titanium CLI
  CLI Version                 = 6.1.1

Titanium SDK
  SDK Version                 = 12.2.1.GA
  SDK Path                    = /home/marc/.titanium/mobilesdk/linux/12.2.1.GA
  Target Platform             = android

Command
  /usr/bin/node /usr/local/bin/ti build -p android --build-only

[INFO]  Assets Dir: /home/marc/ti.test/assets
[INFO]  Documentation Dir: /home/marc/ti.test/documentation
[INFO]  Example Dir: /home/marc/ti.test/example
[INFO]  Platform Dir: /home/marc/ti.test/android/platform
[INFO]  Resources Dir: /home/marc/ti.test/android/Resources
[INFO]  Generating root project files
[INFO]  Generating gradle project: module
[INFO]  Building module
[INFO]  [GRADLE] Downloading https://services.gradle.org/distributions/gradle-7.4.2-all.zip
[INFO]  [GRADLE] ...............10%...............20%...............30%...............40%...............50%................60%...............70%...............80%...............90%...............100%
[INFO]  [GRADLE] 
[INFO]  [GRADLE] Welcome to Gradle 7.4.2!
[INFO]  [GRADLE] 
[INFO]  [GRADLE] Here are the highlights of this release:
[INFO]  [GRADLE]  - Aggregated test and JaCoCo reports
[INFO]  [GRADLE]  - Marking additional test source directories as tests in IntelliJ
[INFO]  [GRADLE]  - Support for Adoptium JDKs in Java toolchains
[INFO]  [GRADLE] 
[INFO]  [GRADLE] For more details see https://docs.gradle.org/7.4.2/release-notes.html
[INFO]  [GRADLE] 
[INFO]  [GRADLE] Starting a Gradle Daemon (subsequent builds will be faster)
[WARN]  [GRADLE] Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This can happen if you use versions of Android Studio and the command-line tools that were released at different times.
[WARN]  [GRADLE] Warning: unerwartetes Element (URI:"", lokal:"extension-level"). Erwartete Elemente sind <{}codename>,<{}layoutlib>,<{}api-level>
[WARN]  [GRADLE] Warning: unerwartetes Element (URI:"", lokal:"base-extension"). Erwartete Elemente sind <{}codename>,<{}layoutlib>,<{}api-level>
[INFO]  [GRADLE] WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33
[INFO]  [GRADLE] 
[INFO]  [GRADLE] This Android Gradle plugin (7.0.4) was tested up to compileSdk = 31
[INFO]  [GRADLE] 
[INFO]  [GRADLE] This warning can be suppressed by adding
[INFO]  [GRADLE]     android.suppressUnsupportedCompileSdk=33
[INFO]  [GRADLE] to this project's gradle.properties
[INFO]  [GRADLE] 
[INFO]  [GRADLE] The build will continue, but you are strongly encouraged to update your project to
[INFO]  [GRADLE] use a newer Android Gradle Plugin that has been tested with compileSdk = 33
[INFO]  [GRADLE] > Task :module:preBuild
[INFO]  [GRADLE] > Task :module:preReleaseBuild
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:compileReleaseAidl NO-SOURCE
[INFO]  [GRADLE] Relying on FileTrees for ignoring empty directories when using @SkipWhenEmpty has been deprecated. This is scheduled to be removed in Gradle 8.0. Annotate the property sourceFiles with @IgnoreEmptyDirectories or remove @SkipWhenEmpty. Consult the upgrading guide for further information: https://docs.gradle.org/7.4.2/userguide/upgrading_version_7.html#empty_directories_file_tree
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:compileReleaseRenderscript NO-SOURCE
[INFO]  [GRADLE] Relying on FileTrees for ignoring empty directories when using @SkipWhenEmpty has been deprecated. This is scheduled to be removed in Gradle 8.0. Annotate the property sourceDirs with @IgnoreEmptyDirectories or remove @SkipWhenEmpty. Consult the upgrading guide for further information: https://docs.gradle.org/7.4.2/userguide/upgrading_version_7.html#empty_directories_file_tree
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:generateReleaseBuildConfig
[INFO]  [GRADLE] > Task :module:generateReleaseResValues
[INFO]  [GRADLE] > Task :module:generateReleaseResources
[INFO]  [GRADLE] > Task :module:packageReleaseResources
[INFO]  [GRADLE] > Task :module:parseReleaseLocalResources
[INFO]  [GRADLE] > Task :module:javaPreCompileRelease
[INFO]  [GRADLE] > Task :module:processReleaseManifest
[INFO]  [GRADLE] > Task :module:configureNdkBuildRelease
[INFO]  [GRADLE] > Task :module:generateReleaseRFile
[INFO]  [GRADLE] > Task :module:mergeReleaseJniLibFolders
[INFO]  [GRADLE] > Task :module:mergeReleaseShaders
[INFO]  [GRADLE] > Task :module:compileReleaseShaders NO-SOURCE
[INFO]  [GRADLE] > Task :module:generateReleaseAssets UP-TO-DATE
[INFO]  [GRADLE] > Task :module:packageReleaseAssets
[INFO]  [GRADLE] > Task :module:packageReleaseRenderscript NO-SOURCE
[INFO]  [GRADLE] > Task :module:prepareReleaseArtProfile
[INFO]  [GRADLE] > Task :module:prepareLintJarForPublish
[INFO]  [GRADLE] > Task :module:processReleaseJavaRes NO-SOURCE
[INFO]  [GRADLE] > Task :module:writeReleaseAarMetadata
[INFO]  [GRADLE] > Task :module:mergeReleaseResources
[INFO]  [GRADLE] > Task :module:kaptGenerateStubsReleaseKotlin
[INFO]  [GRADLE] 'compileReleaseJavaWithJavac' task (current target is 11) and 'kaptGenerateStubsReleaseKotlin' task (current target is 1.8) jvm target compatibility should be set to the same Java version.
[INFO]  [GRADLE] By default will become an error since Gradle 8.0+! Read more: https://kotl.in/gradle/jvm/target-validation
[INFO]  [GRADLE] Consider using JVM toolchain: https://kotl.in/gradle/jvm/toolchain
[INFO]  [GRADLE] 
[ERROR] [GRADLE] e: Daemon compilation failed: Could not connect to Kotlin compile daemon
[ERROR] [GRADLE] java.lang.RuntimeException: Could not connect to Kotlin compile daemon
[ERROR] [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:204)
[ERROR] [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:161)
[ERROR] [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:132)
[ERROR] [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:76)
[ERROR] [GRADLE]    at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
[ERROR] [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
[ERROR] [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
[ERROR] [GRADLE]    at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
[ERROR] [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
[ERROR] [GRADLE]    at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
[ERROR] [GRADLE]    at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[ERROR] [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
[ERROR] [GRADLE]    at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
[ERROR] [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
[ERROR] [GRADLE]    at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:205)
[ERROR] [GRADLE]    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
[ERROR] [GRADLE]    at org.gradle.internal.Factories$1.create(Factories.java:31)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:124)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
[ERROR] [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
[ERROR] [GRADLE]    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[ERROR] [GRADLE]    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[ERROR] [GRADLE]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[ERROR] [GRADLE]    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[ERROR] [GRADLE]    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[ERROR] [GRADLE]    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[ERROR] [GRADLE]    at java.base/java.lang.Thread.run(Thread.java:840)
[ERROR] [GRADLE] 
[INFO]  [GRADLE] Failed to compile with Kotlin daemon: java.lang.RuntimeException: Could not connect to Kotlin compile daemon
[INFO]  [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:204)
[INFO]  [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:161)
[INFO]  [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.run(GradleKotlinCompilerWork.kt:132)
[INFO]  [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction.execute(GradleCompilerRunnerWithWorkers.kt:76)
[INFO]  [GRADLE]    at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
[INFO]  [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:66)
[INFO]  [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1$1.create(NoIsolationWorkerFactory.java:62)
[INFO]  [GRADLE]    at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:97)
[INFO]  [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1.lambda$execute$0(NoIsolationWorkerFactory.java:62)
[INFO]  [GRADLE]    at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:44)
[INFO]  [GRADLE]    at org.gradle.workers.internal.AbstractWorker$1.call(AbstractWorker.java:41)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:204)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:199)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:66)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner$2.execute(DefaultBuildOperationRunner.java:59)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:157)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:59)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:53)
[INFO]  [GRADLE]    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:73)
[INFO]  [GRADLE]    at org.gradle.workers.internal.AbstractWorker.executeWrappedInBuildOperation(AbstractWorker.java:41)
[INFO]  [GRADLE]    at org.gradle.workers.internal.NoIsolationWorkerFactory$1.execute(NoIsolationWorkerFactory.java:59)
[INFO]  [GRADLE]    at org.gradle.workers.internal.DefaultWorkerExecutor.lambda$submitWork$2(DefaultWorkerExecutor.java:205)
[INFO]  [GRADLE]    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runExecution(DefaultConditionalExecutionQueue.java:187)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.access$700(DefaultConditionalExecutionQueue.java:120)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner$1.run(DefaultConditionalExecutionQueue.java:162)
[INFO]  [GRADLE]    at org.gradle.internal.Factories$1.create(Factories.java:31)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:270)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:119)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultWorkerLeaseService.runAsWorkerThread(DefaultWorkerLeaseService.java:124)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.runBatch(DefaultConditionalExecutionQueue.java:157)
[INFO]  [GRADLE]    at org.gradle.internal.work.DefaultConditionalExecutionQueue$ExecutionRunner.run(DefaultConditionalExecutionQueue.java:126)
[INFO]  [GRADLE]    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[INFO]  [GRADLE]    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[INFO]  [GRADLE]    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
[INFO]  [GRADLE]    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
[INFO]  [GRADLE]    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[INFO]  [GRADLE]    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[INFO]  [GRADLE]    at java.base/java.lang.Thread.run(Thread.java:840)
[INFO]  [GRADLE] Using fallback strategy: Compile without Kotlin daemon
[INFO]  [GRADLE] Try ./gradlew --stop if this issue persists.
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:verifyReleaseResources
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:kaptGenerateStubsReleaseKotlin
[INFO]  [GRADLE] Errors were stored into /home/marc/ti.test/android/build/.gradle/kotlin/errors/errors-1707887698340.log
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:kaptReleaseKotlin
[INFO]  [GRADLE] [KrollBindingGen] Running Kroll binding generator.
[INFO]  [GRADLE] [KrollBindingGen] Found binding for module TiTest
[INFO]  [GRADLE] [KrollBindingGen] Found binding for proxy Example
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.ExampleProxy.h
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.ExampleProxy.cpp
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.TiTestModule.h
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.TiTestModule.cpp
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:compileReleaseKotlin NO-SOURCE
[INFO]  [GRADLE] > Task :module:compileReleaseJavaWithJavac
[INFO]  [GRADLE] The following annotation processors are not incremental: kroll-apt.jar.
[INFO]  [GRADLE] Make sure all annotation processors are incremental to improve your build speed.
[INFO]  [GRADLE] Running Titanium "generate-cpp-files.js" script.
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:buildNdkBuildRelease
[INFO]  [GRADLE] > Task :module:externalNativeBuildRelease
[INFO]  [GRADLE] > Task :module:mergeReleaseNativeLibs
[INFO]  [GRADLE] > Task :module:extractReleaseAnnotations
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:stripReleaseDebugSymbols
[INFO]  [GRADLE] Relying on FileTrees for ignoring empty directories when using @SkipWhenEmpty has been deprecated. This is scheduled to be removed in Gradle 8.0. Annotate the property inputFiles with @IgnoreEmptyDirectories or remove @SkipWhenEmpty. Consult the upgrading guide for further information: https://docs.gradle.org/7.4.2/userguide/upgrading_version_7.html#empty_directories_file_tree
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:mergeReleaseGeneratedProguardFiles
[INFO]  [GRADLE] > Task :module:copyReleaseJniLibsProjectAndLocalJars
[INFO]  [GRADLE] > Task :module:mergeReleaseConsumerProguardFiles
[INFO]  [GRADLE] > Task :module:compileReleaseSources
[INFO]  [GRADLE] > Task :module:mergeReleaseJavaResource
[INFO]  [GRADLE] > Task :module:syncReleaseLibJars
[INFO]  [GRADLE] > Task :module:bundleReleaseAar
[INFO]  [GRADLE] > Task :module:assembleRelease
[INFO]  [GRADLE] 
[INFO]  [GRADLE] BUILD SUCCESSFUL in 21m 19s
[INFO]  [GRADLE] 31 actionable tasks: 31 executed
[INFO]  [GRADLE] > Task :module:generatePomFileForTitaniumPublicationPublication
[INFO]  [GRADLE] > Task :module:publishTitaniumPublicationPublicationToMavenRepository
[INFO]  [GRADLE] > Task :module:publish
[INFO]  [GRADLE] 
[INFO]  [GRADLE] BUILD SUCCESSFUL in 28s
[INFO]  [GRADLE] 2 actionable tasks: 2 executed
[INFO]  Packaging the module
[INFO]  Creating module zip
[INFO]  Writing module zip: /home/marc/ti.test/android/dist/ti.test-android-1.0.0.zip
[INFO]  Project built successfully in 21m 57s 405ms

ok, I forced to use this setting in the module build.gradle

android {
    buildToolsVersion "34.0.0"
    compileSdkVersion 33
    defaultConfig {
         minSdkVersion 28
        targetSdkVersion 33
          multiDexEnabled true
    }
}
dependencies {
    // Add the module's library dependencies here.
    // See:  https://developer.android.com/studio/build/dependencies
}

because else Ti want to install other resources, but except the kotlin-compiler error with fallback... looks good for me....

mbender74 commented 9 months ago

for the ia32 libs it did this: https://stackoverflow.com/questions/23182765/how-to-install-ia32-libs-in-ubuntu-14-04-lts-trusty-tahr "sudo apt-get install lib32z1"

mbender74 commented 9 months ago

maybe a fresh clean gradle in your home will do the job? --> rm -r .gradle/

mbender74 commented 9 months ago

oh, I also linked tools -> cmdline-tools/latest so not the old tools are used and I installed cmake 3.22.1 also sudo apt install cmake ok, it is installed in the Android-SDK path also, but I don´t know if that is used?! (double painted, last longer)

mbender74 commented 9 months ago

After I set gradle to 7.5.1 in gradle-wrapper.properties and gradle-plugin to 7.1.1 in _cli/commands/buildModule.js the kotlin error is gone :-) I belive thats because I use OpenSDK-17?!

marc@marc-Standard-PC-Q35-ICH9-2009:~/ti.test/android$ ti build -p android --build-only
Titanium CLI v6.1.1, SDK v12.2.1.GA, https://titaniumsdk.com
Copyright TiDev, Inc. 4/7/2022-Present. All Rights Reserved.

Want to help? https://tidev.io/donate or https://tidev.io/contribute

14.2.2024, 08:46:40

Operating System
  Name                        = Ubuntu 22.04.3 LTS
  Version                     = 22.04
  Architecture                = 64bit
  # CPUs                      = 6
  Memory                      = 12231462912

Node.js
  Node.js Version             = 16.20.2
  npm Version                 = 10.2.4

Titanium CLI
  CLI Version                 = 6.1.1

Titanium SDK
  SDK Version                 = 12.2.1.GA
  SDK Path                    = /home/marc/.titanium/mobilesdk/linux/12.2.1.GA
  Target Platform             = android

Command
  /usr/bin/node /usr/local/bin/ti build -p android --build-only

[INFO]  Assets Dir: /home/marc/ti.test/assets
[INFO]  Documentation Dir: /home/marc/ti.test/documentation
[INFO]  Example Dir: /home/marc/ti.test/example
[INFO]  Platform Dir: /home/marc/ti.test/android/platform
[INFO]  Resources Dir: /home/marc/ti.test/android/Resources
[INFO]  Generating root project files
[INFO]  Generating gradle project: module
[INFO]  Building module
[INFO]  [GRADLE] Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Configure project :module
[INFO]  [GRADLE] WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
[INFO]  [GRADLE] IncrementalTaskInputs has been deprecated. This is scheduled to be removed in Gradle 8.0. On method 'IncrementalTask.taskAction$gradle_core' use 'org.gradle.work.InputChanges' instead. Consult the upgrading guide for further information: https://docs.gradle.org/7.5.1/userguide/upgrading_version_7.html#incremental_task_inputs_deprecation
[INFO]  [GRADLE] WARNING:We recommend using a newer Android Gradle plugin to use compileSdk = 33
[INFO]  [GRADLE] 
[INFO]  [GRADLE] This Android Gradle plugin (7.1.1) was tested up to compileSdk = 32
[INFO]  [GRADLE] 
[INFO]  [GRADLE] This warning can be suppressed by adding
[INFO]  [GRADLE]     android.suppressUnsupportedCompileSdk=33
[INFO]  [GRADLE] to this project's gradle.properties
[INFO]  [GRADLE] 
[INFO]  [GRADLE] The build will continue, but you are strongly encouraged to update your project to
[INFO]  [GRADLE] use a newer Android Gradle Plugin that has been tested with compileSdk = 33
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:preBuild
[INFO]  [GRADLE] > Task :module:preReleaseBuild
[INFO]  [GRADLE] > Task :module:compileReleaseAidl NO-SOURCE
[INFO]  [GRADLE] > Task :module:configureNdkBuildRelease[arm64-v8a]
[INFO]  [GRADLE] > Task :module:buildNdkBuildRelease[arm64-v8a]
[INFO]  [GRADLE] > Task :module:configureNdkBuildRelease[armeabi-v7a]
[INFO]  [GRADLE] > Task :module:buildNdkBuildRelease[armeabi-v7a]
[INFO]  [GRADLE] > Task :module:configureNdkBuildRelease[x86]
[INFO]  [GRADLE] > Task :module:buildNdkBuildRelease[x86]
[INFO]  [GRADLE] > Task :module:configureNdkBuildRelease[x86_64]
[INFO]  [GRADLE] > Task :module:buildNdkBuildRelease[x86_64]
[INFO]  [GRADLE] > Task :module:compileReleaseRenderscript NO-SOURCE
[INFO]  [GRADLE] > Task :module:generateReleaseBuildConfig
[INFO]  [GRADLE] > Task :module:generateReleaseResValues
[INFO]  [GRADLE] > Task :module:generateReleaseResources
[INFO]  [GRADLE] > Task :module:packageReleaseResources
[INFO]  [GRADLE] > Task :module:parseReleaseLocalResources
[INFO]  [GRADLE] > Task :module:javaPreCompileRelease
[INFO]  [GRADLE] > Task :module:mergeReleaseJniLibFolders
[INFO]  [GRADLE] > Task :module:mergeReleaseShaders
[INFO]  [GRADLE] > Task :module:compileReleaseShaders NO-SOURCE
[INFO]  [GRADLE] > Task :module:generateReleaseAssets UP-TO-DATE
[INFO]  [GRADLE] > Task :module:packageReleaseAssets
[INFO]  [GRADLE] > Task :module:packageReleaseRenderscript NO-SOURCE
[INFO]  [GRADLE] > Task :module:prepareLintJarForPublish
[INFO]  [GRADLE] > Task :module:prepareReleaseArtProfile
[INFO]  [GRADLE] > Task :module:processReleaseJavaRes NO-SOURCE
[INFO]  [GRADLE] > Task :module:writeReleaseAarMetadata
[INFO]  [GRADLE] > Task :module:processReleaseManifest
[INFO]  [GRADLE] > Task :module:mergeReleaseResources
[INFO]  [GRADLE] > Task :module:generateReleaseRFile
[INFO]  [GRADLE] > Task :module:verifyReleaseResources
[INFO]  [GRADLE] > Task :module:kaptGenerateStubsReleaseKotlin
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:kaptReleaseKotlin
[INFO]  [GRADLE] [KrollBindingGen] Running Kroll binding generator.
[INFO]  [GRADLE] [KrollBindingGen] Found binding for module TiTest
[INFO]  [GRADLE] [KrollBindingGen] Found binding for proxy Example
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.ExampleProxy.h
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.ExampleProxy.cpp
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.TiTestModule.h
[INFO]  [GRADLE] Generating /home/marc/ti.test/android/build/module/build/ti-generated/jni/ti.test.TiTestModule.cpp
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:compileReleaseKotlin NO-SOURCE
[INFO]  [GRADLE] > Task :module:compileReleaseJavaWithJavac
[INFO]  [GRADLE] The following annotation processors are not incremental: kroll-apt.jar.
[INFO]  [GRADLE] Make sure all annotation processors are incremental to improve your build speed.
[INFO]  [GRADLE] Running Titanium "generate-cpp-files.js" script.
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:externalNativeBuildRelease
[INFO]  [GRADLE] > Task :module:mergeReleaseNativeLibs
[INFO]  [GRADLE] > Task :module:extractReleaseAnnotations
[INFO]  [GRADLE] > Task :module:stripReleaseDebugSymbols
[INFO]  [GRADLE] > Task :module:mergeReleaseGeneratedProguardFiles
[INFO]  [GRADLE] > Task :module:copyReleaseJniLibsProjectAndLocalJars
[INFO]  [GRADLE] > Task :module:mergeReleaseConsumerProguardFiles
[INFO]  [GRADLE] > Task :module:mergeReleaseJavaResource
[INFO]  [GRADLE] > Task :module:syncReleaseLibJars
[INFO]  [GRADLE] > Task :module:bundleReleaseAar
[INFO]  [GRADLE] > Task :module:assembleRelease
[INFO]  [GRADLE] 
[INFO]  [GRADLE] BUILD SUCCESSFUL in 20m 30s
[INFO]  [GRADLE] 37 actionable tasks: 37 executed
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Configure project :module
[INFO]  [GRADLE] WARNING:Software Components will not be created automatically for Maven publishing from Android Gradle Plugin 8.0. To opt-in to the future behavior, set the Gradle property android.disableAutomaticComponentCreation=true in the `gradle.properties` file or use the new publishing DSL.
[INFO]  [GRADLE] 
[INFO]  [GRADLE] > Task :module:generatePomFileForTitaniumPublicationPublication
[INFO]  [GRADLE] > Task :module:publishTitaniumPublicationPublicationToMavenRepository
[INFO]  [GRADLE] > Task :module:publish
[INFO]  [GRADLE] 
[INFO]  [GRADLE] BUILD SUCCESSFUL in 47s
[INFO]  [GRADLE] 2 actionable tasks: 2 executed
[INFO]  Packaging the module
[INFO]  Creating module zip
[INFO]  Writing module zip: /home/marc/ti.test/android/dist/ti.test-android-1.0.0.zip
m1ga commented 9 months ago

Thank you for all the infos! A lot to test here on my site :) Quick question as you patch everything already: did you see the actual error at some point?

I've also installed 32bit libs (https://gist.github.com/DroidPulkit/fd5206e49c3e663203588a08d0dd7f09#file-androiddevlinux-L99-L100 and also tried all these https://gist.github.com/szeswee/bfbf8eea4e19fddb91d8)

I'm using openjdk 17, cmake 3.27.7 (installed on my system), I've recently cleaned my .gradle folder after updating it in the SDK and I have that error for a few years now so I've updated my base system a lot during that time :)

I'll download a vanilla installation of Ubuntu so I can start at 0 and have a clean snapshot to go back to. Let's see if it works on a fresh install too :+1:

mbender74 commented 9 months ago

Building with the settings in my previous comment with tools 26.1.1 will lead to

[INFO]  [GRADLE] > Task :module:kaptGenerateStubsReleaseKotlin
[ERROR] [GRADLE] e: Daemon compilation failed: Could not connect to Kotlin compile daemon
[ERROR] [GRADLE] java.lang.RuntimeException: Could not connect to Kotlin compile daemon
[ERROR] [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemon(GradleKotlinCompilerWork.kt:221)
[ERROR] [GRADLE]    at org.jetbrains.kotlin.compilerRunner.GradleKotlinCompilerWork.compileWithDaemonOrFallbackImpl(GradleKotlinCompilerWork.kt:178)

I suggest, not only because building on Apple Silicon without build-tools 34.0.0, cmake 3.22.1 and ndk 26.1.10909125 is not possible (for compiling modules) to update the TiSDK to this... it works from my opinion for Linux and Mac...but that needs to be well tested!

Android NDK macOS & Apple Silicon Support

mbender74 commented 9 months ago

Thank you for all the infos! A lot to test here on my site :) Quick question as you patch everything already: did you see the actual error at some point?

I've also installed 32bit libs (https://gist.github.com/DroidPulkit/fd5206e49c3e663203588a08d0dd7f09#file-androiddevlinux-L99-L100 and also tried all these https://gist.github.com/szeswee/bfbf8eea4e19fddb91d8)

I'm using openjdk 17, cmake 3.27.7 (installed on my system), I've recently cleaned my .gradle folder after updating it in the SDK and I have that error for a few years now so I've updated my base system a lot during that time :)

I'll download a vanilla installation of Ubuntu so I can start at 0 and have a clean snapshot to go back to. Let's see if it works on a fresh install too 👍

No, I did not get your error.... but I believe I got something like that on my Apple Silicon last week (after I had to setup a fresh maschine, as my X86 MacBook died) and thats why I was fast in your topic... ;-)

mbender74 commented 9 months ago

normally I would had answered to ask @m1ga for help, but it was you... so that card was not possible to play...

mbender74 commented 9 months ago

aaahhh, never mind the kotlin error.... It´s only because my VM did not got enough memory... so, that can be ignored...

m1ga commented 9 months ago

man this is driving me crazy! I've installed a fresh Ubuntu VM and a fresh Fedora VM:

I didn't install any other package or made a config change and it worked with ndk v21 :+1:

So I went ahead and deleted my local Android SDK/NDK folders and reinstalled everything as I did in the VM. Not working :disappointed: So I guess it is some tool I have installed on my normal system that is interfering with the build system somehow. That sucks.

I guess I have to check fedora VM vs fedora local now to see what might be the issue here.

And one thing that is also strange: there was another Slack user who had the original issue on a Mac and we fixed it by going back to ndk18 too.

The good thing: the virtual machines worked with ndk21 so I'm a bit relieved that the Ti SDK is not broken!

mbender74 commented 9 months ago

maybe you could track that down by sudo fatrace -p $PID

m1ga commented 9 months ago

I think I've fixed it! Turns out: DON'T install the i686 (32bit) libraries! I've removed all of them and after that I can use ndk21 without an issue. Thank you so much for your help and the whole testing part. I was running the same install script every time I've setup a new system and that included the 32bit libraries as they were needed before. Never thought about changing that script :smile:

That said: I've made another small PR to update ndk to 22.1.7171670 (PR https://github.com/tidev/titanium-sdk/pull/13992). Small steps but it's safer for everyone like this.