zoukankan      html  css  js  c++  java
  • 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>
    如果你感兴趣,你可以把你妹妹介绍给我
  • 相关阅读:
    Windows server 2016 解决“无法完成域加入,原因是试图加入的域的SID与本计算机的SID相同。”
    Windows Server 2016 辅助域控制器搭建
    Windows Server 2016 主域控制器搭建
    Net Framework 4.7.2 覆盖 Net Framework 4.5 解决办法
    SQL SERVER 2012更改默认的端口号为1772
    Windows下彻底卸载删除SQL Serever2012
    在Windows Server2016中安装SQL Server2016
    SQL Server 创建索引
    C#控制台或应用程序中两个多个Main()方法的设置
    Icon cache rebuilding with Delphi(Delphi 清除Windows 图标缓存源代码)
  • 原文地址:https://www.cnblogs.com/plateFace/p/4271364.html
Copyright © 2011-2022 走看看