stlport_shared.so not getting pushed onto the device - android-ndk-r5

I am defining Application.mk
APP_STL := stlport_shared
When I run ndk-build which in turn producing file: stlport_shared.so in obj/local/armeabi/
but it is not copying this file to libs/armeabi/
Because of which it doesn't get copied to the device and
System.loadLibrary() throws UnsatisfiedLinkError.
Can anyone help?

It should be mentioned in the Application.mk as:
APP_MODULES := stlport_shared.so other_dependent.so
In ordered to be copied to the device.

I believe you need to include something like following in your Android.mk file:
include $(CLEAR_VARS)
LOCAL_MODULE := stlport_shared
LOCAL_SRC_FILES := stlport_shared.so
include $(PREBUILT_SHARED_LIBRARY)

I had to add a line to my java file to load it:
System.loadLibrary("stlport_shared");
System.loadLibrary("my_lib");

As Nishant said, you need to use:
APP_STL := stlport_shared
APP_MODULES := stlport_shared mymodule ...
APP_STL ensures use of STLport, while APP_MODULES ensures its copied where needed.
Its a bug that stlport_shared is not copied as needed. See Android Issue 21180: APP_STL := stlport_shared doesn't install libstlport_shared.so into libs directory. It should be fixed in NDK R7b.

Related

How to set the working directory using JCL's TJclCommandLineTool?

I'm using the JCL Delphi library in my project. Below is my code.
// uses JclSysUtils;
var cmd := TJclCommandLineTool.Create(parts[0]);
if cmd.Execute(params) then
begin
...
end;
As you can see, I use TJclCommandLineTool to invoke an external command line program. The problem is that the external program is always running in the current directory that I started my application. I want to know how can I pass a custom working directory to the external program. JCL's document is pretty lame and I can't find related information.
TJclCommandLineTool does not have options like this. So easiest way to do it:
//uses System.IOUtil;
var oldDir := TDirectory.GetCurrentDirectory;
try
TDirectory.SetCurrentDirectory(ANewProgramDir);
var cmd := TJclCommandLineTool.Create(parts[0]);
if cmd.Execute(params) then
begin
// ...
end;
finally
TDirectory.SetCurrentDirectory(oldDir);
end;

Delphi: Unzipping Files using FlexCompress (3rd-Party-Component)

I am having trouble unzipping files using the Delphi 3rd Party component FlexCompress. Here is the Code, detailed explanation after the code:
MyZipReader := TFlexCompress.Create(myComponent);
MyZipReader.Name := 'MyReader';
MyZipReader.FileName := DataPath; //e.g. C:\Users\thisUser\AppData\Local\Temp\ThisTempFolder\ThisZip.zip
MyZipReader.OpenArchive(fmOpenRead);
MyZipReader.BaseDir := BasePath; //e.g. C:\Users\[...]\ThisTempFolder\UnzipHere\
MyZipReader.CreateDirs := TRUE;
MyZipReader.ExtractCorruptedFiles := TRUE;
MyZipReader.ExtractFiles := ('*.*');
MyZipReader.closeArchive;
All files will be extracted and placed accordingly, so that's OK.
BUT: All files are empty. No text no nothing.
I have no idea what I am doing wrong. If I extract an archive I packed with Flexcompress everything is OK but if I try this with an external archive this behaviour occurs. Is there some sort of switch I am missing? I would be grateful about every tip or idea! I also tried the options ReplaceReadOnly and overwriteMode. Did not help and I am out of Ideas. If anyone knows some sort of FlexCompress forum I would also appreciate a link, maybe I could find info there? Sadly componentAce does not seem to host something like this.
Edit(2021.12.14 - 1.17pm)
Extra information gathered in the process:
One should not set the ExtractCorruptedFiles property to TRUE. This will prevent the eventhandler from raising an exception within the extractFiles() procedure

Frank Shearar SIP Component

I am looking at the demo program by Frank Shearar and cannot build the demo program. I fixed up all the references to "missing files" and the last errors that I am trying to fix are related to differences in the interface in classes and how they are used now...
Self.CalleeMedia := TIdSDPMultimediaSession.Create(Self.Profile);
vs
Self.CalleeMedia := TIdSDPMultimediaSession.Create(Self.Profile, ???, ???);
I know the interface now looks like....
constructor TIdSDPMultimediaSession.Create(Profile: TIdRTPProfile;
Factory: TIdSdpMediaStreamFactory; ExecutionContext: TIdTimerQueue);
and I could just add...
x := TIdSdpMediaStreamFactory.Create;
y := TIdTimerQueue.Create;
and pass these in? Or pas nil in both cases. There are a few other places where I get similar errors when building the demo program. Do I just need to create other objects that are required? If not, what additional steps are needed? Any assistance to get me started would be great.
Thanks,
I suspect I simply forgot to update the demo in line with the SDP API's interface!
Create the TIdSdpMediaStreamFactory and TIdTimerQueue before instantiating the TIdSDPMultimediaSession.
In particular, take a look at how the test case is set up, in test\TestIdSdp.pas:
procedure TestTIdSDPMultimediaSession.SetUp;
begin
inherited SetUp;
Self.Factory := TMockMediaStreamFactory.Create;
Self.Profile := TIdAudioVisualProfile.Create;
Self.Timer := TIdThreadedTimerQueue.Create(false);
Self.MS := TIdSDPMultimediaSession.Create(Self.Profile, Self.Factory, Self.Timer);
Self.PortBlocker := TIdMockRTPPeer.Create;
// We only instantiate Server so that we know that GStack points to an
// instantiated stack.
Self.Server := TIdUdpServer.Create(nil);
end;
Demo project can not be compiled. He has a lot of links to test* files. Also all the factory's was declared at the test project.

Delphi 7 -> Unable Loading an Image from a Resource file

I've been looking hours over the net, using Google, trying for PDF's and still unable
to load an Image resource in Delphi 7..
My test.rc file goes like this:
1 RT_BITMAP "1.bmp"
I've added the test.rc file to my project using Project->Add to Project.. which compiled a test.res file upon build and seems to have automatically included the .res file into my project (because using the {$R test.res} would say I already use that resource). I also tried removing the test.res from the project using Project->Remove from Project.. and manually adding the {$R test.res} to my project.
However no matter how I include the test.res file..
I get the
Project Project2.exe raised exception
class EAccessViolation with message
'Access violation at address 00408D0C
in module 'Project2.exe'. Read of
address 00000001'. Process stopped.
Use Step or Run to continue.
at First I used
Image1.Picture.Bitmap.LoadFromResourceID(hInstance,1);
Because this is what I found using Google. And I got this error.
Later I tried
procedure TForm1.Image1Click(Sender: TObject);
var bBitmap : TBitmap;
begin
bBitmap := TBitmap.Create;
try
bBitmap.Handle := LoadBitmap(hInstance, '1');
Image1.Width := bBitmap.Width;
Image1.Height := bBitmap.Height;
Image1.Canvas.Draw(0,0,bBitmap);
finally
bBitmap.Free;
end;
end;
This didn't get me any errors, and nither did it show the image so the problem remains unsolved..
I'm a newbie to the use of Resources but I must load some images into resources before I release my project so the .BMP files won't be tempered with...
any help would be highly appreciated!
I reproduced exactly your same problem in a test program.
I then changed RT_BITMAP to BITMAP, recompiled RC and tested.
It works.

Connecting to Firebird embedded on D2010

I downloaded the Firebird DBX driver from http://sites.google.com/site/dbxfirebird/ and I've been able to compile the "Test Connection" project and get it to run. I pointed it to my test DB like so:
procedure TMainForm.Button1Click(Sender: TObject);
var C: TSQLConnection;
begin
C := TSQLConnection.Create(Self);
try
C.DriverName := 'FirebirdConnection';
C.Params.Add('User_Name=SYSDBA');
C.Params.Add('Password=masterkey');
C.Params.Add('Database=C:\fbtest\test.fdb');
C.Open;
if C.Connected then
ShowMessage('Connection is active')
finally
C.Free;
end;
end;
When I run it, it works fine. But when I put that exact same code in a different project, it doesn't work. I've copied the fbclient.dll (Firebird embedded driver DLL, renamed to fbclient), all of its dependencies, and the dbxdrivers.ini file to the same folder as the project's EXE is running in. I can't see any reason why this shouldn't work, but the call to .Open fails with:
Project Project1.exe raised exception
class TDBXError with message 'Unknown
driver: FirebirdConnection'.
Again, this is on the call to Open. The assignment to DriverName works just fine. Has anyone seen this problem before? Why does the exact same code work in the test project but not a different one, and is there any way I can fix it?
I found the problem. A loading class to set up the database driver had to be registered in the initialization section of DBXDynalink.pas. The test project included DBXDynalink in its uses clause, where mine didn't. I put that in and now it works.
This error generally occurs when you don't add the respective DBX driver unit to your uses list. Try adding DBXFirebird to your uses list.
Just change
C.DriverName := 'FirebirdConnection';
to
C.DriverName := 'Firebird';
and will work!

Resources