Merge "Fix bug in Windows audio code"
diff --git a/android/main-common.c b/android/main-common.c
index a662907..04d200a 100644
--- a/android/main-common.c
+++ b/android/main-common.c
@@ -806,12 +806,15 @@
                 exit(2);
             }
 
-            android_build_root = path_parent( out, 4 );
-            if (android_build_root == NULL || !path_exists(android_build_root)) {
-                derror("Can't find the Android build root from '%s'\n"
-                    "Please check the definition of the ANDROID_PRODUCT_OUT variable.\n"
-                    "It should point to your product-specific build output directory.\n",
-                    out );
+            android_build_root = getenv("ANDROID_BUILD_TOP");
+            if (android_build_root == NULL || android_build_root[0] == 0)
+                break;
+
+            if (!path_exists(android_build_root)) {
+                derror("Can't find the Android build root '%s'\n"
+                    "Please check the definition of the ANDROID_BUILD_TOP variable.\n"
+                    "It should point to the root of your source tree.\n",
+                    android_build_root );
                 exit(2);
             }
             android_build_out = out;