Jump to content

pcplayer99

Members
  • Content Count

    93
  • Joined

  • Last visited

Posts posted by pcplayer99


  1. Hello,

     

    I'm testing Python4Delphi . Everything is ok beforeI tested import matplotlib.

     

    My environments are:

    1. Windows 11;

    2. Anaconda, Python 3.11.5

    3. Delphi 11 CE .

    4. Delphi VCL project, target platform is Windows 64.

     

    Here is my test code:

    import matplotlib.pyplot as plt
    import sys
    
    print(sys.version_info)
    print(sys.path)
    
    squares = [1, 4, 9, 16, 25];
    plt.plot(squares);
    plt.grid(True)
    print('Start')
    plt.show();
    print('End')

     

    I have ran this script in PyScripter, it's OK.

     

    In Delphi,I have created a VCL project, and run the python script in it by using: PythonEngine1.ExecStrings(Memo2.Lines); 

    It raise  exception: Project testDrawLine.exe raised exception class $C000008E with message 'c000008e FLOAT_DIVIDE_BY_ZERO'.

     

    I commented out "import matplotlib.pyplot as plt" and the error disappears. I commented out all code but just print code and import matplotlib.pyplot, it raises the same exception. So I am sure the error is caused by "import matplotlib.pyplot".

     

    I have tested add:

    from io import BytesIO
    from PIL import Image

    There is no exception, it works fine.

     

    I have checked the Python version in Delphi project and PyScripter by:

    import sys
    print(sys.version_info)

    And I got the same version info:

    procedure TForm2.Button1Click(Sender: TObject);
    var
      OldControlWord: Word;
    begin
      OldControlWord := Get8087CW();
      Set8087CW($133F);
      try
        PythonEngine1.ExecStrings(Memo2.Lines);
      finally
        Set8087CW(OldControlWord);
      end;
    end;

    sys.version_info(major=3, minor=11, micro=5, releaselevel='final', serial=0)

     

    So, the same python environment, the same python code, works fine in Pyscripter and got exception in Delphi VCL project.

     

    I searched online and found this: https://stackoverflow.com/questions/3933851/nan-giving-an-error-depending-on-python-startup

    So, I test this code below, but it raises the same exception:

    procedure TForm2.Button1Click(Sender: TObject);
    var
      OldControlWord: Word;
    begin
      OldControlWord := Get8087CW();
      Set8087CW($133F);
      try
        PythonEngine1.ExecStrings(Memo2.Lines);
      finally
        Set8087CW(OldControlWord);
      end;
    end;

     

     

    Did I miss something that cause this exception?

     

    Thanks.


  2. Delphi 10.4.2 CE;

    Windows sybsystem for Android;

    ADB connect 127.0.0.1:58526;

     

    And then...

    New a FMX porject, select target platform as Android 64, named it as: "test"

    In Delphi IDE, I can see a Android device named: Subsystem for Android(TM);

    Selected it, and the F9 run it, after build and package, finally I got a error message: "Your Android device does not support the selected target platform architecture.".

     

    To check the project's folder, there is a test.apk file. I use ADB install test.apk and it successed. Then I can find my test program in Windows's startup menu, and can get it run well.

    How to get Delphi IDE  install and debug with WSA ?

     

    if I select target platform as Android 32, and use ADB install, it can install sucessed, but if I run it, it just show the default splash image.


  3. Hi,

     

    Please read:

    http://docwiki.embarcadero.com/Libraries/Berlin/en/FMX.Types.TLang

     

    It says:

    There are special cases where switching between languages does not work as expected if the language that you switch to is English (en). As a workaround, we recommend that you use LoadLangFromStrings instead of setting TLang.Lang to switch between languages at run time. 
     

    So, you can save your language file as a text file, it's contain is key=value format.

     

    One language, one file. If you want changes the language, load another file.


  4. myabe you should check the AndroidManifest.template.xml of your project.

    and check:

     

    <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />
     


  5. it's wired.

     

    I have done "deploy"  and got my "ipa" file on 2022-2-22;

    And then I install email tool "Thunderbird" in my MAC, and then install "Transporter" for upload my ipa.

    And then in "transporter" I add my ipa and click the "check" button, it popup an error message that the icon included Alpha channel.

    So, I update my icons, and then rebuild my app in Delphi, and then deploy it, and I got error message like "xcodebuild[863:7522] CFURLRequestSetHTTPCookieStorageAcceptPolicy_block_invoke: no longer implemented and should not be called".

     

    I try to do deploy again and again, restart my MAC, restart my Delphi, it is aways show me the same error message, I search on Internet and I find this thread.

     

    Today, I have do nothing with my Delphi and my Mac, and I try again, It did deploy successfully, I got a new ipa file, and I upload this new ipa file with using Transporter successfully.

     

    So, it's wired. I don't know why.  


  6. Make sure your certificate is valid. And the certificate of "ios_development.cer" is the new version.

     

    In your mac system, this ios_development maybe not be expired, but just is a low version. You can download a new version on Apple's developer web page.


  7. Found reason.

     

    This error message is caused by my sqlite db file: "My.db" has not installed into iPhone.

     

    It's my fault.

     

    The reason is that in Delphi IDE deployment windows, add a file, at the "Remote Path", mouse click and drop down, only one item: ".\assets\internal". So I select this item. I know this item is ok when release Android App.

     

    In iOS, it must be: ".\StartUp\Documents\"


  8. Hello,

     

    I'm testing if I can debug in iOS, this is my first experience of iOS.

     

    Delphi 10.4.2, FireMonkey, FireDAC, SQLite,

     

    iOS 15.2

     

    Just a test, my code like:

      FDConnection1.Close;
      S := TPath.Combine(TPath.GetDocumentsPath, 'My.db');  //for Android
      FDConnection1.Params.Database := S;
      FDConnection1.Open;  
     
      FdQuery1.Open;
      FdQuery2.Open;

     

    FdQuery1.SQL.Text := 'select * from MyTable';

     

    in Delphi IDE deployment window, this 'My.db' is in "Remote Path" -- ".\assets\internal\"   -- in Android and iOS, there is the same content.

     

    if the target is Windows or Android, it can work fine.

     

    if the target is iPhone, when it runs step to FdQuery1.Open, Delphi raise an exception message: 

    Project Project1 raised exception class ESQLiteNativeException with message '[FireDAC][Phys][SQLite] ERROR: no such table: MyTable'.

     

    The PAServer in MAC shows these messages:

    error: Project1 :: Class 'TFDDatSManger' has a base class 'Firedac::Dats::TFDDatSNamedObject which does not have a complete definition.

     

    So, there must be some things I have missed ?

     

    Thanks.

     

     


  9. Hi Dmitry,

    My new progress:

     

    Yesterday I have tested Android API-level 30 at a new blank FMX project, it's OK.

    And then I have tested a old project at release mode, it still report the same error message: INSTALL_PARSE_FAILED_NO_CERTIFICATES

    But if I selected debug mode, the same old project can install successed at API-level 30.

     

    I  compared all XML files of release mode and debug mode but can not find anything. But if I change API-level 30 to 29 at release mode, it can installed successed.

     

    Finally, I created a new project and added all files of the old project into it, and then at Android release mode, changed API-level to 30, builded and deployed to my phone, it was successed.

     

    thanks Dmitry.


  10. In good old days, my manifest  like this:

        <application android:persistent="%persistent%" 
            android:restoreAnyVersion="%restoreAnyVersion%" 
            android:label="%label%" 
            android:debuggable="%debuggable%" 
            android:largeHeap="%largeHeap%"
            android:icon="%icon%"
            android:theme="%theme%"
            android:hardwareAccelerated="%hardwareAccelerated%"
            android:resizeableActivity="false"
    		android:usesCleartextTraffic="true">

     

    And it can access web server through "HTTP" in Android.

     

    but Android 11, I don't know.


  11. Thanks Dmitry.

     

    It works!

     

    A little update:

    <Exec Command=""$(ApkSigner)" sign --ks $(KeyStoreFile) --ks-pass pass:$(KeyStorePass) $(SIGNED_APK_FILENAME)" ContinueOnError="True">

    when open project, it shows a error message, and then fail.

     

    I look through carefully the CodeGear.development.Targets file, found that:

    <Exec Command="&quot;$(BDS)\bin\convert.exe&quot; -b -e.fsx &quot;%(ConvertForm.BaseName)&quot;" ContinueOnError="True">

    <Exec Command="&quot;$(BDS)\bin\convert.exe&quot; -b -e.fsx &quot;%(ConvertForm.BaseName)&quot;" ContinueOnError="True">

     

    So, I update the above line to:

    <Exec Command="&quot;$(ApkSigner)&quot; sign --ks $(KeyStoreFile) --ks-pass pass:$(KeyStorePass) $(SIGNED_APK_FILENAME)" ContinueOnError="True">

    And open project successed.

     

    And then I can install APK to my phone after I update android:targetSdkVersion="30" 

     

    Thanks a lot.


  12. Thanks Vave.

    According to your tips, I googled on line and got this: 

    xamarin.android - Xamarin App - Can't deploy to Android 11 emulator - Stack Overflow

     

    Its says that:

    "Apps that target Android 11 (API level 30) that are currently only signed using APK Signature Scheme v1 must now also be signed using APK Signature Scheme v2 or higher. Users can't install or update apps that are only signed with APK Signature Scheme v1 on devices that run Android 11."


  13. I have installed Delphi 10.4.2 CE version. All configurations is default by delphi installer.

    My phone is OPPO and its Android version is Android 11.

     

    New a FireMonkey project, connected my phone to my PC, and run it, everythiing is OK.

     

    But if I upload this APP to Google play APP store,  it says APP's API level is 29, it must be API level 30.

     

    I run "C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203\SDK Manager.exe“, it is installed by Delphi. And there are Android 10 (API 29), Android 9(API 28) ... etc. There are no API 30.

     

    So, I run "C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203\tools\bin\sdkmanager.bat" to download API 30 and its done.

    And then re-start "SDK Manager.exe", I can see "Android 11(API 30)" in it.

    And in this directroy "C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203\platforms", there was added a directory named "android-30". So it seems I have API 30 in my system.

     

    In Delphi IDE menu: Tools - Options - Deployment - SDK Manager, SDK API-level location option is set by Delphi, it is "C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203\platforms\android-29", I changed it to "C:\Users\Public\Documents\Embarcadero\Studio\21.0\CatalogRepository\AndroidSDK-2525-21.0.40680.4203\platforms\android-30";

     

    And then re-deploy this APP and upload to Google play, it still says my APP is on API 29.

     

    I can not find any tips in IDE menu to change API level, so I check "AndroidManifest.xml" under "D:\MyProjectFile\Android64\Release", there is:

    <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" /> 

     

    I try to modify "D:\MyProjectFile\AndroidManifest.template.xml" from default:

    <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="%targetSdkVersion%" />

    to:

    <uses-sdk android:minSdkVersion="%minSdkVersion%" android:targetSdkVersion="30" />

    to force it be API-30.

    And re-build, deploy, and then upload to Google play, it works. No warning messages.

     

    But, if I set project's "Configuration" to "Development" in IDE and press F9 to let it run in my phone, when it is installing in my phone, it is failed, and Delphi shows error message: adb: failed to install D:\MyProjectFile\Android64\Debug\testAndroid_11\bin\testAndroid_11.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

     

    And then I change "AndroidManifest.template.xml" to default, and re-build and deploy and press F9, it has installed in my phone success and worked fine. And then I check "AndroidManifest.xml", it is "<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="29" /> " again.

     

    Repeat modify "AndroidManifest.template.xml" again and again, I'm sure if I set targetSDKVersion=29, it can install in my phone successed, if I changed it to targetSDKVersion=30, it install in my phone will be failed and the error message is: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES].

     

    If I change targetSDKVersion=29 to targetSDKVersion=30,  and then set my project Configuration to "Application Store"  build and deploy then I got my AAB file and can upload Google play successed, but I am not sure if it can installing success when a phone install it from Google play.

     

    I have searched on internet, but no any message about this.

     

    SDK_Manager.jpg

    development.jpg

×