Not able to load resources from classpath - gluon

I build this app and tried to move to mobile/native desktop. In mobile and native I have error loading resources from classpath. Error in desktop version:
Caused by: java.lang.NullPointerException
at org.fxapps.alphabet.AlphabetFX.bulkDetailsImages(AlphabetFX.java:178)
It refers to this line: https://github.com/jesuino/alphabetfx/blob/master/alphabetfx/src/main/java/org/fxapps/alphabet/AlphabetFX.java#L178
However, notice I can't also load a single file, it returns null.
Check my projects: https://github.com/jesuino/alphabetfx
I noticed the same error with android app using adb.
Different approaches were tried:
Used latest version for gluon
Put everything in the same project
Notice also that it works locally, with Java only. I can't even load the file on root classpath (/details).
I have the same kind of apply of app that works greatly: https://github.com/jesuino/battleship-game
Could this be caused because I have too much assets in my classpath? Or is there some sort of cache? I can see in debug logs that it handles most of my assets.
You can reproduce the error by:
Build the project using mvn clean install
Then go into alphabetfx-app and run mvn client:build client:package
Try to run the executable: ./target/client/x86_64-linux/AlphabetFXApp
Please help!
EDIT:
As pointed by Jose in Twitter[1], listing resources from the JAR or native bits (without a FS) won't work, hence I am using a file called "details.txt". However I still get a null when trying to read it. I will continue with this approach and update this with my solution when I find it.
[1] https://twitter.com/JPeredaDnr/status/1323348851345002502

I found the solution!
It was graalvm not copying my file to the native image. See this:
https://github.com/oracle/graal/blob/master/substratevm/Resources.md
The default configuration does not include all files in classpath into the native image. What I had to do was to rename my file to have a supported extension, I used ".dat" since ".txt" is not supported. See the list of supported resource extension by default:
File: ${App}/target/client/x86_64-linux/gvm/resourceconfig-x86_64-linux.json
{
"resources": [
{"pattern": ".*\\.png$"},
{"pattern": ".*\\.jpg$"},
{"pattern": ".*\\.jpeg$"},
{"pattern": ".*\\.gif$"},
{"pattern": ".*\\.bmp$"},
{"pattern": ".*\\.ttf$"},
{"pattern": ".*\\.raw$"},
{"pattern": ".*\\.xml$"},
{"pattern": ".*\\.fxml$"},
{"pattern": ".*\\.css$"},
{"pattern": ".*\\.gls$"},
{"pattern": ".*\\.json$"},
{"pattern": ".*\\.dat$"},
{"pattern": ".*\\.license$"},
{"pattern": ".*\\.frag$"},
{"pattern": ".*\\.vert$"},
{"pattern": ".*\\.obj$"}
]
}

Related

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniavutil in java.library.path:

I am getting the following error while adding and testing javaCV to project in intellij in ubuntu 22.04. I hava read the documentation(https://github.com/bytedeco/javacv) but didn't understand what to do extactly. What I have done for adding javaCV to project is,
File -> Project Structure -> Module -> dependencies (+ add dependencies)
then selected javacpp.jar, javacv.jar, opencv.jar and ffmpeg.jar from the 'javacv-platform-1.5.7-bin' folder which I downloaded.
This is the output which I get after running a code:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no jniavutil in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:848)
at java.base/java.lang.System.loadLibrary(System.java:2015)
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1800)
at org.bytedeco.javacpp.Loader.load(Loader.java:1402)
at org.bytedeco.javacpp.Loader.load(Loader.java:1214)
at org.bytedeco.javacpp.Loader.load(Loader.java:1190)
at org.bytedeco.ffmpeg.global.avutil.<clinit>(avutil.java:14)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:488)
at java.base/java.lang.Class.forName(Class.java:467)
at org.bytedeco.javacpp.Loader.load(Loader.java:1269)
at org.bytedeco.javacpp.Loader.load(Loader.java:1214)
at org.bytedeco.javacpp.Loader.load(Loader.java:1190)
at org.bytedeco.ffmpeg.avformat.Read_packet_Pointer_BytePointer_int.<clinit>(Read_packet_Pointer_BytePointer_int.java:45)
at org.bytedeco.javacv.FFmpegFrameGrabber.<clinit>(FFmpegFrameGrabber.java:362)
at com.cooltrickshome.MovieToImage.convertMovietoJPG(MovieToImage.java:31)
at com.cooltrickshome.MovieToImage.main(MovieToImage.java:25)
Caused by: java.lang.UnsatisfiedLinkError: Could not find jniavutil in class, module, and library paths.
at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:1767)
... 14 more
Process finished with exit code 1
Can anyone tell the exact steps to follow to add javaCV to the project in intellij ?
I have a similar problem as it failed to find the the library. I ends up build my own ffmpeg, and copying the dylib files in jniLibs, and adding a line like System.loadLibrary("avutil.57") in the static scope.
another way could be setting up the library path:
-Djava.library.path=/Users/xxx/ffmpeg-java-samples/src/main/jniLibs
Since you are in Ubuntu, up to this point, it should be able to fix your issue. However, for the mac, the end result the exception message changes to
tried:'/Users/xxx/ffmpeg-java-samples/src/main/jniLibs/libavutil.57.dylib',
but hitting to another issue: (mach-o file, but is an incompatible
architecture (have (arm64), need (x86_64)))
I am still figuring out the ffmpeg for mac M1 chip part.
after making sure the following jar file, it seems running:
export CLZPATH=$CLZPATH:$JARROOT/org/bytedeco/javacpp/1.5.8/javacpp-1.5.8.jar
export CLZPATH=$CLZPATH:$JARROOT/org/bytedeco/javacpp-presets/ffmpeg/4.1-1.4.4/ffmpeg-4.1-1.4.4.jar
export CLZPATH=$CLZPATH:$JARROOT/org/bytedeco/javacpp-presets/ffmpeg/4.1-1.4.4/ffmpeg-4.1-1.4.4-macosx-x86_64.jar

Application could not be uploaded on device

I have a crossplatform solution for an application. I have recently tried to add push notifications functionality for my IOS project.
But when i try to install my project on my ios i get this error.
Package Inspection Failed Error (error: 0xe8000051).
I have tried:
- Cleaning solution
- rebuild
- checking build action for my info.plist
- removing bin folder
the full trace of the install looks like this:
PreflightingApplication - PercentComplete: 30%
PackageInspectionFailed: Failed to load Info.plist from bundle at path /private/var/installd/Library/Caches/com.apple.mobile.installd.staging/temp.xhvJhV/extracted/ODEON.iOS.app/Frameworks/PersonalizedAdConsent.framework
error MT1006: Could not install the application '/Users/anderslarsen/Documents/Projects/ODEON/ODEON/ODEON.iOS/bin/iPhone/Release/ODEON.iOS.app' on the device 'Anders - iPhone': Package Inspection Failed Error (error: 0xe8000051).
Can anyone help me with this error?
Thanks in advance!
I could not find the reason this happens and I researched a lot, 2 years after this question was done I'm still getting this error. From my personal experience, manually deleting "bin" and "obj" and then building the iOS project again would solve the issue.

Julia Error Building Mongo.jl Package on Windows 10

I installed Julia v0.6.2 on Windows 10.
Every other package was installed without a problem, but Mongo.jl give me this error while building it.
Pkg.build("Mongo")
INFO: Building LibBSON
===============================[ ERROR: LibBSON ]===============================
LoadError: None of the selected providers can install dependency libbson.
Use BinDeps.debug(package_name) to see available providers
while loading C:\Users\"user"\.julia\v0.6\LibBSON\deps\build.jl, in expression starting on line 27
================================================================================
INFO: Building Mongo
================================[ ERROR: Mongo ]================================
LoadError: None of the selected providers can install dependency libmongoc.
Use BinDeps.debug(package_name) to see available providers
while loading C:\Users\"user"\.julia\v0.6\Mongo\deps\build.jl, in expression starting on line 26
================================================================================
================================[ BUILD ERRORS ]================================
WARNING: LibBSON and Mongo had build errors.
- packages with build errors remain installed in C:\Users\ciko9\.julia\v0.6
- build the package(s) and all dependencies with Pkg.build("LibBSON", "Mongo")
- build a single package by running its deps/build.jl script
================================================================================
I already opened an issue on github, but I'd like to fix it asap. Any idea on how to solve this problem?
The solution is first to install manually the mongo c drivers.
Second, to copy the mongo-c-drivers folder to the mongo e libbson folder inside julia, then make a new file deps.jl for each package and write this:
# Macro to load a library
macro checked_lib(libname, path)
((VERSION >= v"0.4.0-dev+3844" ? Base.Libdl.dlopen_e : Base.dlopen_e)(path) == C_NULL) && error("Unable to load \n\n$libname ($path)\n\nPlease re-run Pkg.build(package), and restart Julia.")
quote const $(esc(libname)) = $path end
end
# Load dependencies
#checked_lib libbson "C:\\Users\\"userName"\\.julia\\v0.6\\LibBSON\\mongo-c-driver\\bin\\libbson-1.0.dll"
# Load-hooks

segmentation fault when running macdeployqt

In order to run my Qt app on another Mac, I have the following two lines in my .pro file
MACDEPLOY = `echo $$QMAKE_QMAKE | sed 's/qmake/macdeployqt/g'`
QMAKE_POST_LINK = $$MACDEPLOY $$OUT_PWD/$$TARGET\.app -qmldir=$$PWD -verbose=3
This works fine for a simple HelloWorld application.
It used to work fine for my 'real' application as well but now I get the following error (my application works fine on my local Mac without these two lines)
/Users/marc/Qt5.7/5.7/clang_64/bin/macdeployqt /Users/marc/workspaceZ2/build/build-Z2Nexx40-Desktop_Qt_5_7_0_clang_64bit-Release/Z2Nexx40\.app -qmldir=/Users/marc/workspaceZ2/Z2Nexx40 -verbose=3
ERROR: Could not find bundle binary for "/Users/marc/workspaceZ2/build/build-Z2Nexx40-Desktop_Qt_5_7_0_clang_64bit-Release/Z2Nexx40.app"
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: (No such file or directory)\n"
Log: Using otool:
Log: inspecting ""
ERROR: "error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/otool: can't open file: (No such file or directory)\n" make: *** [Z2Nexx40.app/Contents/MacOS/Z2Nexx40]
Segmentation fault: 11 make:
And in the problem report window that pops up I see (not sure whether I picked a relevant part of it though)
Binary Images:
0x10da98000 - 0x10dac4fff +macdeployqt (0) <46011DBB-126C-35A0-942A-ACD79B0BCC45> /Users/USER/*/macdeployqt
0x10dace000 - 0x10df2eff7 +org.qt-project.QtGui (5.7 - 5.7.0) <A41CBDE5-2955-3A57-BAE9-69001B210588> /Users/USER/*/QtGui.framework/Versions/5/QtGui
0x10e081000 - 0x10e595ff7 +org.qt-project.QtCore (5.7 - 5.7.0) <5F2F454C-CEE8-3E59-A3B7-94F51F5B9F96> /Users/USER/*/QtCore.framework/Versions/5/QtCore
0x10e6b2000 - 0x10e6b6fff com.apple.agl (3.3.1 - AGL-3.3.1) <4E401980-0F4F-33E2-A0CF-8C7CCF375F24> /System/Library/Frameworks/AGL.framework/Versions/A/AGL
0x7fff64f70000 - 0x7fff64fa7a47 dyld (360.22) <DC81CC9D-651A-3A45-8809-928282052BD3> /usr/lib/dyld
Any ideas what might be wrong here? I recently upgraded to XCode 8 (and downgraded again to 7.3), upgraded from Qt5.6 to 5.7 but I have no clue on how to proceed.
Tips on what I could try would be most helpful!
Apparently, the reason was an incorrect/incompatible plist file.
I had to add a key to the plist file and hence I had my own plist file in my code tree.
Probably after upgrading XCode, my OS or Qt, this plist file was not compatible anymore.
I removed my own plist file, rebuild, and added my key to the newly generated plist file and everything worked fine as before.

can't share an archive in Xcode due to missing icon\r file

I put my Xcode project within my dropbox folder and now it seems like every time i try to share my archive from within the organizer it keep giving me the following error:
error: Codesign check fails : /var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app: a sealed resource is missing or invalid
In architecture: armv6
resource added: /private/var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app/www/Icon
resource missing: /private/var/folders/7l/l93zzs6n4h14qb7rmj5r7zn00000gn/T/GtLyx05w1O/Payload/stryker.app/www/Icon
I believe this error is caused by the fact that Xcode can see the icon/r file associated with drop box.
Is there a way i can delete this file?
I was able to share my archive after I deleted the icon\r file. Please refer to the following post for more info
https://apple.stackexchange.com/questions/31867/what-is-icon-r-file-and-how-do-i-delete-them/31877#31877

Resources