nativeLib with 3.5 ver

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By yan88

Hi,
seems there’s an issue with the Native lib plugin in the new version.
after choosing python executable (3.9/3.10) ,hitting the “nativelib” button and the “packages” button i get this issue:

modules/gdscript/gdscript_functions.cpp:775 - NativeLib repository not found! Search at…
modules/gdscript/gdscript_functions.cpp:775 - Try to update repository info (button “REPO”)

anyone found a solution for that?

thanks!

What is “Native lib plugin”?

sash-rc | 2022-09-19 08:14

plugin management system by DrMoriarty
link - GitHub - DrMoriarty/nativelib: NativeLib is a plugin management system for Godot engine.

works great with 3.4 ver
however - cannot get the packages to load on 3.5…

yan88 | 2022-09-19 08:55

Well, I think you need to ask addon author about your issue then.

sash-rc | 2022-09-19 13:29

will try :slight_smile:
was hoping someone already met the issue…

thanks

yan88 | 2022-09-19 14:31

iYes, I am facing the same problem

MohammedUnicold | 2022-11-01 18:01

:bust_in_silhouette: Reply From: Zeailer

Hello, made an account just to answer this, since you want nativeLib there is huge chance you are in need of MultiDex.

If that is the case the best way how to get around it is to edit the gradle file yourself.
Simply go to: Your_project_location\android\build\build.gradle

In the file you should find

deafultConfig {
//some text here
//add this line
multiDexEnabled true
}

thanks a lot for the help!

yan88 | 2022-11-03 07:17

:bust_in_silhouette: Reply From: zungm2

Modify parts of the MainUI.gd file.

#onready var _home_path := '%s/../'%OS.get_system_dir(OS.SYSTEM_DIR_DESKTOP) # original code
onready var _home_path := OS.get_user_data_dir() # modified code

#var index_path = '%s/.nativelib/meta'%_home_path # original code (inside load_storage())
var index_path = '%s\\.nativelib\\meta'%(_home_path.strip_edges()) # modified code

Modify parts of the nativelib file.
Import ‘io’ additionally.

import sys, os, getopt, json, shutil, traceback, tarfile, time, uuid, base64, datetime, io

def save_project():
    # with open('project.godot', 'w') as f:
    #    f.write('\n'.join(PROJECT))
    with io.open('project.godot', 'w', encoding='utf-8') as f:
        f.write('\n'.join(PROJECT))

def file_text(filepath):
    #if sys.version_info[0] >= 3:
    #    return pathlib.Path(filepath).read_text()
    #else:
    #    with open(filepath, 'r') as f:
    #    return f.read()
    if sys.version_info[0] >= 3:
        with io.open(filepath, 'r', encoding='utf-8') as f:
            return f.read()
    else:
        with open(filepath, 'r') as f:
            return f.read()

After modifying the code, go to Project Settings → Plugins → NativeLib → Status checkbox and toggle it to reload.

This method resolved the errors for me. (3.5.1)

1 Like