I got a project from a former employee of our company.
It's an Android app written in Delphi XE7, using Android SDK 19 (4.4) and Sqlite3 for a local db on the smartphone.
For the moment we have a working copy on the smartphones, but I can't get it compiled/build on my pc. And we need a new version, because some things needs to change in our company logic.
I always get this fatal error:
"[DCC Fatal Error] Linker error code: 1 ($00000001)"
Before this fatal error, i have more than hundred other erros, all looking almost the same:
[DCC Error] C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: c:\\\\program files (x86)\\\\embarcadero\\\\studio\\\\15.0\\\\lib\\\\Android\\\\Release/libsqlite.a(sqlite3.o): multiple definition of 'sqlite3_aggregate_context'
Only the last 2 words of this errors are always different, so I assume this are all the different classes in sqlite3.
I tried a lot of things, from trying it in Xe7, XE8, XE10, different settings in the SDK Manager, ...
I made new projects and brought the files tp this new project, but I always got this same error.
My SDK Manager Settings are:
SDK:
Base Path: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk
ZipAlign: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\tools\ZipAlign.exe
Android Location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\tools\Android.bat
Adb Location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\platform-tools\Adb.exe
Aapt location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\build-tools\android-4.4\Aapt.exeµ
SDK Api-level locationC:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\adt-bundle-windows-x86-20131030\sdk\platforms\android-19
NDK:
Base Path: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c
arm-linux-androideabi-ld.exe location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe
arm-linux-androideabi-strip.exe location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-strip.exe
gdbserver location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\prebuilt\android-arm\gdbserver\gdbserver
NDK Api Location: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\platforms\android-14
C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\platforms\android-14\arch-arm\usr\lib
Delphi NDK Library Path: C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\platforms\android-14\arch-arm\usr\lib;C:\Users\Public\Documents\Embarcadero\Studio\15.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi-v7a
Java:
KeyTool Location: C:\Program Files\Java\jdk1.7.0_25\bin\KeyTool.exe
Jarsigner Location: C:\Program Files\Java\jdk1.7.0_25\bin\JarSigner.exe
Can anyone give me a clue or a possible solution.
Thx in advance Timothy
I found the solution:
problem was that is used a SqliteUniProvider and in an other file there was still a dbxsqlite in the uses clause.
From the moment I commented the second one (dbxsqlite) out, the linking error dissapeared while compiling/building.
Related
I have already compiled this simple example on windows using this https://kotlinlang.org/docs/tutorials/native/using-command-line-compiler.html
Then I tried to set up my arch Linux environment, using this
https://snapcraft.io/install/kotlin-native/arch
while also installing the android sdk from AUR using this,
https://noirscape.github.io/guides/2018/06/14/android-sdk-arch-linux.html
ls gives this - build build.gradle.kts main.kt. README.md settings.gradle.kts src
I am not using gradle for this problem but it is installed
cat main.kt gives this -
fun main() {
println("Hello Kotlin/Native!")
}
when I run kotlinc-native main.kt -o build/hello
I get error: compilation failed: /var/lib/snapd/snap/kotlin-native/13/konan/nativelib/libllvmstubs.so: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1:undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
*source files main.kt
*compiler version info: Konan: 0.9.3 / Kotlin: 1.3.0
*Output Kind PROGRAM
exception: java.lang.unsatisfiedLinkError: /var/lib/snapd/snap/kotlin-native/13/konan/nativelib/libllvmstubs.so: /snap/core/current/lib/x86_64-linux-gnu/librt.so.1 undefined symbol: __clock_nanosleep, version GLIBC_PRIVATE
then there are a lot of at java.base at llvm.llvm and at org.jetbrains.kotlin after that. If those are important I can let me know.
I am a baby kotlin user and a baby Linux user. I believe learning starts from the bottom up so I really want to understand what is happening here instead of just solving it by using gradle or android studios.
I have a feeling that the compiler might not have downloaded all the dependencies on its first run or maybe this has something to do with the symbolic link I made from the first link. please help me understand
ps. I am also sharing a git repo for this project across the two OS's. So maybe this is windows getting in the way but I cant really see how that could be.
Cannot compile my App for Android 64-bit with Delphi 10.3.3.
My App is using Box2D library.
While compile I get following errors:
[DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\android-ndk-r17b\toolchains\aarch64-linux-android-4.9\prebuilt\windows\aarch64-linux-android\bin\ld.exe: cannot find -lFlatBox2D
C:\Users\Public\Documents\Embarcadero\Studio\android-ndk-r17b\toolchains\aarch64-linux-android-4.9\prebuilt\windows\aarch64-linux-android\bin\ld.exe: cannot find -lgnustl_static
Compilation for Android 32-bit of same App is successful.
Compilation of another my (simple) App for Android 64-bits works fine.
So, I realized, that problem is only with Box2D for Android 64-bits used in my App.
Then I also tested compilation of Box2D TestBed App that is coming with RAD (here ...\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\) - the same issue - it is compiled successfully for Android 32-bits, but same error when I'm compiling TestBed for Android 64-bits!
Please help. Thousands of lines of code in my App already, and now it is full stop - can't build it for Android 64-bits [scared]
UPDATE1
Second error "cannot find -lgnustl_static" fixed by adding path C:\Users\Public\Documents\Embarcadero\Studio\android-ndk-r17b\sources\cxx-stl\gnu-libstdc++\4.9\libs\arm64-v8a into menu Tools->Options, then 'SDK Manager'->NDK->'Android SDK 25.2.5 64-bits'-> value for 'Delphi NDK Library path'.
However, the first problem 'cannot find -lFlatBox2D'still exists.
I found only 2 files of library libFlatBox2D.a on my computer, it is
C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android\debug
C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android\release
Both paths I added to the same 'Delphi NDK Library path' at SDK Manager for Android 64bit.
However, now getting error message skipping incompatible libFlatBox2D.a when searching for -lFlatBox2D for each of these paths.
So the question now - where to find a compatible libFlatBox2D.a that required for Android 64bits?
UPDATE2:
Hm... and in following 2 android64 paths do not have any libFlatBox2D.a files.
C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android64\debug
C:\Program Files (x86)\Embarcadero\Studio\20.0\lib\android64\release
Does it mean, that 10.3.3 Delphi installation is missing 64-bits Box2D android library?
UPDATE3:
As answered by #Stefanos , now I have 64bit version of libFlatBox2D.a.
But now while compiling I receiving count of 1700 linker errors about Box2D names , all of them similar to below:
[DCC Error] E2597 C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::Create_b2Draw_delegate(System::DelphiInterface<Box2d::Common::Ib2Draw>)':
Box2D.Common:(.text._ZN5Box2d6Common22Create_b2Draw_delegateEN6System15DelphiInterfaceINS0_7Ib2DrawEEE[_ZN5Box2d6Common22Create_b2Draw_delegateEN6System15DelphiInterfaceINS0_7Ib2DrawEEE]+0x0): undefined reference to `Create_b2Draw_delegate'
C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::Destroy_b2Draw_delegate(NativeUInt)':
Box2D.Common:(.text._ZN5Box2d6Common23Destroy_b2Draw_delegateE10NativeUInt[_ZN5Box2d6Common23Destroy_b2Draw_delegateE10NativeUInt]+0x0): undefined reference to `Destroy_b2Draw_delegate'
C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::b2Version_Create()':
Box2D.Common:(.text._ZN5Box2d6Common16b2Version_CreateEv[_ZN5Box2d6Common16b2Version_CreateEv]+0x0): undefined reference to `b2Version_b2Version'
C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::b2BlockAllocator_Create()':
Box2D.Common:(.text._ZN5Box2d6Common23b2BlockAllocator_CreateEv[_ZN5Box2d6Common23b2BlockAllocator_CreateEv]+0x0): undefined reference to `b2BlockAllocator_b2BlockAllocator_1'
C:\Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Multi-Device Samples\Physics\TestBed\Android64\Debug\Box2D.Common.o: In function `Box2d::Common::b2BlockAllocator_Destroy(NativeUInt)':
Box2D.Common:(.text._ZN5Box2d6Common24b2BlockAllocator_DestroyE10NativeUInt[_ZN5Box2d6Common24b2BlockAllocator_DestroyE10NativeUInt]+0x0): undefined reference to `b2BlockAllocator_dtor'
etc...etc...
UPDATE4: Current status
I'm looking now for original libFlatBox2D.a library file for Android 64-bits (Delphi 10.3.3). If anyone has it, please share it with me.
The above attempts were not successful. An 'original' 64bits libFlatBox2D.a is required, which is not in my installation of RAD 10.3.3...
UPDATE5:
Embarcadero QA created a ticket:
https://quality.embarcadero.com/browse/RSP-27762
Will wait from their solution.
You have to create a new Package with name FlatBox2D, add all FlatBox units from ..\studio\20.0\source\FlatBox2D and compile it for Android64.
I have created the package and compiled both debug and release versions for Android64 with Delphi 10.3.3. In the link below you will find the new package files and the Android64 folder where you can find the libFlatBox2D.a for Debug and Release. Just copy the .a file to the corresponding folder in ..\studio\20.0\lib\Android64.
You can always compile the package on your own by just copying the FlatBox2D.dpr and FlatBox2D.dproj files in ..\studio\20.0\source\FlatBox2D, load the dpr in Delphi and compile it for Android64...
Stefanos
FlatBox2D.zip
Hi everybody I'm in a dead end!
Develop a PCL application using VisualStudio 2015, Xamarin and MvvmCross.
The Android app exceeds the 65K limit. I need to use Multidex!
For its implementation I have undertaken these guidelines:
Enabled checkbox for MultiDex
Extended MultiDexApplication class
General considerations:
Debug mode
MinSdk: 21
TargetSdk: 25
BuildTools: 23.0.3
Jdk 1.8.0_121
Xamarin.Android 7.3
Results:
"java.exe" exited with code 2. C:\Program Files (x86)\MSBuild\Xamarin \Android\Xamarin.Android.Common.targets 1965
<!-- Compile java code to dalvik -->
<CompileToDalvik
DxJarPath="$(DxJarPath)"
JavaToolPath="$(JavaToolPath)"
JavaMaximumHeapSize="$(JavaMaximumHeapSize)"
JavaOptions="$(JavaOptions)"
ClassesOutputDirectory="$(IntermediateOutputPath)android\bin\classes"
ToolPath="$(DxToolPath)"
ToolExe="$(DxToolExe)"
UseDx="$(UseDx)"
MultiDexEnabled="$(AndroidEnableMultiDex)"
MultiDexMainDexListFile="$(_AndroidMainDexListFile)"
JavaLibrariesToCompile="#(_JavaLibrariesToCompileForAppDx)"
OptionalObfuscatedJarFile="$(IntermediateOutputPath)proguard\__proguard_output__.jar"
/>
The error occurs during the compilation process.
I have consulted these sources:
"https://developer.android.com/studio/build/multidex.html"
"http://www.jon-douglas.com/2016/09/05/xamarin-android-multidex/"
"http://www.jon-douglas.com/2016/09/23/xamarin-android-multidex-keep/"
"https://przemekraciborski.eu/"
"https://forums.xamarin.com/discussion/64234/multi-dex-app-with-a-custom-application-class-that-runs-on-pre-lollipop"
"http://frogermcs.github.io/MultiDex-solution-for-64k-limit-in-Dalvik/"
I also have the ClassyShark.jar tool, but no dex or apk file is generated to explore it. Only the mono.android.jar file exists
Please I need help.
Thank you very much.
Responding to answer 1 and Luke Pothier's commentary are the results:
Setting output verbosity = Diagnostic
Case 1:
Using Android Sdk Location: C:\Program Files (x86)\Android\android-sdk installed with Visual Studio 2015.
4>_CompileToDalvikWithDx:
4> Creating directory "obj\Debug\proguard".
4> C:\Program Files\Java\jdk1.8.0_121\\bin\java.exe -Xmx1G -jar "C:\Program Files (x86)\Android\android-sdk\build-tools\25.0.3\\lib\dx.jar" --no-strict --dex --output= ...
4> trouble writing output: Too many field references: 68102; max is 65536.
4> You may try using --multi-dex option.
4> References by package:
(list of references by packages)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1965,3): error MSB6006: "java.exe" exited with code 2.
Case 2:
Using Android Sdk Location: c:\android\sdk with last proguard version 5.3.3 installed with Android Studio.
4>_CompileToDalvikWithDx:
4> Creating directory "obj\Debug\proguard".
4> C:\Program Files\Java\jdk1.8.0_121\\bin\java.exe -Xmx1G -jar C:\Android\sdk\build-tools\25.0.0\\lib\dx.jar --no-strict --dex --output=
4> trouble writing output: Too many field references: 68102; max is 65536.
4> You may try using --multi-dex option.
4> References by package:
(list of references by packages)
4>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(1965,3): error MSB6006: "java.exe" exited with code 2.
This is likely to be caused by an issue between Xamarin and ProGuard, the fix to which is detailed here. Essentially, you need to replace the proguard.jar file that is in your Android SDK directory with the latest one from SourceForge (v5.3.3 currently).
EDIT: Per the error messages in your edits, the --multi-dex option isn't being passed during compilation. I would check your Android .csproj to make sure that the <AndroidEnableMultiDex> option is set to True for all build configurations. If that doesn't help, you may need to upload a reproducible sample somewhere.
EDIT 2: Per the comments, your Android SDK location needs to be somewhere where the path does not contain spaces. Program Files is no good. Personally I put mine in C:\Android\android-sdk.
After adjusting the path to the android sdk, removing the spaces and setting in the project file for the Droid platform the property AndroidEnableMultiDex in all configurations (appeared AndroidEnableMultipleDex) in true, I was able to compile without errors. Also, I have been able to check the contents of the generated dex files and both have references to Mvvmcross.
When I execute the application, it shows the splash view (ok!!!), but, an exception occurs when processing the view (activity) that has a binded viewmodel. Now, the viewmodel has null value. (Until the moment of having to activate the multidex, the application executed without any incidence)
My challenge now is to know if all the reference to Mvvmcross should be in the main dex, or is it due to another problem that I have overlooked?
Thanks in advance for his time to #LukePothier.
My self response:
After compiling and generate dex classes:
use dex2jar & jd-gui tools following Jon Douglas' hints in http://www.jon-douglas.com/2016/09/23/xamarin-android-multidex-keep/.
be very patient and persevere.
remove innesesary code and plugin if you can do it yourself.
I already have the application running !!!
I am running Delphi 10 Seattle with the Mobile Development Tools.
I have reinstalled the Android Tools/SDK's/NDK multiple times to no avail.
I have never managed to get an android project compiled, i always got various errors, but I've seemed to reach a roadblock with this one :-
I get a total of 1461 when building the project, all are very similar, im putting just 3 below, but will post more if needed.
[DCC Error] E2597
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -ldl
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lc
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe: error: cannot find -lm
And the fatal error :-
[DCC Fatal Error] F2588 Linker error code: 1 ($00000001)
The project itself is just a Hello World Application to test if building is working, i've seen similar errors when using 3rd party libraries in the application, but no fix seemed to help.
I have double checked all file paths in the SDK Manager, and have posted the filepaths below :-
Android SDK 24.3.3 32 Bit
SDK:-
SDK Base Path: C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows
ZipAlign Location: C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\build-tools\22.0.1\ZipAlign.exe
Android Location: C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\tools\android.bat
Adb location:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\platform-tools\adb.exe
Aapt Location:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\build-tools\25.0.2\aapt.exe
SDK API-Level Location:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-sdk-windows\platforms\android-25
NDK:-
NDK Base Path:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c
arm-linux-androideabi-ld.exe Location:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-ld.exe
arm-linux-androidaebi-strip.exe Location :
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\toolchains\arm-linux-androideabi-4.6\prebuilt\windows\bin\arm-linux-androideabi-strip.exe
gbdserver Location :
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\prebuilt\android-arm\gdbserver\gdbserver
NDK API Location :
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\platforms\android-19
C++ Builder NDK Library Path:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\platforms\android-19\arch-arm\usr\lib
Delphi NDK Library Path:
C:\Users\Test\Documents\Embarcadero\Studio\17.0\PlatformSDKs\android-ndk-r9c\sources\cxx-stl\gnu-libstdc++\4.8\libs\armeabi-v7a
Java:-
Keytool Location:
C:\Program Files\Java\jdk1.8.0_66\bin\keytool.exe
Jarsigner Location:
C:\Program Files\Java\jdk1.8.0_66\bin\jarsigner.exe
Thanks in Advance.
I'm not entirely sure how this happened.
But to fix it, I went into the SDK Manager and deleted the entire SDK set and let the installer reinstall it, I had done this previously and had made no changes between attempts, so not sure why it worked, but it did anyway.
I hope this helps someone else.
When I create an android application it reports the following error (formatted for readability):
C:\Program Files\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2):
Error MSB6004: The specified task executable location
"C:\Users\Rashid\AppData\Local\Android\android-sdk\\tools\zipalign.exe"
is invalid. (MSB6004) (newTest)
A search for the error ID, MSB6004, suggests that the fix for this error is to update Xarmin to at least version 3.1.223. The linked question also discusses copying files in C:\Program Files or wherever Xarmin is installed, but in theory that should not be necessary.