Search code examples
androidc++antandroid-ndknexus-7

Android app won't start (displays a black screen) on Nexus 7


I'm writing an Android app using Gameplay3D. I can compile fine using NDK and generate APK using ANT (both debug and release). The app installs, starts and runs perfectly on a Galaxy S3 and a Nexus 4, but when I try to start it on a Nexus 7 it just doesn't display anything. Just a black screen with the nav bar at the bottom.

I have two Nexus 7s, each with a different version of Android (one is 4.3, other is 4.4).

I'm not highly experienced with Android development, but here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.secretCompany.secretGame"
        android:versionCode="15"
        android:versionName="1.0.0">

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- This is the platform API where the app was introduced. -->
    <uses-sdk android:minSdkVersion="10" />
    <uses-feature android:glEsVersion="0x00020000"/>

    <application android:icon="@drawable/icon" android:label="@string/app_name" android:hasCode="true">

        <!-- Our activity is the built-in NativeActivity framework class.
             This will take care of integrating with our NDK code. -->
        <activity android:name="android.app.NativeActivity"
                android:label="@string/app_name"
                android:configChanges="orientation|keyboardHidden"
                android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
                android:screenOrientation="landscape">
            <!-- Tell NativeActivity the name of or .so -->
            <meta-data android:name="android.app.lib_name"
                    android:value="secretGame" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest> 

I've changed the game's name and company as they're currently a secret, but other than that this is exactly how it appears in the file.

Any help would be greatly appreciated :)

Additional Info:

The only thing the app does is render sprites and accept input. No sound, no internet, no nothing else.

Both Nexuses (Nexi? :P) are the 2012 edition, not the new 2013 version.

I use render-to-texture. Could this be a problem? Maybe with non-power-of-2 textures?

I tested and the code is still running, I just can't see anything.


Solution

  • AH finally, I figured it out myself, from this post. The problem was that almost all of my textures were not power-of-2 and the ones that were were off screen at the time.

    Silly me.

    Edit: Or maybe not... now it won't display ANYTHING, not even the textures that were power-of-2 before... does an OpenGL FBO have to have a square texture to work on power-of-2 devices?

    Edit2: Ah, ok I finally found the problem. I was correct initially about the sprites not having power-of-2 textures, but then I re-enabled my render-to-texture and it stopped working. Turns out the problem was that I was rendering to a different FBO and then extracting the texture to turn it into a sprite and render into the primary FBO...and of course the texture wasn't power-of-2. I just created the texture at the lowest PO2 size that the entire screen would still fit into, then modified the UV coords of the fullscreen sprite so the extra texture parts were put offscreen. Problem solved!