Android Question Error parsing manifest script: Invalid macro file

mfstuart

Active Member
Licensed User
Longtime User
I used ChatGPT to create a B4A app that uses the autoFill feature for Android OS.
It showed that I should add to the manifest the following text:

B4X:
SetApplicationAttribute(android:autofillHints, "")
CreateResourceFromFile(Macro, Core)
AddManifestText(<activity android:name="anywheresoftware.b4a.B4AActivity"
    android:autofillHints="username password" />

After saving the Manifest changes, I got an error in the Log tab as stated in the title.
It's referencing the CreateResourceFromFile line.

What am I to assume from this?
That ChatGPT is wrong or missing something?
I searched on the B4A forum and found nothing explicit to "Macro, Core".

Can someone enlighten me on this?

Regards,
Mark Stuart
 

drgottjr

Expert
Licensed User
Longtime User
CreateResourceFromFile(Macro, Core)
should be:
CreateResourceFromFile(Macro, Core.Some_File)
it's missing the "File" part. look at Core.Jar itself. you can see the various files that Core can create macros from. you saw the example in android's documentation almost 2 years ago. that's the content of the file which will create the macro. but you can't just apply your macro to Core.jar. the macro has to apply to some class in Core.jar relative to autofill. i don't see anything that might apply. either it's in some other library or it hasn't been implemented in b4a (which, i think, is what erel said 10 years ago...)

note: i'm not saying that once you change this the rest of chatgpt's instructions are valid. this part, at least, is not.
chatgpt may need to confer with one or more of its artificial brothers on this one.
 
Last edited:
Upvote 0

mfstuart

Active Member
Licensed User
Longtime User
Hi @drgottjr

What app would view the Core.jar file? I've not had a reason to do that.
I'm even wondering how ChatGPT even knows about B4X language, but there you go, it does to some extent.
It gave me code that the forum couldn't from doing extensive searches.

Sure would like B4A to support the autoFill feature of Android.

Mark Stuart
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i've used jd-gui.exe for years. there are probably others. a .jar is like a .zip file. you can use, eg, winrar to examine at least the top level (see attached image). you can't actually read the code (with jd-gui you can). just google "view .jar files" for something to download.

in the case of Core.jar, let's take this manifest editor comment: CreateResourceFromFile(Macro, Core.NetworkClearText)
this is like what chatgpt told you but missing the file that's used to create the macro: NetworkClearText.
if you look at Core.jar (ofr the image below), you will see NetworkClearText as part of Core.jar. in other words chatgpt had some of it right, but there are 2 issues: there is no file mentioned from which to create the macro, and even if there were, i don't think it would go in Core.jar. if you look at Core.jar with jd-gui, i don't think you'll find any class relating to passwords. and based on @Erel's comment, there doesn't appear to be a b4a library to handle it.

whether someone has written a standaone library for autofill i can't say. there is an api, which means you could write a library or possibly use it with inline java. in any case, there is a separate file required to allow for autofill (you discovered this almost 2 years ago in android's documentation).

my purpose in responding to your thread was to point out that i believe chatgpt's code suggestion is wrong, at least as regards CreateResourceFromFile() is concerned.
 

Attachments

  • core.jpg
    core.jpg
    44.2 KB · Views: 14
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
no offense, but the idea is for problems and solutions to be shared on the forum.
 
Upvote 0
Top