Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Black Screen after obfuscating with proguard

Discussion in 'Unity Ads & User Acquisition' started by wolfgangpue, Nov 18, 2014.

  1. wolfgangpue

    wolfgangpue

    Joined:
    Nov 18, 2014
    Posts:
    2
    Hi,
    In my debug version Unity Ads works without problems. Also in my release version with proguard deactivated. But when I use proguard to obfuscate the code the screen turns black after call show().

    I copied all proguard settings to the end of my proguard-settings.txt. (see attachment)
    No error is thrown. Debug output looks normal. In the attachment you can find the debug ouput from unityAds.

    Do you have any clue what I can change?

    Best Regards
    Wolfgang
     

    Attached Files:

  2. unity-nikkolai

    unity-nikkolai

    Unity Technologies

    Joined:
    Sep 18, 2014
    Posts:
    540
    I've heard there were issues when using ProGuard with Unity Ads enabled apps. I'll need to look into this further to see if there's a solution when using the current SDK. I'll be in touch soon. Ping me in a private conversation if I don't get back to you in the next day or so.
     
  3. wolfgangpue

    wolfgangpue

    Joined:
    Nov 18, 2014
    Posts:
    2
    With black screen I mean the black gradient, which shows up before the "buffer video" - message appears.
     
  4. unity-nikkolai

    unity-nikkolai

    Unity Technologies

    Joined:
    Sep 18, 2014
    Posts:
    540
    I've been researching this, but haven't come up with a solution yet. I'll keep you posted.
     
  5. JohnRivet

    JohnRivet

    Joined:
    Sep 18, 2012
    Posts:
    7
    I seem to be experiencing a similar problem, I do have some debug output though.

    I'm using signed apks exported from Eclipse. Our app is mainly native code, with Java code for interfaces to cloud save, advertising SDKs etc. With proguard disabled, I see an ad and all seems fine.
    However, with proguard enabled - and all the entries from unity-ads/proguard-project.txt copied into my proguard-project.txt - when I try to display an interstitial, I see a black screen.

    At the black screen; the back key does not back out of it. The home key takes us home, but switching back to our app takes us back to the black screen.

    Here's the relevant parts of the adb tty:

    [first there's some tty from our native code handling APP_CMD_PAUSE, APP_CMD_LOST_FOCUS, APP_CMD_TERM_WINDOW]

    I/ActivityManager( 552): Displayed com.<redacted>/com.unity3d.ads.android.view.UnityAdsFullscreenActivity: +554ms
    I/WindowManager( 552): Screen frozen for +555ms due to Window{ded877 u0 com.<redacted>/com.unity3d.ads.android.view.UnityAdsFullscreenActivity}


    [here there's some tty from our native code handling APP_CMD_SAVE_STATE, APP_CMD_STOP
    and FlurryAgent reporting end of our session]


    I/chromium(13036): [INFO:CONSOLE(4367)] "en", source: http://cdn.applifier.com/impact/web...sion=8c7b2d783620c438df71809dbf439f010beee374 (4367)
    I/chromium(13036): [INFO:CONSOLE(5770)] "Resize handler called", source: http://cdn.applifier.com/impact/web...sion=8c7b2d783620c438df71809dbf439f010beee374 (5770)
    I/chromium(13036): [INFO:CONSOLE(5842)] "Uncaught TypeError: undefined is not a function", source: http://cdn.applifier.com/impact/web...sion=8c7b2d783620c438df71809dbf439f010beee374 (5842)
    I/art ( 552): Explicit concurrent mark sweep GC freed 30396(1546KB) AllocSpace objects, 7(112KB) LOS objects, 33% free, 28MB/42MB, paused 2.441ms total 143.323ms

    At this point, we're at the black screen.

     
    unity-nikkolai likes this.
  6. JohnRivet

    JohnRivet

    Joined:
    Sep 18, 2012
    Posts:
    7
    Actually, the screen is not totally black, its graduated from black at one end to grey at the other.

    The above tty was from Nexus 4 running Android 5.0.1
    On A Samsung S3 running Android 4.3, relevant tty is rather different. Extracted from the Sammy's spammy tty:

    [just prior to tty from our native code handling APP_CMD_LOST_FOCUS]

    V/webkit (15195): BrowserFrame constructor: this=Handler (android.webkit.BrowserFrame) {42654bd0}
    D/WebView (15195): loadUrlImpl: called
    D/webcore (15195): CORE loadUrl: called
    D/webkit (15195): Firewall not null
    D/webkit (15195): euler: isUrlBlocked = false


    [then, a little after tty from our native code handling APP_CMD_SAVE_STATE, APP_CMD_STOP
    and FlurryAgent reporting end of our session]

    D/WebView (15195): loadUrlImpl: called
    I/power ( 2347): *** release_dvfs_lock : lockType : 1
    D/SSRMv2:CustomFrequencyManagerService( 2347): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT frequency : 1200000 uid : 1000 pid : 2347 tag : ACTIVITY_RESUME_BOOSTER@8
    D/SSRMv2:Monitor( 2347): SIOP:: AP = 300 (read only)
    D/webcore (15195): CORE loadUrl: called
    D/webkit (15195): Firewall not null
    D/webkit (15195): euler: isUrlBlocked = false
    I/Web Console(15195): en:4367
    I/Web Console(15195): Resize handler called:5770
    E/Web Console(15195): Uncaught TypeError: Object [object Object] has no method 'handleWebEvent':5842


     
    unity-nikkolai likes this.
  7. unity-nikkolai

    unity-nikkolai

    Unity Technologies

    Joined:
    Sep 18, 2014
    Posts:
    540
    That last tidbit about the gradient is actually pretty helpful. It tells me that Unity Ads is working, but that it's unable to retrieve or load the video content. Which may be due to the obfuscation of code.

    If you can avoid obfuscating any of the Unity Ads code, you may be able to avoid this issue. I'll look into this further and report back what I find out. Thanks for the additional info.
     
  8. JohnNotRivet

    JohnNotRivet

    Joined:
    Nov 21, 2012
    Posts:
    4
    Epilogue - thanks, but as we can't release un-obfuscated code, we did not implement Unity Ads for this reason.
     
  9. HeikkiTunkelo

    HeikkiTunkelo

    Unity Technologies

    Joined:
    May 13, 2014
    Posts:
    104
  10. RurouniGPL

    RurouniGPL

    Joined:
    Sep 23, 2015
    Posts:
    5
    Hi! Something similar is happening to me when I try to implement UnityAds in an Android Game (OpenGL, MOAI Framework): when I try to show the video, the screen turns black and I can't go back.

    This is de debug output at the start of the app:


    And the output when I show the VideoAd:
    I added all the "proguard-project.txt" to my proguard file, but it doesn't seem to work...

    Thank you!