CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Jun 2021
    Posts
    5

    Loading freetype.so says dlopen failed, could not build

    I have started using libgdx and have been trying to get the freetypefont working on Android but no matter how hard I try I cannot seem to get it working. My app was working perfectly fine until I tried using freetypefont. I have put the extensions in as directed on the libgdx web site. I downloaded the natives and the jar. The app crashes or stops working as soon as it starts.
    The console says couldn't load shared library gdx-freetype for target linux 32-bit. I feel like I have tried everything. Even the things on the gradle files.

    Code:
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.0"
    
        defaultConfig {
            applicationId "com.mycompany.mygame"
            minSdkVersion 14
            targetSdkVersion 21
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
    }
    The second build.gradle:
    Code:
    android {
        buildToolsVersion "25.0.3"
        compileSdkVersion 25
        sourceSets {
            main {
                manifest.srcFile 'AndroidManifest.xml'
                java.srcDirs = ['src']
                aidl.srcDirs = ['src']
                renderscript.srcDirs = ['src']
                res.srcDirs = ['res']
                assets.srcDirs = ['assets']
                jniLibs.srcDirs = ['libs']
            }
    
            instrumentTest.setRoot('tests')
        }
        packagingOptions {
            exclude 'META-INF/robovm/ios/robovm.xml'
        }
        defaultConfig {
            applicationId "com.mycompany.mygame"
            minSdkVersion 8
            targetSdkVersion 25
        }
    
        //Defines dependencies for the :android project
        dependencies {
            //Adds dependencies on the :core project as well as the android backends and all platform natives.
            //Note the 'natives' classifier in this project.
            implementation project(":core")
            implementation "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"                
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
            natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
    		
    		implementation "com.badlogicgames.gdx:gdx-box2d:$gdxVersion"
            natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-armeabi-v7a"
            natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-arm64-v8a"
            natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86"
            natives "com.badlogicgames.gdx:gdx-box2d-platform:$gdxVersion:natives-x86_64"
            
    		implementation "com.badlogicgames.gdx:gdx-freetype:$gdxVersion"
            natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-armeabi-v7a"
            natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-arm64-v8a"
            //natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86"
            natives "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-x86_64"
            
        }
    }
    
    
    // called every time gradle gets executed, takes the native dependencies of
    // the natives configuration, and extracts them to the proper libs/ folders
    // so they get packed with the APK.
    task copyAndroidNatives() { 
        file("libs/armeabi/").mkdirs();
        file("libs/armeabi-v7a/").mkdirs();
        file("libs/arm64-v8a/").mkdirs();
        file("libs/x86_64/").mkdirs();
        file("libs/x86/").mkdirs();
    
        configurations.natives.files.each { jar ->
            def outputDir = null
            if(jar.name.endsWith("natives-arm64-v8a.jar")) outputDir = file("libs/arm64-v8a")
            if(jar.name.endsWith("natives-armeabi-v7a.jar")) outputDir = file("libs/armeabi-v7a")        
            if(jar.name.endsWith("natives-armeabi.jar")) outputDir = file("libs/armeabi")
            if(jar.name.endsWith("natives-x86_64.jar")) outputDir = file("libs/x86_64")
            if(jar.name.endsWith("natives-x86.jar")) outputDir = file("libs/x86")
            if(outputDir != null) {
                copy {
                    from zipTree(jar)
                    into outputDir
                    include "*.so"
                }
            }
        }
    }
    
    task run(type: Exec) {
        def path
        def localProperties = project.file("../local.properties")
        if (localProperties.exists()) {
            Properties properties = new Properties()
            localProperties.withInputStream { instr ->
                properties.load(instr)
            }
            def sdkDir = properties.getProperty('sdk.dir')
            if (sdkDir) {
                path = sdkDir
            } else {
                path = "$System.env.ANDROID_HOME"
            }
        } else {
            path = "$System.env.ANDROID_HOME"
        }
    
        def adb = path + "/platform-tools/adb"
        commandLine "$adb", 'shell', 'am', 'start', '-n', 'com.unlucky.main/com.unlucky.main.AndroidLauncher'
    }
    
    // sets up the Android Eclipse project, using the old Ant based build.
    eclipse {
        // need to specify Java source sets explicitly, SpringSource Gradle Eclipse plugin
        // ignores any nodes added in classpath.file.withXml
        sourceSets {
            main {
                java.srcDirs "src", 'gen'
            }
        }
    
        jdt {
            sourceCompatibility = 1.6
            targetCompatibility = 1.6
        }
    
        classpath {
            plusConfigurations += [ project.configurations.compile ]        
            containers 'com.android.ide.eclipse.adt.ANDROID_FRAMEWORK', 'com.android.ide.eclipse.adt.LIBRARIES'       
        }
    
        project {
            name = appName + "-android"
            natures 'com.android.ide.eclipse.adt.AndroidNature'
            buildCommands.clear();
            buildCommand "com.android.ide.eclipse.adt.ResourceManagerBuilder"
            buildCommand "com.android.ide.eclipse.adt.PreCompilerBuilder"
            buildCommand "org.eclipse.jdt.core.javabuilder"
            buildCommand "com.android.ide.eclipse.adt.ApkBuilder"
        }
    }
    
    // sets up the Android Idea project, using the old Ant based build.
    idea {
        module {
            sourceDirs += file("src");
            scopes = [ COMPILE: [plus:[project.configurations.compile]]]        
    
            iml {
                withXml {
                    def node = it.asNode()
                    def builder = NodeBuilder.newInstance();
                    builder.current = node;
                    builder.component(name: "FacetManager") {
                        facet(type: "android", name: "Android") {
                            configuration {
                                option(name: "UPDATE_PROPERTY_FILES", value:"true")
                            }
                        }
                    }
                }
            }
        }
    }
    Please I don't know what to do. I know it's possible because I installed an app made by libgdx on my android that used freetype and it worked.
    Stackoverflow doesn't work for me(browser/connection) and libgdx has no forums.

    Any idea to what I may be missing?

    App paths:
    -app
    ----build.gradle
    ----libs
    --------gdx-freetype.jar
    --------gdx.jar
    --------gdx-backend-android.jar, etc
    ----src
    --------main
    ------------jnilibs
    ----------------armeabi-v7a
    --------------------freetype.so,etc
    ----------------x86
    --------------------freetype64.so,etc
    --------build.gradle
    --------java/com.mygame.....(the code)
    Last edited by Gunroar; July 30th, 2021 at 03:57 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured