java.lang.IllegalArgumentException: View not attached to window manager

Sorry not very familiar with Android devices so does anyone have an idea what the following error is related to? The result of this error is that a customer download is not being verified (i.e.; keeps getting licensing failed). Thanks in advance.

java.lang.IllegalArgumentException: View not attached to window manager

at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:653)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:349)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
at android.app.Dialog.dismissDialog(Dialog.java:319)
at android.app.Dialog.dismiss(Dialog.java:302)
at android.app.Dialog.cancel(Dialog.java:1104)
at com.ansca.corona.Controller$4.run(Controller.java:745)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:788)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:555)
at dalvik.system.NativeStart.main(Native Method)

Hi @jacques1,

Thanks for the error report, but I think we’ll need more information about what your app is doing. Can you please post the contents of your build.settings so we can inspect things like plugins, permissions, etc.?

Thanks,

Brent

settings = { plugins = { ["CoronaProvider.gameNetwork.apple"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, iphone = { plist = { UIPrerenderedIcon = true, UIStatusBarHidden = true, UIApplicationExitsOnSuspend = false, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, UILaunchImages = { { -- iPhone 4 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "5.1", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 5 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeRight ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPhone 6 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 Plus LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{414, 736}" }, }, CFBundleIdentifier = "com.vdvgames.zwar", CFBundleDisplayName = "WOTZ", UIAppFonts = { "boston.ttf", "eurobold.ttf", "final.ttf" } }, }, android = { largeHeap = true, usesExpansionFile = true, versionCode = "127", usesPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", "com.android.vending.CHECK\_LICENSE" }, }, orientation = { default = "landscape", supported = { "landscape", "landscapeRight", "landscapeLeft", }, } }

It doesn’t seem like every android user had this issue when downloading as many user managed to install and play without issue, but it’s strange some have encountered this error with licensing even after many many attempts to re-download. appreciate any feedback.

Hi @jacques1,

I just recalled something which I’m helping another user with, which may be the same thing you’re working through. Please see this forum thread:

http://forums.coronalabs.com/topic/52429-android-expansion-file-not-licensed-error/#entry272564

Thanks,

Brent

Thanks for the reply Brent. However the licensing in my game is set up correctly as almost all users have no problems (from what I gather and see in the google dev console) with downloading and installing. So I don’t know if this is device specific, or rooted device issue, or a user attempting to access the game through the fake google play store or similar. 

Based on the java error code lines above would you have any idea what it is referring to and the line below specifically:

at com.ansca.corona.Controller$4.run(Controller.java:745)

Hi @jacques1,

Is there a reason you’re highlighting this specific line from the error report? Is this line referenced specifically somewhere?

@Brent, its the only line indicating corona so I figured that line might be the one which tells you perhaps what could be causing the issue or at least what api/etc might be the origin if any.

Hi @jacques1,

The engineers report that this is an issue with trying to dismiss an alert dialog that’s not showing. Are you using any alert dialogs in your app?

Brent

@Brent,

the only place i use a native pop up is the licensing check with the code below.

Runtime:addEventListener( "system", onSystemEvent ) local licensing if "Android" == system.getInfo( "platformName" ) then licensing = require "licensing";licensing.init( "google" ) function licensingListener( event ) local verified = event.isVerified if event.isVerified then initNewGame();startScreen() else native.showAlert( "Licensing Failed.", "There was a problem verifying the application, please try again or re-download from Google Play Store.", { "OK" },function(event) native.requestExit() end ) end end licensing.verify( licensingListener ) else initNewGame();startScreen() end

And as mentioned it has only happened to one customer I heard from but others might simply have chosen a refund thinking the game didn’t work. Good to know what might be causing the problem but still doesn’t help much in order to solve the problem unless you can suggest some additional code I need to add to prevent this rare error.

How about showing some other kind of message that’s not a native alert? Like an overlay scene or something like that?

Brent

So you pretty sure the issue is caused by native.showAlert? If so, then it’s no problem for me to show a screen instead.

I suppose i do a simple eventListener so if user taps screen it calls native.requestExit()?

You could use a native.requestExit(), but note that it will likely appear as a “crash” to users who don’t pass the licensing, and that might cause more “refund request on the assumption the app is busted” cases. So, you may be better off showing some other non-native message.

Take care,

Brent

ok thanks for the advice Brent :wink:

Hi @jacques1,

Thanks for the error report, but I think we’ll need more information about what your app is doing. Can you please post the contents of your build.settings so we can inspect things like plugins, permissions, etc.?

Thanks,

Brent

settings = { plugins = { ["CoronaProvider.gameNetwork.apple"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, iphone = { plist = { UIPrerenderedIcon = true, UIStatusBarHidden = true, UIApplicationExitsOnSuspend = false, CFBundleIconFile = "Icon.png", CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-40@3x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png" }, UILaunchImages = { { -- iPhone 4 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 4 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "5.1", ["UILaunchImageName"] = "Default", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 480}" }, { -- iPhone 5 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPhone 5 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-568h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{320, 568}" }, { -- iPad LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPad LandscapeRight ["UILaunchImageMinimumOSVersion"] = "6.0", ["UILaunchImageName"] = "Default-Landscape", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{768, 1024}" }, { -- iPhone 6 LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-667h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{375, 667}" }, { -- iPhone 6 Plus LandscapeLeft ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeLeft", ["UILaunchImageSize"] = "{414, 736}" }, { -- iPhone 6 Plus LandscapeRight ["UILaunchImageMinimumOSVersion"] = "8.0", ["UILaunchImageName"] = "Default-Landscape-736h", ["UILaunchImageOrientation"] = "LandscapeRight", ["UILaunchImageSize"] = "{414, 736}" }, }, CFBundleIdentifier = "com.vdvgames.zwar", CFBundleDisplayName = "WOTZ", UIAppFonts = { "boston.ttf", "eurobold.ttf", "final.ttf" } }, }, android = { largeHeap = true, usesExpansionFile = true, versionCode = "127", usesPermissions = { "android.permission.INTERNET", "android.permission.WRITE\_EXTERNAL\_STORAGE", "com.android.vending.CHECK\_LICENSE" }, }, orientation = { default = "landscape", supported = { "landscape", "landscapeRight", "landscapeLeft", }, } }

It doesn’t seem like every android user had this issue when downloading as many user managed to install and play without issue, but it’s strange some have encountered this error with licensing even after many many attempts to re-download. appreciate any feedback.

Hi @jacques1,

I just recalled something which I’m helping another user with, which may be the same thing you’re working through. Please see this forum thread:

http://forums.coronalabs.com/topic/52429-android-expansion-file-not-licensed-error/#entry272564

Thanks,

Brent

Thanks for the reply Brent. However the licensing in my game is set up correctly as almost all users have no problems (from what I gather and see in the google dev console) with downloading and installing. So I don’t know if this is device specific, or rooted device issue, or a user attempting to access the game through the fake google play store or similar. 

Based on the java error code lines above would you have any idea what it is referring to and the line below specifically:

at com.ansca.corona.Controller$4.run(Controller.java:745)

Hi @jacques1,

Is there a reason you’re highlighting this specific line from the error report? Is this line referenced specifically somewhere?

@Brent, its the only line indicating corona so I figured that line might be the one which tells you perhaps what could be causing the issue or at least what api/etc might be the origin if any.

Hi @jacques1,

The engineers report that this is an issue with trying to dismiss an alert dialog that’s not showing. Are you using any alert dialogs in your app?

Brent