Unity 接MM横屏闪退的原因

=。=研究了1天接SDK到处都在报错,于是使用logcat查看原因截取到这样的Exception.

call to OpenGL ES API withno current context(logged once per thread)这个BUG,是因为android xml配置屏幕显示和Unity不匹配,导致程序闪退

 

1

 

配合节点:

如果你发现confiChanges和下面不一样,90%就是这个原因,在调用的页面添加以下节点. 上一次我接支付宝的SDK也是遇到这个问题.我想应该也是这个造成的

android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
android:screenOrientation="landscape"

 

附上Unity接移动MM AndroidManifest.xml配置

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.smart.helloZhiFu2"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk android:minSdkVersion="4" />
    <supports-screens android:largeScreens="true" />
    
    
    <application
        android:label="@string/app_name" >
        <activity
            android:name="com.smart.helloZhiFu2.MainActivity"
            android:label="@string/app_name" 
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:screenOrientation="landscape" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <service
            android:name="mm.purchasesdk.iapservice.PurchaseService"
            android:exported="true" >

            <!-- android:process="mm.iapServices" > -->
            <intent-filter android:priority="310" >
                <action android:name="com.aspire.purchaseservice.BIND" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter android:priority="310" >
                <action android:name="com.smart.helloZhiFu2.purchaseservice.BIND" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>            
            <intent-filter android:priority="310" >
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.SAFIAP.COMPONENT" >
                </category>
            </intent-filter>
        </service>
        <!-- android:excludeFromRecents="true" -->
        <!-- android:launchMode="singleInstance" -->
        <activity
            android:name="mm.purchasesdk.iapservice.BillingLayoutActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:theme="@android:style/Theme.Translucent" 
            android:screenOrientation="landscape" >
            <intent-filter android:priority="310" >
                <action android:name="com.smart.helloZhiFu2.com.mmiap.activity" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

        <!-- android:process="safiap.framework.safframeworkmanager" begin -->
        <service
            android:name="safiap.framework.SafFrameworkManager"
            android:exported="true"
            android:process="safiap.framework" >
            <intent-filter android:priority="630" >

                <!-- ID for services declared in AIDL -->
                <action android:name="safiap.framework.sdk.ISAFFramework" />
            </intent-filter>
            <intent-filter android:priority="630" >

                <!-- ID for services declared in AIDL -->
                <action android:name="safiap.framework.ACTION_START_DOWNLOAD" />
            </intent-filter>
            <intent-filter android:priority="630" >

                <!-- ID for services declared in AIDL -->
                <action android:name="safiap.framework.ACTION_CHECK_UPDATE" />
            </intent-filter>
        </service>
        <!-- receivers -->
        <receiver android:name="safiap.framework.CheckUpdateReceiver" >
            <intent-filter>
                <action android:name="safiap.framework.ACTION_CANCEL_NOTIFICATION" />
            </intent-filter>
            <intent-filter>
                <action android:name="safiap.GET_SHARED_DATA" />
            </intent-filter>
            <intent-filter>
                <action android:name="safiap.framework.ACTION_SET_TIMER" />
            </intent-filter>
        </receiver>

        <activity
            android:name="safiap.framework.ui.UpdateHintActivity"
            android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"
            android:excludeFromRecents="true"
            android:launchMode="singleInstance"
            android:screenOrientation="landscape"
            android:theme="@android:style/Theme.Translucent.NoTitleBar" >
            <intent-filter>
                <action android:name="safiap.framework.ACTION_TO_INSTALL" />
            </intent-filter>
            <intent-filter>
                <action android:name="safiap.framework.ACTION_TO_INSTALL_IAP" />
            </intent-filter>
            <intent-filter>
                <action android:name="safiap.framework.ACTION_NETWORK_ERROR_IAP" />
            </intent-filter>
            <intent-filter>
                <action android:name="safiap.framework.ACTION_NETWORK_ERROR_FRAMEWORK" />
            </intent-filter>
        </activity>

        <service
            android:name="safiap.framework.logreport.monitor.handler.LogreportHandler"
            android:process=":remote" />
        <!-- android:process="safiap.framework.safframeworkmanager" end -->
            
            
                          <!--taklingData部分-->
      <activity android:name="com.unity3d.player.UnityPlayerNativeActivity"
          android:label="@string/app_name"
          android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen">
        <meta-data android:name="android.app.lib_name" android:value="unity" />
        <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
      </activity>


      <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="landscape" android:launchMode="singleTask" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale">
        <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
        <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false"/>
      </activity>
            
    </application>

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.GET_TASKS"/>

    
</manifest>

 

posted @ 2015-02-03 23:55  盘子脸  阅读(1815)  评论(0编辑  收藏  举报