今天使用lite版本安装了RAD Delphi10.4,发现自动把Android的SDK和NDK目录安装到C盘下,由于C盘容量紧张,所以想把目录迁移到其他路径!
在之前的版本是直接移动目录,在到delphi的tools-options菜单页面中修改SDK路径即可。
但是这次修改后发现在link时仍然找不到路径,查看了delphi的编译命令行信息,发现其中 usrlib 路径仍然是C盘的,如下:
dccaarm command line for "Project1.dpr" f:program_filesembarcaderostudio21.0indccaarm.exe -$O- --no-config -B -Q -TX.so -AGenerics.Collections=System.Generics.Collections; Generics.Defaults=System.Generics.Defaults -DDEBUG -E.AndroidDebug -If:program_filesembarcaderostudio21.0libAndroiddebug; f:program_filesembarcaderostudio21.0libAndroidRelease -LEC:UsersPublicDocumentsEmbarcaderoStudio21.0BplAndroid -LNC:UsersPublicDocumentsEmbarcaderoStudio21.0DcpAndroid -NU.AndroidDebug -NSSystem;Xml;Data;Datasnap;Web;Soap; -Of:program_filesembarcaderostudio21.0libAndroidRelease -Rf:program_filesembarcaderostudio21.0libAndroidRelease -Uf:program_filesembarcaderostudio21.0libAndroiddebug;f:program_filesembarcaderostudio21.0libAndroidRelease --libpath:C:UsersPublicDocumentsEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21sourcescxx-stlllvm-libc++libsarmeabi-v7a; C:UsersPublicDocumentsEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21platformsandroid-23arch-armusrlib --linker:F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21 oolchainsarm-linux-androideabi-4.9prebuiltwindows-x86_64inarm-linux-androideabi-ld.exe -V -VN -NO.AndroidDebug Project1.dpr
再次检查sdk路径,发现并无错误,猜测可能是delphi的bug,估计是漏掉了NDK library Path,页面中仅有C++ Builder的NDK library Path设置项(难道是lite版本裁剪后导致的?)。
好在发现delphi提供了设置项的export和import功能,因此,我先使用export导出设置文件,内容如下:
<?xml version="1.0" encoding="utf-8"?> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets=""> <PropertyGroup> <Profile_platform>Android64</Profile_platform> <Profile_host>localhost</Profile_host> <Profile_port>64211</Profile_port> <Profile_sdkname>AndroidSDK25.2.5_64bit.sdk</Profile_sdkname> <Profile_displayname>Android SDK 25.2.5 64-bit</Profile_displayname> <Profile_version>25.2.5</Profile_version> <Profile_sysroot>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-sdk-windows</Profile_sysroot> <NDKArmLinuxAndroidFile>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21 oolchainsaarch64-linux-android-4.9prebuiltwindows-x86_64aarch64-linux-androidinld.exe</NDKArmLinuxAndroidFile> <NDKArmLinuxAndroidStripFile>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21 oolchainsaarch64-linux-android-4.9prebuiltwindows-x86_64aarch64-linux-androidinstrip.exe</NDKArmLinuxAndroidStripFile> <NDKApiPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21platformsandroid-23</NDKApiPath> <NDKBasePath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21</NDKBasePath> <NDKGdbServerPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21prebuiltandroid-arm64gdbservergdbserver</NDKGdbServerPath> <SDKZipAlignPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-sdk-windowsuild-tools29.0.3ipAlign.exe</SDKZipAlignPath> <SDKAndroidPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-sdk-windows oolsAndroid.bat</SDKAndroidPath> <SDKAdbPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-sdk-windowsplatform-toolsAdb.exe</SDKAdbPath> <SDKAaptPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-sdk-windowsuild-tools29.0.3Aapt.exe</SDKAaptPath> <SDKApiLevelPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-sdk-windowsplatformsandroid-29android.jar</SDKApiLevelPath> <JDKPath>C:Program Files (x86)Javajdk1.8.0_112</JDKPath> <JDKJarsignerPath>C:Program Files (x86)Javajdk1.8.0_112inJarSigner.exe</JDKJarsignerPath> <JDKKeyToolPath>C:Program Files (x86)Javajdk1.8.0_112inKeyTool.exe</JDKKeyToolPath> <DelphiNDKLibraryPath>C:UsersPublicDocumentsEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21sourcescxx-stlllvm-libc++libsarm64-v8a;C:UsersPublicDocumentsEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21platformsandroid-23arch-arm64usrlib</DelphiNDKLibraryPath> <CBuilderNDKLibraryPath>F:Program_FilesEmbarcaderoStudio21.0PlatformSDKsandroid-ndk-r21platformsandroid-23arch-arm64usrlib</CBuilderNDKLibraryPath> <Profile_password>xxxxxxxx</Profile_password> </PropertyGroup> </Project>
注意其中的<DelphiNDKLibraryPath>仍然指向未迁移前的C盘路径,因此将该路径修改后,再重新使用import功能导入设置即可。