Errors when compiling Android RenderScript samples - android

I get the following errors when I try to compile any Android RenderScript sample code (SDK version 11).
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:35:33: error: unknown type name 'rs_matrix4x4'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:40:33: error: unknown type name 'rs_matrix3x3'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:45:33: error: unknown type name 'rs_matrix2x2'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:55:27: warning: declaration specifier missing, defaulting to 'int'
[2012-02-03 16:49:33 - CarouselExample] /Library/android-sdk-macosx/platforms/android-13/renderscript/include/rs_core.rsh:88:71: error: unknown type name 'float2'; did you mean 'float'?
...
I've searched around to see if others are having similar issues.
This post Renderscript samples build errors for example mentions that the /renderscript directory in Android-11 to Android-13 needs to be updated with the contents of the /renderscript directory from Android-14+. I have all the SDK versions from 2.1 to 4.0.3 and there's no:
/platforms/android-14/renderscript
directory. I am able to build and run my projects that don't use RenderScript.
Has anyone found a solution for this? Or can someone tell me what I'm doing incorrectly here? I just select File>New>Android Project>Create project from existing sample. If I select any RenderScript samples I'm unable to compile the project.
I've also noticed that the /raw directory (sibling directories of layout, drawable, etc.) initially comes with a file (in my case carousel.bc), but when I compile, this file is deleted - which doesn't seem right to me.
Thanks for you help!

So after some more digging around. I decided to install the Google APIs for the Android-11 SDK and that seemed to fix things. There was still one syntax error I had to fix in the carousel.rs file.
cards[i].cardVisible = (p >= visibleFirst && p < visibleLast)
|| (p <= visibleFirst && p > visibleLast);
The last two parentheses need to be added.
Wish I would have been able to find this out from the Android developer site. Nowhere does it say the "Google API's by Google" need to be downloaded in order to compile RenderScript.

Related

Embarcadero RAD Delphi 10.3.3, cannot compile my app with Box2D library for 64-bits Android

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

Unordered_map declaration throws error with NDK (clang), works fine with gcc

I'm trying to run a C++ project on Android. The following statement appears in one of the source files (part of a big project).
std::unordered_map <int, std::shared_ptr<Frame>, std::hash<int>, std::equal_to<int>,
Eigen::aligned_allocator< std::pair<const int, std::shared_ptr<Frame> > > > idToKeyFrame;
The NDK build complains the following
sysroot/usr/include/c++/v1/unordered_map:1684:5: error: static_assert failed due to requirement 'is_same<value_type, typename allocator_type::value_type>::value' "Invalid allocator::value_type"
I cannot spot what part of declaration is incompatible. Please help in fixing this error.
cplusplus.com reference
Update
When I modify the allocator (as suggested in comment by Marc) to Eigen::aligned_allocator<std::pair<int, std::shared_ptr<Frame>>> The error message remains the same but line number changes
sysroot/usr/include/c++/v1/unordered_map:854:5: error: static_assert failed due to requirement 'is_same<value_type, typename allocator_type::value_type>::value' "Invalid allocator::value_type"
Update++
According to this answer :
libstdc++ does not static_assert, libstdc++ ignores the exact type of the allocator and rebinds it to the container's value type.
and
Clang/libc++ are not forgiving
Yet another Update
I have been able to go past the error by commenting out the line in the source for unordered_map. This is a resort for now (until I get a solution).

Xamarin MultiDex in VisualStudio 2015

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 !!!

Linking Error compiling/Building Delphi XE7 & XE10 Android App (SQLITE3)

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.

Error building openframeworks for android: “ invalid use of incomplete type ‘class Poco::Path’”

I am trying to build an android application with OF. The application runs in two other computers. However, it does not work on mine. I am using a mac.
I run the command "make AndroidDebug" in the project folder, and this is the error I have:
/Library/openFrameworks/addons/ofxHTTP/libs/ofxHTTP/src/PostRouteFileHandler.cpp:98:46: error: invalid use of incomplete type 'class Poco::Path'
ss << Poco::Path(formFileName).getExtension();
I have installed poco, but nothing changes afterwards.
What can I do to solve this?
Thanks
Have you included Poco/Path.h?
A forward declaration might appeared earlier (possibly in another header) without complete definition.

Categories

Resources