android - gradle commandLine statement blocked by while loop after it -
i have gradle task meant start app installed on connected android device. app designed perform actions , shut down, , task supposed detect this. app unity-built app, it's worth - though i'm not sure should matter.
granted, i'm new gradle, please forgive stupid errors made here.
the task follows:
task androidtests(type: exec) { def output = new bytearrayoutputstream() println "starting unity sample app" commandline 'adb', 'shell', 'am', 'start', '-n', "com.foo.bar/com.unity3d.unityplayeractivity" while(!output.tostring().contains('com.foo.bar')) { // wait app launch println "sample app not running yet." commandline "adb", "shell", "ps", "yplayeractivity" } // wait app close while(output.tostring().contains(packagename)) { println "sample app has not closed yet." commandline "adb", "shell", "ps", "yplayeractivity" } }
currently, task nothing spam console "sample app not running yet.", , app not launch on device. strange is, if remove first while
loop, task complete, , app launch on device.
does know might wrong here? seems if first while loop blocking commandline statement before it, somehow. figure out appreciated. thank you!
Comments
Post a Comment