We're upgrading to Delphi 11.1 from 10.4.
We have a few scripts which build and deploy Android projects. They assemble an msbuild command that looked like this:
msbuild someproject.dproj /v:q /p:Platform=Android /t:Build;Deploy /p:Config=Release /p:BT_BuildType=AppStore
With 11.1, this throws an error message:
C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\CodeGear.Common.Targets(940,7): error MSB4036: The "XmlPeek" task was not found. Check the following: 1.) The name of the task in the project file is the same as the name of the task class. 2.) The task class is "public" and implements the Microsoft.Build.Framework.ITask interface. 3.) The task is correctly declared with <UsingTask> in the project file, or in the *.tasks files located in the "C:\Windows\Microsoft.NET\Framework\v2.0.50727" directory. [someproject.dproj]
Now, C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\rsvars.bat, which is used by all of our build scripts, explicitly sets the .NET framework as below:
#SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v4.0.30319
#SET FrameworkVersion=v4.5
After some research, I hit on the idea of adding a toolsversion parameter to the msbuild command as below, and this worked:
msbuild someproject.dproj /v:q /p:Platform=Android /t:Build;Deploy /p:Config=Release /p:BT_BuildType=AppStore /toolsversion:4.0
This is all well and good, but I would prefer not to hard-code the toolsversion number in the script(s).
Is there a way I can programmatically obtain the correct value of the toolsversion that Delphi itself is using when it generates builds, etc.?
I assume that just finding the highest .NET version installed will not suffice (and even then, one has to "translate" that to a toolsversion). It has to marry up with whatever Delphi is doing (e.g., in the CodeGear.Common.Targets file referenced in the original error message).
This is a bug in Delphi 11.1 that has at least 3 bug reports: RSP-37855, RSP-38466, and RSP-38467.
You can add /tv:4.0 to your MSBuild command line, or modify the first line in the .dproj file to:
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0" DefaultTargets="Build">
Assuming that rsvars.bat has been run,
FOR %%v IN ("%frameworkdir%") DO SET "toolsversion=%%~nv"
ECHO msbuild ...blah... /toolsversion:%toolsversion:~1%
The variable frameworkdir will be set by rsvars.bat. The for command parses its value (eg. C:\Windows\Microsoft.NET\Framework\v4.0.30319 as though it is a filename, and picks v4.0 as the "filename" (~n modifier [filename] of the metavariable %%v)
Then use the value assigned to toolsversion, starting at character 1 (where the first character is "character 0")
--- Given more info in comment
FOR %%v IN ("%frameworkdir%") DO ECHO %%~nxv|FINDSTR /R ".*\..*\.">nul&IF ERRORLEVEL 1 (SET "toolsversion=%%~nxv") ELSE SET "toolsversion=%%~nv"
Oh ye of little faith :)
Related
I am trying to build an executable for Android with cross compiling, everything works but the executable complains that it could not find the .so file it needs, which is in the same directory as the executable.
So what I did is to add the following lines
set(TARGET myapp)
# following 4 lines added to add RPATH of ./ to the binary
# so it searches the .so in the same directory
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
SET(CMAKE_SKIP_RPATH FALSE)
set(CMAKE_INSTALL_RPATH $ORIGIN)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
# add source code to target
add_executable(${TARGET} src.cpp)
...
However, it builds the executable, but RPATH seems not working no matter how I play with the four lines above, I just could not find any RPATH info in the binary using readelf or objdump.
I also tried set_target_properties(${TARGET} PROPERTIES INSTALL_RPATH $ORIGIN) but still not working.
Did I miss use anything here for RPATH configuration?
update
just to note that if I build the app for host(Linux) (using the same cmake file except using the android ndk tool chain) then everything is fine, I see $ORIGIN in the binary RPATH using readelf.
although i dont know what is been done in android ndk tool chain
This is probably not what you want:
(I am mentioning it just to be complete with my answer)
I assume that $ORIGIN is an environment variable. If that is the case you need to explain to CMake that it is such an variable. You can use $ENV{VAR} to do this, e.g.:
set(CMAKE_INSTALL_RPATH $ENV{ORIGIN})
This is probably what you want:
Ofcourse if the variable is not accessible during CMake generation step. You can try to use bracket arguments, however I do not think that alone would work (see last note at the bottom). Bracket arguments [=[...]=] tell CMake to skip the evaluation, because $ is a special character. e.g.:
set(CMAKE_INSTALL_RPATH [=[$ORIGIN]=])
To understand what [=[]=] do here is a simple example:
set(FOO "bar")
message(STATUS ${FOO})
message(STATUS [=[${FOO}]=])
Should output
bar
${FOO} #<-- evaluation of ${FOO} was skipped
Also if I'm not mistaken you also need to pass $ORIGIN to linker with single quotes so that it doesn't get evaluated during linking, i.e.
'$ORIGIN'
#and not $ORIGIN
i am following this tutorial here to use Tesseract libs for android. and in step(b) in the link posted, it says: b.export TESSERACT_PATH=${PWD}/external/tesseract-3.01
and in cygwin i wrote the following:
dm#me /cygdrive/e/Data/private/Fr/OCR/libs/tess-two-
master/tess-two-master/tess-two
but when i execute it i receive the belwo error:
$ export C:\Program Files (x86)\Tesseract-OCR=${PWD}\external\tesseract-3.01
-bash: syntax error near unexpected token `('
please let me know how to fix it, as i am a beginner to cygwin.
update:
i tried ezrepotein4 answer, and now it gives me "not a valid identifier". please , let me know what is "external\tesseract-3.01", i do not have these files/folders...and what is PWD. thanks
In this tutorial author uses few linux commands:
cd which changes directory - it is an equevalent of windows dir
export which sets environment variable
Before exporting any variable you should change directory to your project dir, because all $PWD strings in further commands will be replaced by your current directory.
This tutorial assumes that you compiled tesseract and leptonica and you keep them in project-dir/tess-two/external directory as tesseract-3.01 and leptonica-1.68. Source code for those libraries are in tess-two/jni directory in repository as stated in README.md https://github.com/rmtheis/tess-two/blob/master/README.md
Code which you are trying yo execute is incorrect both syntactically and semantically. It is incorrect syntactically because you all spaces are treated as separators between arguments. Semantically you are trying to set variable C:\Program Files (x86)\Tesseract-OCR to value of ${PWD}\external\tesseract-3.01. Instead you should set TESSERACT_PATH variable.
To do this try command TESSERACT_PATH=${PWD}/external/tesseract-3.01 as stated in tutorial. This means that you are setting variable TESSERACT_PATH to folder external/tesseract-3.01 in your current dir.
To further inspect a value of this variable type: echo $TESSERACT_PATH.
I'm struggeling intergrated proguard with android in my mac os computer.
My proguard android sdk is located at :
/Users/thanhnguyen/Documents/mr thao's music/android-sdk-macosx/tools/proguard
Proguard.sh file at follow :
PROGUARD_HOME=`dirname "$0"`/..
java -jar $PROGUARD_HOME/lib/proguard.jar "$#"
My project.properties as follow:
proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
When i try to run proguard, this errors occured :
Proguard returned with error code 1. See console
Proguard Error 1
Output:
Error: /Users/thanhnguyen/Documents/mr thao (No such file or directory)
at com.android.ide.eclipse.adt.internal.build.BuildHelper.runProguard(BuildHelper.java:623)
at com.android.ide.eclipse.adt.internal.project.ExportHelper.exportReleaseApk(ExportHelper.java:259)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.doExport(ExportWizard.java:313)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard.access$0(ExportWizard.java:238)
at com.android.ide.eclipse.adt.internal.wizards.export.ExportWizard$1.run(ExportWizard.java:223)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
What am I missing here?
Thanks a alot!
The problem is that you have an apostrophe in your folder name ("mr thao's music").
When Proguard reads in this file name, it hits the the apostrophe and thinks that it has reached the end of the file name, thus why the error shows that it is looking for a directory called /Users/thanhnguyen/Documents/mr thao.
I would either rename the directory or move your Proguard home elsewhere. In general, special characters in file or path names is not a good idea, as it will occasionally cause issues like this.
Alternatively, you could manually pass the directory in the java -jar command in progaurd.sh and escape the single quote/apostrophe with a backslash like so:
java -jar "/Users/thanhnguyen/Documents/mr thao\'s music/android-sdk-macosx/tools/proguard/lib/proguard.jar" "$#"
Keep in mind that this method will cause issues if this project is shared with other people, as the directory will be wrong for them.
For some reason I cannot generate a javadoc with Android Studio, after like 96 warnings it gives me this:
95 warnings
java.lang.NullPointerException
at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:83)
at com.sun.tools.javadoc.TypeMaker.getType(TypeMaker.java:44)
at com.sun.tools.javadoc.ClassDocImpl.superclassType(ClassDocImpl.java:496)
at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:453)
at com.sun.tools.doclets.internal.toolkit.util.Util.getAllInterfaces(Util.java:491)
at com.sun.tools.doclets.internal.toolkit.util.ClassTree.processType(ClassTree.java:194)
at com.sun.tools.doclets.internal.toolkit.util.ClassTree.buildTree(ClassTree.java:146)
at com.sun.tools.doclets.internal.toolkit.util.ClassTree.<init>(ClassTree.java:91)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:123)
at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
at com.sun.tools.javadoc.Start.begin(Start.java:167)
at com.sun.tools.javadoc.Main.execute(Main.java:59)
at com.sun.tools.javadoc.Main.main(Main.java:49)
javadoc exited with exit code 1
Is there a way to create the javadoc in android studio? If not, how could i create one, I need to give it with my project.
A combination of the two answers given here worked well for me. Though the docs generate fine, I still get 900 warnings and 140 errors BUT they're all related to the android packages. This is just the given solutions combined and explained a bit for people who aren't familiar with Android Studio or command line interfaces.
HOW TO GENERATE JAVADOC IN ANDROID STUDIO
Open Android Studio > Tools > Generate Javadoc
Select the scope, usually the whole project
Check include jdk and library sources
Specify the output directory. A load of files will be dumped here, so I recommend creating a new folder.
Select which methods you want to expose. Usually protected is desirable unless it has to look impressive for school.
The "tricky" part, "Other command line arguments". Under the pretty GUI, there's a direct call to the javadoc command, which runs the javadoc generator. The command line uses a structure like this: program_name [-flag] argument [-flag] argument, which as you can guess calls the program with certain optional behaviours, passing in what those should be.
So by specifying the following under "Other command line arguments"
-encoding utf-8 -bootclasspath /path/to/sdk/platforms/android-##/android.jar followed by clicking OK
you're really calling the javadoc program with these flags and arguments. These two flags allow the javadoc program to ignore unicode characters and find the android.jar though it seems that everything marked with # is read as a number and the android javadocs are filled with them.
I urge you to read through the warnings for your classes despite the seemingly large amount of spam, as javadoc will tell you when you've forgotten things like empty #return statements.
Adding the following line on "other command line arguments" fixed the errors:
-bootclasspath /path/to/sdk/platforms/android-##/android.jar
I don't think this issue is specific to Android Studio. I'm guessing it will happen anytime you've got Unicode characters in your JavaDoc comments.
Try using the following command:
javadoc -encoding utf-8
Alternatively, you can just use Unicode escapes (e.g. \u0000) instead of including Unicode characters directly.
In Eclipse, you can add extras to the JavaDoc command:
Project -> Generate Javadoc -> Next -> on the last page, in Extra Javadoc options write:
-encoding UTF-8
If you have a static final string variable containing the escaped unicode, you can try referencing the value of the string in the doc. Android Studio was able to resolve the unicode in the sidebar documentation for me. I don't know if this will work if you're trying to generate the doc from the command line though.
private static final String UNICODE_VALUE = "\u251c";//or whatever string
/**
* {#value #UNICODE_VALUE}
*/
//whatever you want to document
I know this may be late, but it's worth the effort. you may add this to the gradle.build file
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
I followed all the instruction given on stackflow, but unfortunately not able to generate doc file for my android project.
If I am not mentioning class path on last step of java doc generation, then getting "Android reference" error.
And if using it, then getting "javadoc: error - The -classpath option may be specified no more than once." error.
Using classpath:
-classpath "D:\Android 4.2 SDK\android_sdk\platforms\android-15\android.jar"
Am I using correct class path command ?
Please help me out.
Environment used:
Eclipse indigo
If you use Intellij IDEA go to Tools - Generate JavaDoc... Specify all the settings and set params: -bootclasspath [path]\android-sdk\platforms\android-{version}\android.jar -encoding UTF-8 -docencoding utf-8 -charset utf-8
More information is in this post.
Have You followed these steps (from www.mtholyoke.edu)? This works on my Project....if not and You get an error, please write here which error You get.
Project -> Generate Javadoc
In the "Javadoc command" field - browse to find javadoc.exe
• On the computers in the Clapp CS lab that is C:\JBuilderX\jdk1.4\bin\javadoc.exe
• On other computers it would be \bin\javadoc.exe
Check the box next to the project/package/file for which you are creating the javadoc
In the "Destination" field browse to find the desired destination (for example, the root directory of the current project).
Leave everything else as it is.
Click "Finish"
Javadoc should be in the destination folder. Open "index.html"
EDIT
I found a thread here in Stackoverflow with a lot of tipps, try this:
Javadoc in Eclipse failing to recognize packages
NEXT EDIT
It is only a possibility, but You specified Your classpath as:
"D:\Android 4.2 SDK\android_sdk\platforms\android-15\android.jar"
I know that eclipse got some problems with spaces inside a path. So the first part "Android 4.2 SDK" has to be specified without spaces, maybe here is the issue. But be aware, if You change this path, You have to set everywhere the new path where You have definded it.
I'm using the command line. I have also updated to Eclipse Kepler. It seems to execute javadoc differently? I'm investigating. But try this:
read the javadoc manual. It's confusing and doesn't tell you what to do, but, here's an example that should get you going.
Create a file called "options"
Add to the file this:
-d target-bin
-stylesheetfile style.css
-use
-splitindex
-windowtitle 'My Project Name Class Specification'
-doctitle 'My Project Name Class Specification'
-header '<b>My Project Name</b><br><font size="-1">0.1.5-alpha</font>'
-bottom 'Copyright 2014 My Company or Myself. All rights reserved.'
-group "Group Of Packages" "com.mypackage.*"
-overview overview.html
-exclude 'android'
-subpackages 'com.mypackage:android'
-charset utf-8
-encoding UTF8
-quiet
-sourcepath ../myProject/src;..\..\..\android-sdks\sources\android-19
Then on the command line type:
javadoc #options
Now, in Kepler, the "Generate Javadoc" dialog box says "What is the javadoc command line"...I suspect I'll have to type something like this. But don't know.
Hopefully this quick example will give you a start on how to get it done for your purposes.
By the way, I created a generic Eclipse project called "javadoc" in my Workspace so I could manage the files.