Unity - Android 6.0 - 与java.lang.IllegalAccessException崩溃:java.lang.Class <com.unity3d.player.n $ 1>无法访问

时间:2016-06-13 22:29:23

标签: android unity3d android-6.0-marshmallow

我开发了一款使用Unity开发的游戏并获取了我无法在我的任何设备上重现的崩溃日志,如下所示:

java.lang.RuntimeException: Unable to start activity ComponentInfo{fab.gameofwords/com.unity3d.player.UnityPlayerNativeActivity}: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.unity3d.player.n$1: make sure class name exists, is public, and has an empty constructor that is public
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
    at android.app.ActivityThread.access$900(ActivityThread.java:150)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:148)
    at android.app.ActivityThread.main(ActivityThread.java:5417)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.unity3d.player.n$1: make sure class name exists, is public, and has an empty constructor that is public
    at android.app.Fragment.instantiate(Fragment.java:628)
    at android.app.FragmentState.instantiate(Fragment.java:106)
    at android.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:1858)
    at android.app.FragmentController.restoreAllState(FragmentController.java:122)
    at android.app.Activity.onCreate(Activity.java:923)
    at android.app.NativeActivity.onCreate(NativeActivity.java:184)
    at com.unity3d.player.UnityPlayerNativeActivity.onCreate(Unknown Source)
    at android.app.Activity.performCreate(Activity.java:6285)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
    ... 9 more
Caused by: java.lang.IllegalAccessException: java.lang.Class<com.unity3d.player.n$1> is not accessible from java.lang.Class<android.app.Fragment>
    at java.lang.Class.newInstance(Native Method)
    at android.app.Fragment.instantiate(Fragment.java:613)
    ... 18 more

这是我的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="fab.gameofwords" android:installLocation="preferExternal" 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" />
  <application
      android:icon="@drawable/app_icon"
      android:label="@string/app_name"
      android:debuggable="true">
    <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
    <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="fb577464905719222" />
    <provider android:name="android.support.v4.content.FileProvider" android:authorities="fab.gameofwords.fileprovider" android:exported="false" android:grantUriPermissions="true">
      <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/file_paths" />
    </provider>
    <activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:label="@string/app_name">
      <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
      <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <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.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.facebook.LoginActivity" android:configChanges="keyboardHidden|orientation" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true" />
    <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent" />
    <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">
      <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="fab.gameofwords" />
      </intent-filter>
    </activity>
    <activity android:name="com.outlinegames.unibill.PurchaseActivity" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait" />
    <!--Parse-->
    <receiver android:name="com.parse.ParsePushBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND">
      <intent-filter>
        <action android:name="com.google.android.c2dm.intent.RECEIVE" />
        <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
        <category android:name="fab.gameofwords" />
      </intent-filter>
    </receiver>
    <service android:name="com.parse.ParsePushService" />
    <!--End-->
    <!--Google Analytics-->
    <service android:name="com.google.analytics.tracking.android.CampaignTrackingService" />
    <receiver android:name="com.google.analytics.tracking.android.CampaignTrackingReceiver" android:exported="true">
      <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter>
    </receiver>
    <!--End-->
    <!--Tune-->
    <receiver android:name="com.tune.TuneTracker" android:exported="true">
      <intent-filter>
        <action android:name="com.android.vending.INSTALL_REFERRER" />
      </intent-filter>
    </receiver>
    <!--End-->
    <activity android:name="com.outlinegames.unibill.PurchaseActivity" 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.Fullscreen" />
    <activity android:name="com.facebook.unity.FBUnityAppLinkActivity" android:exported="true" />
    <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" />
    <provider android:name="com.facebook.FacebookContentProvider" android:authorities="com.facebook.app.FacebookContentProvider577464905719222" android:exported="true" />
    <activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
  </application>
  <!-- Settings for GCM -->
  <permission
    android:name="fab.gameofwords.permission.C2D_MESSAGE"
    android:protectionLevel="signature" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.WAKE_LOCK" />
  <uses-permission android:name="android.permission.VIBRATE" />
  <uses-permission android:name="android.permission.GET_ACCOUNTS" />
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
  <uses-permission android:name="fab.gameofwords.permission.C2D_MESSAGE" />
  <uses-permission android:name="com.android.vending.BILLING" />
</manifest>

似乎崩溃只发生在 Android 6.0 上。 这里有什么不对,我错过了什么?

提前致谢。

1 个答案:

答案 0 :(得分:1)

查看这篇文章:

https://forum.unity.com/threads/crash-reports-caused-by-android-app-fragment-instantiationexception.472522/

这是Unity Team将在5.6.4p3中修复的错误