I am trying to write an errorformat to detect errors when compiling android applications using the new gradle build system (http://tools.android.com/tech-docs/new-build-system).
errorformat=%f:%l:\ error:\ %m
This errorformat catches the XML errors but in gradle the filename that comes in the output is not the original source filename, instead it is a temporary build file:
/home/user/Studio/myapp/build/res/all/debug/layout/add_child_dialog.xml:7: error: Error parsing XML: unbound prefix
The original source file is:
/home/user/Studio/myapp/res/layout/add_child_dialog.xml:7: error: Error parsing XML: unbound prefix
As you can see the error shows a file inside the build folder and it contains the build type (debug) in it.
I read the quickfix-window help and found ways to modify the quickfix output using the QuickfixCmdPost and quickfix BufReadPost auto-commands but these take effect after the quickfix window is parsed by the errorformat. As result I can see the correct source file on the quickfix window but vim still jumps to the wrong file.
Is there a way to modify the file (%f) after it is parsed by errorformat?
Is there a way to tell gradle to print the original source file and not the build one?
You could either transform the quickfix list on QuickFixCmdPost (using getqflist() and setqflist(), with the correct file in the filename attribute), or append a script to 'makeprg' that transforms the output (e.g. using sed).
But I agree with you that the tool output is wrong and should be fixed (to state the original files, not temporary copies), instead of working around this in Vim.
Related
I am getting this error while building my app. The drawable folder has the valid .jpg file and this is causing the error. How to bypass this? Also, I noticed that the path shown in the error is "main\res\routine\Routine.jpg", but there is no such folder in the project.
AGPBI: {"kind":"error","text":"The file name must end with .xml",
"sources":[{"file":"C:\\Users\\Lenovo\\AndroidStudioProjects\\project3\\app\\src\\main\\res\\routine\\Routine.JPG"}],
"tool":"Resource and asset merger"}```
UPDATE: solved the problem by reuploading the pic and saving it in drawable_V21. still dont know about that error message though. might be a bug
I guess that error you're experiencing is because of the file extension being in .JPG instead of .jpg try changing it. It may help somehow
I can't find a way to add images to drawable folder without getting "Cannot resolve symbol R" issue.
And once i get "Cannot resolve symbol R", I can't get rid of it by either clean, rebuild, sync, invalidate cache & restart solutions for the error. Only if i delete the files can I get the build to pass.
I am not sure what is wrong here.
Note: I am on Android Studio 2.1.1
I had exactly the same problem, and it was that I downloaded an "image.jpeg" extension from Internet and directly changed the extension saving it like "image.png", but Android studio still recognized it like image.jpeg.
I realized that when using top menu Analyze-Inpect code.
Once the inspection is finished a new window called 'Inspection' appears and in the follow carpets appears next:
Android > Lint > Usability > Icons
Icon format does not match the file extension
Misleading file extension; named .png but the file format is JPEG*
You are facing this issue because your drawable file name is either
having any capital letter or starting with a number or containing any special character like #,*,$ etc. rename it the
error will be gone.
You can use only small letters, underscore(_), numbers(not at beginning) & dot(.) in the name of drawable
For example the name could be ABC.png then rename it to abc.png and it will work.
1xYz.JPEG then rename it to _1xyz.jpeg
a#b.png then rename it to ab.png
After that clean and rebuild & there you Go..!!
I found that the extension of the file must match the actual format of the image.
For example, you will get this error if you changed the extension of an image from bmp to png and added it to the project
I have been trying to build an android kernel for a certain device, the Huawei Vitria, they finally uploaded their kernel source about 2 months ago so I try to build it the normal way which fails so I fix the main errors I see and get the kernel to build finally but, then I notice one error while building. I look into this file and see that they are using a weird way of building I think instead of the normal defconfigs, using a generic defconfig then a configuration file to configure their devices ontop of that(they've done this before but not to this extent), which leads me to think I'm missing a command to select the device config ontop of the defconfig to set up the drivers, but don't know what command was used.
So might there be a way to find out the command by looking at these two files
https://raw.githubusercontent.com/KainXS/android_kernel_huawei_y301a2/jellybean/drivers/huawei/hsad/parse_product.pl
https://raw.githubusercontent.com/KainXS/android_kernel_huawei_y301a2/jellybean/drivers/huawei/hsad/parse_product_id.pl
thanks
I'm not sure how much help this is, but the first command seems to want to be called with a parameter of a path to an XML file.
./parse_product.pl /ab/cd/hw_xxy_configs.xml
PRODUCT: xxy
reads: '/ab/cd/hw_xxy_configs.xml'
It pulls out some data from that file and pastes it into a .c file which presumably goes into the build configuration.
So, you're looking for an XML file containing your product-name.
The second file calls the first repeatedly to generate a set of .c files. Now - this second script takes an XML file as an argument, but I'm afraid I can't tell what it might be called. The file looks like it should contain product names and board-ids if that is any help.
I am using the following code snippet to zip a directory:
http://www.jondev.net/articles/Zipping_Files_with_Android_(Programmatically)
I noticed that if the directory is big like >3MB. The created zip file is corrupted and I could not open it. It throws "Archive is in unknown format or corrupted." error in Windows.
Any idea how I can prevent this? For example if too big, then just zip till the threshold is reached. Or is there any other method?
Need your guidance, I am writing one app in android with the help of native code which will communicate with CAN (Controller Area Network) port ; for that in my C code i used linux/can.h header file. and i am following "http://mobilepearls.com/labs/ndk-builder-in-eclipse/" this link to build my app. but one i set all thing i got bellow msg in eclipse console box
Compile thumb : can_port <= cansend.c
jni/cansend.c:14:23: fatal error: linux/can.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/can_port/cansend.o] Error 1
One more thing, i am working on windows environment. But i don't think this may be cause.
It is correct that it is not a Windows/Linux problem. The simple problem is that compiler is unable to find the file can.h. Now, for your info, when the compiler starts compiling, it searches for its header files in the folder
C:\(path to NDK folder)\platforms\(android-version)\(arch)\usr\include\linux
Now, if there isn't a can.h there, the compiler will flag an error. So the best way is
Either copy can.h to the above path (not tested)
Modify your Makefile to path to the correct directory where this header file is kept
Hope this helps!