Dismiss Notice

REGISTRATION IS AFTER ADMIN ACTIVATION

DONATIONS WITH PAYPAL CLICK TO BUTTON

1 MONTH VIP - 5$; 3 MONTHS VIP - 10$; 6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$

DONATIONS WITH Bitcoin Address:3NRs3CK3fhXifrNYxHEZKpETDd9vNLMsMD

Dismiss Notice
The registration is approved by the Administrator. It takes about 1 day to approve your registration
Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

Android: Blank Screen on Emulator Solved

Discussion in 'Delphi Android And IOS' started by N0body, Jan 1, 2014.

  1. N0body
    Online

    N0bodyN0body is a Verified Member DelphiFan Administrator Staff Member DF Staff

    One common problem of the Android Emulator is, that it is not usable with Delphi's FMX library. The result of a deployed application is a crash. To get the thing work, there must be done two things.




    First: Delphi's FMX uses OpenGL and therefore the libraries must be available. This could be accomplish by adding the line below the the System PATH variable of Windows.


    Code:
    ;...\sdk\tools\lib
    An other way to make the OpenGL files available for the emulator is to copy the DLL files


    libEGL_translator.dll
    libGLES_CM_translator.dll
    libGLES_V2_translator.dll
    libOpenglRender.dll


    from


    C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\tools\lib


    to


    C:\Users\Public\Documents\RAD Studio\12.0\PlatformSDKs\adt-bundle-windows-x86-20130522\sdk\tools\


    Now, this change would avoid the black screen issue of an empty form.




    Second: Take sure the setting "Use Host GPU" is on. The default Android Virtual Device "rsxe5_android" doesn't have this setting, at least I did not found it. So, just create a new AVD.


    [img=345x600]http://i41.tinypic.com/nx2us6.png[/img]



    Now, this change would avoid the white screen issue of an empty form.


    After these two change every FMX Application should be runable on the Emulator. Useless to say that it's recommended to use a SSD, otherwise you get sick from to much coffee while waiting for response.
     
  2. Proof
    Offline

    Proof DF Junior

    Thank you man  8)  You are the BEST !
     
  3. Ratthain
    Offline

    Ratthain DF Member

    Hi,,

      I use Delphi XE5 .  What is the library name to quote follow USES clause?

    I write an opengl  with delphi  by put  "OPENGL" within USES..  Now I ported to android and write with firemonkey android.  There're errors, firemonkey don't know OPENGL syntax in USES clause.

    As I read document. OpenGL is not available in Firemonkey android.
     
  4. N0body
    Online

    N0bodyN0body is a Verified Member DelphiFan Administrator Staff Member DF Staff

    Firemonkey provides an abstraction layer.
    [/size]

    [font=arial, liberation sans, dejavu sans, sans-serif][/size]So on Windows your using DirectX and on OSX and iOS your using OpenGL/Quartz. On windows it's also possible for things to fall back to GDI+[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    Given this one must take into account that the rendering destination may not always be OpenGL, and it may not always be the same even on the same platform.[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    TCanvas in part of this abstraction layer.[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    There are 3 current implementations of TCanvas, your application may be using any of these.[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    FMX.Canvas.D2D.pas - Direct2d[/font]
    [font=arial, liberation sans, dejavu sans, sans-serif]
    FMX.Canvas.GDIP.pas - GDI+[/font]
    [font=arial, liberation sans, dejavu sans, sans-serif]
    FMX.Canvas.Mac.pas - Mac[/font]
    [font=arial, liberation sans, dejavu sans, sans-serif]
    The platform implementation details are typically hidden in private sections are are not accessible.[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    You also have TPlatform in FMX.Platform.pas which HIDE-THANKSs the implementation details and publishes a single API (limited in scope) that is designed to work on all platforms.[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    If you use FMX.Platform.Win.pas you can get the windows handle for a given TFmxHandle[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    If you use FMX.Platform.Mac.pas you can get the IObjectiveC for a given TFmxHandle[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]
    However on IOS there is no equivalent function in FMX_Platform_iOS.pas[/font]

    [font=arial, liberation sans, dejavu sans, sans-serif]

    After some investigations I have managed to create OpenGL context in FireMonkey on Windows platform. I don't have access to iOS yet, but I'm sure something can be done there as well.


    To the solution: add FMX.Platform.Win to uses clause (might need to wrap it into IFDEF's for iOS). Now we can use FmxHandleToHWND(Form1.Handle) to get valid HWND. Thats it. On MacOS the same is done by adding FMX.Platform.Win and through H_WND := FmxHandleToObjC(AHandle); call.
    [/font]
     
  5. Ratthain
    Offline

    Ratthain DF Member

    :D Wow.. thank you very much..    King of delphi. 

    I wrote an opengl app with Delphi 7, and now I compile the same source code with Delphi XE5.  Everything is ok. No problem.  but not try on firemonkey for win yet.. 

    My goal is to port source code and compile with firemonkey Android.  As I research. for example I want to draw 3d lines on Android.  There are few ways:
    1. OpenGL ES  - This is the point how can I write 3D apps with opengl function in firemonkey android.
    2. Use 3D component (only Cube,Cone,sphere ,etc...  but can not draw 3d lines, also slow .
    3. Low level 3d -  (FMX.type3d Unit) it work now. but still only work within event  Form1.DoRender. 


    If my goal is to Draw continuous 3d lines in android app.  What should I do?
     
  6. mabudaff
    Offline

    mabudaff DF Member

    Hi guys,
    I had the same problem. My app would run on my device, but in the emulator I got just a black screen. The emulator itself did run the Android environment, but when I selected the app from the installed apps, same thing: black screen.
    I was able to solve this by setting hw.gpu.enabled=yes in the following way:
    Windows Start -> All Programs -> Embarcadero RAD Studio XE5 -> Android Tools
    From the menu, select Tools -> Manage AVDs. Select the rsex5_android VM, then Edit.
    Then under Hardware, click New, select "GPU Emulation", OK
    This will add an entry "GPU emulation" that is default "no"; set it to "yes" and click "Edit AVD".
    Then restart the Android emulator.
    After this, my app worked.

    Majdy Abudaff
     
  7. SharLo
    Offline

    SharLo DF Member

    thanks
     

Share This Page

Laws
Our website, law, laws, copyright and aims to be respectful of individual rights. Our site, as defined in the law of 5651 serves as a provider of space. According to the law, contrary to the law of site management has no obligation to monitor content. Therefore, our site has adopted the principle of fit and remove. Works are subject to copyright laws and is shared in a manner that violated their legal rights, or professional associations, rights holders who, adsdelphi@gmail.com I can reach us at e-mail address. Complaints considered to be infringing on the examination of the content will be removed from our site.
Donate Help To Us and Be VIP
DONATIONS WITH PAYPAL CLICK TO BUTTON
6 MONTHS VIP - 20$; 1 YEAR VIP - 30$; 2 YEARS VIP - 50$; GOLD USER FOR LIFE VIP - 150$
Social Block