打开分支链接

时间:2017-05-19 14:51:54

标签: android unity3d unity5 deep-linking branch.io

问题如下:

  1. 通常从应用抽屉打开应用
  2. 按主页按钮将应用程序发送到后台
  3. 从WhatsApp或Facebook Messenger打开分支链接
  4. 应用程序崩溃(内存不足)
  5. 但是,以下步骤可以正常使用:

    1. 通过分支链接
    2. 打开应用
    3. 按主页按钮将应用程序发送到后台
    4. 打开其他分支链接
    5. 以下是应用崩溃时发生的情况:

      05-19 15:56:02.853: E/AndroidRuntime(19495): Process: com.somecompany.Someapp, PID: 19495
      05-19 15:56:02.853: E/AndroidRuntime(19495): java.lang.Error: FATAL EXCEPTION [main]
      05-19 15:56:02.853: E/AndroidRuntime(19495): Unity version     : 5.6.0f3
      05-19 15:56:02.853: E/AndroidRuntime(19495): Device model      : Sony D6633
      05-19 15:56:02.853: E/AndroidRuntime(19495): Device fingerprint: Sony/D6633/D6633:6.0.1/23.5.A.1.291/2769308465:user/release-keys
      05-19 15:56:02.853: E/AndroidRuntime(19495): Caused by: java.lang.OutOfMemoryError: Failed to allocate a 84934668 byte allocation with 16776896 free bytes and 61MB until OOM
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:467)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:497)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at com.unity3d.player.i.onLayoutChange(Unknown Source)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.View.layout(View.java:16731)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewGroup.layout(ViewGroup.java:5438)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.View.layout(View.java:16722)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewGroup.layout(ViewGroup.java:5438)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.View.layout(View.java:16722)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewGroup.layout(ViewGroup.java:5438)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2685)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.View.layout(View.java:16722)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewGroup.layout(ViewGroup.java:5438)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2175)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1935)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1111)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6017)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.Choreographer.doCallbacks(Choreographer.java:670)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.Choreographer.doFrame(Choreographer.java:606)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.os.Handler.handleCallback(Handler.java:739)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.os.Handler.dispatchMessage(Handler.java:95)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.os.Looper.loop(Looper.java:234)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at android.app.ActivityThread.main(ActivityThread.java:5526)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at java.lang.reflect.Method.invoke(Native Method)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      05-19 15:56:02.853: E/AndroidRuntime(19495):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
      05-19 15:56:02.855: D/ActivityManager(935): New dropbox entry: com.somecompany.Someapp, data_app_crash, 30b67bc9-f4db-4507-b486-a6382778be7f
      05-19 15:56:02.857: W/ActivityManager(935):   Force finishing activity com.somecompany.Someapp/io.branch.unity.BranchUnityActivity
      

      这是我的清单:

      <?xml version="1.0" encoding="UTF-8"?>
      <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.somecompany.someapp" android:theme="@android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0">
        <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
        <permission android:name="com.somecompany.someapp.permission.C2D_MESSAGE" android:protectionLevel="signature" />
        <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true" android:name="io.branch.referral.BranchApp">
          <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb1642292226066339" />
          <meta-data android:name="com.google.android.gms.appstate.APP_ID" android:value="\ 62138035114" />
          <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="\ 62138035114" />
          <meta-data android:name="com.google.android.gms.version" android:value="8487000" />
          <meta-data android:name="wappier_debug" android:value="true" />
          <meta-data android:name="io.branch.sdk.TestMode" android:value="false" />
          <meta-data android:name="io.branch.sdk.BranchKey.live" android:value="key_live_bnEyrJEa3GdHlq7FeCzr3annDxmJft9j" />
          <receiver android:name="com.kii.cloud.unity.GCMBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
            <intent-filter>
              <action android:name="com.google.android.c2dm.intent.RECEIVE" />
              <category android:name="com.somecompany.someapp" />
            </intent-filter>
          </receiver>
          <receiver android:name="com.androidnative.features.notifications.LocalNotificationReceiver" />
          <receiver android:name="sdk.wappier.com.receivers.WappierReceiver" android:enabled="true" android:exported="true">
            <intent-filter>
              <action android:name="com.android.vending.INSTALL_REFERRER" />
            </intent-filter>
          </receiver>
          <service android:name="com.kii.cloud.unity.GcmIntentService" />
          <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider1642292226066339" android:exported="true" />
          <activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait">
            <intent-filter>
              <action android:name="PACKAGE_NAME.MESSAGE" />
              <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
            <intent-filter>
              <action android:name="android.intent.action.MAIN" />
              <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
          </activity>
          <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait">
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
          </activity>
          <activity android:name="io.branch.unity.BranchUnityActivity" android:launchMode="singleTask" android:screenOrientation="sensorLandscape">
            <intent-filter>
              <intent-filter android:autoVerify="true">
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="https" android:host="myapp.app.link" />
      		  <data android:scheme="https" android:host="myapp-alternate.app.link" />
              </intent-filter>
              <data android:host="open" android:scheme="myapp" />
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <category android:name="android.intent.category.BROWSABLE" />
            </intent-filter>
          </activity>
          <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait">
            <meta-data android:name="android.app.lib_name" android:value="unity" />
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
          </activity>
          <activity android:name="com.jirbo.adcolony.AdColonyOverlay" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
          <activity android:name="com.jirbo.adcolony.AdColonyFullscreen" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
          <activity android:name="com.jirbo.adcolony.AdColonyBrowser" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
          <activity android:name="com.unity3d.player.VideoPlayer" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|uiMode|touchscreen" />
          <activity android:name="com.androidnative.AndroidNativeProxy" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
          <activity android:name="com.androidnative.features.social.common.SocialProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar">
            <intent-filter>
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <category android:name="android.intent.category.BROWSABLE" />
              <data android:scheme="oauth" android:host="com.somecompany.someapp" />
            </intent-filter>
          </activity>
          <activity android:name="com.androidnative.gms.core.GameClientBridge" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation" />
          <activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:configChanges="keyboardHidden|orientation" />
          <activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
          <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
          <activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
          <activity android:name="com.androidnative.gms.core.GooglePlaySupportActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
          <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
          <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true">
            <intent-filter>
              <action android:name="android.intent.action.VIEW" />
              <category android:name="android.intent.category.DEFAULT" />
              <data android:scheme="" />
            </intent-filter>
          </activity>
          <activity android:name="com.facebook.unity.FBUnityGameRequestActivity" />
          <activity android:name="com.facebook.unity.FBUnityCreateGameGroupActivity" />
          <activity android:name="com.facebook.unity.FBUnityJoinGameGroupActivity" />
          <activity android:name="com.facebook.unity.AppInviteDialogActivity" />
        </application>
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="com.android.vending.BILLING" />
        <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
        <uses-permission android:name="android.permission.WAKE_LOCK" />
        <uses-permission android:name="android.permission.VIBRATE" />
        <uses-permission android:name="android.permission.GET_TASKS" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.GET_ACCOUNTS" />
        <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
        <uses-permission android:name="com.somecompany.someapp.permission.C2D_MESSAGE" />
        <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
        <!--<uses-permission android:name="android.permission.READ_PHONE_STATE" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />-->
      </manifest>

1 个答案:

答案 0 :(得分:0)

位图内存管理是一个可以追溯到Android早期的恐怖事件。我建议使用像Glide或Picasso这样的库来处理你的位图,并根据需要自定义缓存。我不知道你现在正在使用什么,但这些都是我的目标。有关stackoverflow上位图oom问题的大量信息,它与Branch无关,除非您通过链接引用params传递大量字节图像数据,在这种情况下我们不支持。如果你继续努力并发现它与分支机构的内存分配有关,而不是你的位图,请写信到integrations@branch.io,我会看看!