Bug? I deleted an Asset file i added but didn't use and now it won't compile!

Cableguy

Expert
Licensed User
Longtime User
Hi guys
From time to time I get this weird behavior, were during dev I add files to assts, either using the IDE add file, or using the Visual designer add file, and later, since I end up not using a particular file, I delete it, again using the "proper" way, but then when I try to compile, It just wont and complains of the missing file!
I have tried Cleaning the projects as well as "clean files folder" but it still complains of the missing file.
B4X:
WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
*** mainpage: B4XPage_Created
Error occurred on line: 23 (B4XMainPage)
java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:486)
    at b4j.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:877)
    at b4j.example.b4xpagesmanager._showpage(b4xpagesmanager.java:356)
    at b4j.example.b4xpagesmanager._addpage(b4xpagesmanager.java:177)
    at b4j.example.b4xpagesmanager._addpageandcreate(b4xpagesmanager.java:191)
    at b4j.example.b4xpagesmanager._initialize(b4xpagesmanager.java:127)
    at b4j.example.main._appstart(main.java:86)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
    at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
    at b4j.example.main.start(main.java:38)
    at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
    at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:184)
    at java.base/java.lang.Thread.run(Thread.java:1589)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:134)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:81)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 28 more
Caused by: java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
    at java.base/java.lang.reflect.Method.invoke(Method.java:578)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:115)
    ... 30 more
Caused by: java.lang.RuntimeException: Asset file not found: background.jpg
    at anywheresoftware.b4a.objects.streams.File.GetUri(File.java:186)
    at anywheresoftware.b4j.objects.NodeWrapper.getImageUri(NodeWrapper.java:780)
    at anywheresoftware.b4j.objects.Form.build(Form.java:323)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayoutHeader(LayoutBuilder.java:128)
    at anywheresoftware.b4j.objects.LayoutBuilder.loadLayout(LayoutBuilder.java:100)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:101)
    at anywheresoftware.b4a.objects.B4XViewWrapper.LoadLayout(B4XViewWrapper.java:525)
    at b4j.example.b4xmainpage._b4xpage_created(b4xmainpage.java:60)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    ... 32 more
 

drgottjr

Expert
Licensed User
Longtime User
put the file back and then remove it the "proper" way. i've deleted files manually from assets, only to have the compiler balk. give it what it wants, even an empy file so long as the name is what the compiler wants. do one compile (?) and then remove within the ide.

by the way, the error messages you posted don't seem to have anything to do with compiling. the app is running, so it compiled ok ... you seem to be missing a dependency. which normally wouldn't be in assets.
 

Cableguy

Expert
Licensed User
Longtime User
i've deleted files manually from assets, only to have the compiler balk.
That's why I posted as a BUG!
give it what it wants, even an empy file so long as the name is what the compiler wants.
Already did that before posting this BUG, still, it remains a BUG!
and then remove within the ide.
I had done that! That's why I call it a BUG!
by the way, the error messages you posted don't seem to have anything to do with compiling. the app is running, so it compiled ok ... you seem to be missing a dependency. which normally wouldn't be in assets.
Actually, you're wrong. The app didn't compile. The file "background.jpg" was used briefly as the main form background image, and was later replaced by a file named "background.png", but it somehow kept the reference to the .jpg file in the bjl file.
B4X:
Caused by: java.lang.RuntimeException: Asset file not found: background.jpg
    at anywheresoftware.b4a.objects.streams.File.GetUri(File.java:186)
    at anywheresoftware.b4j.objects.NodeWrapper.getImageUri(NodeWrapper.java:780)
    at anywheresoftware.b4j.objects.Form.build(Form.java:323)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is a runtime error, not a compilation error.
The file is set as a value of one of the properties of a view. The properties tree is not strictly connected to the list of files and I'm not too happy with going over all properties of all views each time a file is removed (it is also a bit complex as the property value is a simple string in this case and the meaning of this string is "property specific").
It is also a programming mistake to remove a file that your app is using. It is similar to removing a file that is loaded programmatically. In this case the compiler will issue a warning.

No doubt that a compiler warning would be better in the case of a missing file in one of the layouts.
 

Cableguy

Expert
Licensed User
Longtime User
it is also a programming mistake to remove a file that your app is using
The thing is, my app is NOT using it! I had used it as a test file, and later replaced it with the final file, that has a different extension. The "background.jpg" file IS NOT set as a property in NONE of the forms views!
 

Cableguy

Expert
Licensed User
Longtime User
It looks like it was used as the form's icon
I just verified it. The form's icon is not set...
I have add the "missing" file so that the app compiles and runs, but if I remove it, it just fails.
 
Top