Android Question [SOLVED] B4A v13.0 BETA - error -> "The filename or extension is too long."

scsjc

Well-Known Member
Licensed User
Longtime User

Yes, I was thinking that, and in the real project, it works that way.

What confuses me is that I've tried to create a new project with this name, and even longer, and it doesn't give the error.

It's as if the old project internally has some information that doesn't happen in the new default project.

What is clear to me is that in the real project, I change it, and it always works.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Couldn't it be as simple as there's some internal max length for the extension?
I don't think so.
My app, that had this issue, has a name like this:
br.com.app.moremathlanguages
If I change the package, I can't update the app in the Play Store.
My soluction was move the project from activity format to b4xpages format.
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
I don't think so.
My app, that had this issue, has a name like this:
br.com.app.moremathlanguages
If I change the package, I can't update the app in the Play Store.
My soluction was move the project from activity format to b4xpages format.

Yes, it's clear that changing the name is not a solution. The solution is to understand why it happens and to find where the error occurs so that it can compile correctly with the original name.
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
I listed many soluctions in this thread.
I started considering moving the project to B4XPages, but it's too much work; maybe I'll do it in the future.

But for now, I think it's a good lead to know that changing the name to a shorter one works.

Could you test it in your project that wasn't working? To see if the same thing happens to you?
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I started considering moving the project to B4XPages, but it's too much work; maybe I'll do it in the future.
I use this approach:
Now in less the a 1/2 hour I can convert a big project.
But for now, I think it's a good lead to know that changing the name to a shorter one works.

Could you test it in your project that wasn't working? To see if the same thing happens to you?
I put the .es extension in the package name and works.
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
Hmm, I'm sure I'll end up doing the B4XPage conversion, but I have too much to convert.

By using the .es extension, does it always work when compiling? ... I think the solution lies in this.
 
Upvote 0

asales

Expert
Licensed User
Longtime User
Hmm, I'm sure I'll end up doing the B4XPage conversion, but I have too much to convert.
I change the main modules and, as soon as possible, I will changed the others.
By using the .es extension, does it always work when compiling? ... I think the solution lies in this.
 
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
After conducting many more tests, I also found that by removing the libraries **AHSwipeToRefresh** and **DesignSupport 3.00**, the project works correctly and always compiles without the "The filename or extension is too long." error.

Interestingly, once you remove these libraries and then reselect them and compile again, it compiles successfully, and the libraries work correctly.

However, if I do a "CLEAN PROJECT," the "The filename or extension is too long." error reappears.
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
In my case, the issue was caused by a folder with a long name, and I can reproduce this:

Package name: b4a.example.Thespecifiedpathfilenametoolong


folder name and location of my project (for test - I don't have those crazy locations):
C:\Users\pppnd\Documents\2024_xxxxxxxxxx - XXGB\B4A Example Test\B4A Example Test1234 B4A Example Test1234\B4A Example Test1234 B4A Example Test1234\Example B4A Example Test1234\CLVExample Example B4A Exampl

getting this error:
B4X:
The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

C:\java\jdk-19.0.2\bin\javac.exe
C:\Android4\platforms\android-34\android.jar
 

Attachments

  • CLVExample Example B4A Exampl.zip
    229 KB · Views: 57
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Probably why I don't encounter the problem - my source files are in c:/b4asource or c:/b4jsource instead of documents, java is in c:/jdk-?? and Additional Libraries are in c:/b4(a/j)extralibs
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
Probably why I don't encounter the problem - my source files are in c:/b4asource or c:/b4jsource instead of documents, java is in c:/jdk-?? and Additional Libraries are in c:/b4(a/j)extralibs
Agreed. In my case, I downloaded a project from a friend that had a long folder name with many nested folders, and I encountered the same error.
B4X:
The specified path, file name, or both are too long.

I use to have/work like this:

C:\Users\xx\Documents\2024_Projects\Project1
C:\java\jdk-19.0.2\bin\javac.exe
C:\Android4\platforms\android-34\android.jar

I haven't had any issues with these paths. I've read somewhere that it's generally recommended to keep folders closer to the root directory (C, so that's something I always do.
 
Upvote 0

Filippo

Expert
Licensed User
Longtime User
Please remember that the maximum directory + file name must not be longer than 255 characters.
If you use "c:\user\xxx\documents\xxx..." as the directory, for example, the maximum length can be exceeded very quickly and then the error message appears.
Therefore, this user directory should not be used for such data.
Even most backup programs have problems if you exceed this length.
 
Upvote 0

f0raster0

Well-Known Member
Licensed User
Longtime User
I'm still waiting for a project that reproduces this issue. If you have one and can share ...
Erel, this might not be the best example, but since you don’t have one to reproduce the error yet, I’m attaching one for you.

For reference, these are my paths, and I’ve never had any issues:
C:\Users\xx\Documents\2024_Projects\Project1
C:\java\jdk-19.0.2\bin\javac.exe
C:\Android4\platforms\android-34\android.jar

In my case, the error only occurred when I opened a project from a friend with a long path. To reproduce the error, just try opening the attached project from your desktop, for example, again not sure if that is the best example

In my opinion, it’s possible that some members are referencing a library with a long path.
 

Attachments

  • ExampleTooLong.zip
    259.7 KB · Views: 53
Upvote 0

scsjc

Well-Known Member
Licensed User
Longtime User
Thank you. I think that this is a different issue here.

@scsjc can you compile your app with B4ABuilder, the command line tool? If not then please post the logs.

I just compiled it, this is the result
I think the problem is in: "System.ComponentModel.Win32Exception (0x80004005): El nombre del archivo o la extensión es demasiado largo"


B4X:
D:\F1>b4abuilder -task=Build -obfuscate=False -BaseFolder=d:\F1 -Project=f1.b4a -ShowWarnings=TRUE
B4ABuilder v13.00 BETA #3
Global Java version: 19
BaseFolder: d:\F1
ProjectFile: f1.b4a
BuildConfiguration: Default,com.oficinadirecta
Parsing code.
Java Version: 19
Compiling code.
Compiling layouts code.
Organizing libraries.
(AndroidX SDK)
Compiling resources
Linking resources
link  --auto-add-overlay --no-version-vectors --manifest AndroidManifest.xml -I "C:\a4\platforms\android-34\android.jar" bin\extra\compiled_resources\com.oficinadirecta.zip -R bin\extra\compiled_resources\ResourceViewAnimations.zip  -R bin\extra\compiled_resources\anywheresoftware.b4a.objects.zip  --extra-packages anywheresoftware.b4a.objects  -R bin\extra\compiled_resources\anywheresoftware.b4a.objects.zip  --extra-packages anywheresoftware.b4a.objects  -R bin\extra\compiled_resources\androidx.appcompat.zip  --extra-packages androidx.appcompat  -R bin\extra\compiled_resources\androidx.appcompat.resources.zip  --extra-packages androidx.appcompat.resources  -R bin\extra\compiled_resources\androidx.core.zip  --extra-packages androidx.core  -R bin\extra\compiled_resources\androidx.core.ktx.zip  --extra-packages androidx.core.ktx  -R bin\extra\compiled_resources\androidx.core.testing.zip   --extra-packages androidx.swiperefreshlayout  -A bin\extra\assets  -A ..\Files -A b4xlibs\Files  -A "c:\a4\tools\..\extras\b4a_remote\androidx\emoji2\emoji2-bundled\1.4.0\unpacked-emoji2-bundled-1.4.0\assets" -o bin\temp.ap_ --java gen
build tools: 34.0.0, android jar: android-34
Compiling generated Java code.
System.ComponentModel.Win32Exception (0x80004005): El nombre del archivo o la extensión es demasiado largo
   en System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
   en f7.a(Process A_0, Boolean A_1, DataReceivedEventHandler A_2, DataReceivedEventHandler A_3, String A_4)
   en f7.d.g()
   en im.a(a A_0)
   en in.j(String[] A_0)
   en in.m(String[] A_0)
El nombre del archivo o la extensión es demasiado largo
 
Last edited:
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
you could try using UNC paths as they have a limit of 32k

C:/very/long/path/to/a/file.txt > \\?\C:/very/long/path/to/a/file.txt
 
Upvote 0

asales

Expert
Licensed User
Longtime User
I tried to compile with the beta4, but I don't saw any other lines beside this:

B4X:
B4A Version: 13.00 BETA #4
Parsing code.    (0.52s)
    Java Version: 19
Building folders structure.    (0.09s)
Compiling code.    (0.42s)
   
ObfuscatorMap.txt file created in Objects folder.
Compiling layouts code.    (0.06s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.12s)
Linking resources    (3.58s)
    build tools: 34.0.0, android jar: android-34
Compiling generated Java code.    Error
O nome do arquivo ou a extensão é muito grande

O nome do arquivo ou a extensão é muito grande = The filename or extension is too long

There are another way to see the full IDE logs when compile the project?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…