尝试从Unity构建Android应用程序时出现java.lang.ClassNotFoundException

时间:2014-09-24 00:26:20

标签: java android build unity3d classnotfoundexception

我在尝试构建Android时遇到了直接崩溃。在我尝试更改捆绑包ID之前,我没有遇到任何问题,因此我们可以构建不同版本的应用。我怀疑它与插件有关(它使用playhaven等)。我做的唯一改变是改变了包ID,从那以后它在启动时立即崩溃(甚至没有进入启动画面)。我没有在android开发经验,它可能是显而易见的东西。任何帮助都会很棒,这真的让我失望了。

谢谢,

的AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.evodent.fannex.fgo" android:theme="@android:style/Theme.NoTitleBar" android:versionName="1.5.7.0" android:versionCode="3" android:installLocation="preferExternal">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-permission android:name="android.permission.RECORD_AUDIO"/>
  <application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true">
    <activity 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="fullSensor" android:hardwareAccelerated="true" android:name="com.evodent.fannex.fgo.OverrideExample">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
      <!-- Example deep link
            <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="company" android:host="===your app's package name here===" />
            </intent-filter>
            -->
      <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.unity3d.player.VideoPlayer" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="sensor">
        </activity>
    <activity android:name="com.playhaven.android.view.FullScreen" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:windowSoftInputMode="adjustResize" android:configChanges="orientation|keyboardHidden|screenSize">
      <!-- Support FullScreen.createIntent -->
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
      </intent-filter>
      <!-- Support Uri.parse -->
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="android.intent.category.DEFAULT"/>
        <data android:scheme="playhaven" android:host="localhost" android:pathPattern="/full"/>
      </intent-filter>
    </activity>
    <receiver android:name="com.playhaven.android.push.PushReceiver">
      <intent-filter>
        <action android:name="android.intent.action.VIEW"/>
        <category android:name="com.playhaven.android"/>
      </intent-filter>
    </receiver>
    <!-- This is needed to receive Google Cloud Messaging intents from the system. -->
    <receiver android:name="com.playhaven.android.push.GCMBroadcastReceiver" 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="com.evodent.fannex.fgo"/>
      </intent-filter>
    </receiver>
  </application>
  <uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>
  <uses-feature android:glEsVersion="0x00020000"/>
  <uses-permission android:name="android.permission.INTERNET"/>
  <uses-permission android:name="android.permission.WAKE_LOCK"/>
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
  <!-- This is needed to receive Google Cloud Messaging intents from the system. -->
  <!-- <permission android:name="com.evodent.fannex.fgo.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
  <uses-permission android:name="com.evodent.fannex.fgo.permission.C2D_MESSAGE"/>
  <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE"/> -->
  <uses-permission android:name="android.permission.GET_ACCOUNTS"/>
  <uses-feature android:name="android.hardware.touchscreen"/>
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="false"/>
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false"/>
</manifest>

Logcat结果

D/SurfaceFlinger( 1522): screenshot: sw=180, sh=320, minZ=0, maxZ=21020
I/ActivityManager( 1904): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.evodent.fannex.fgo/.OverrideExample bnds=[14,163][127,322]} from pid 13450
I/libblt_hw( 1522): Library opened (handle = 0, fd = 28)
I/ActivityManager( 1904): Start proc com.evodent.fannex.fgo for activity com.evodent.fannex.fgo/.OverrideExample: pid=4034 uid=10167 gids={3003, 1015, 1006}
D/OpenGLRenderer(13450): Flushing caches (mode 1)
D/OpenGLRenderer(13450): Flushing caches (mode 0)
D/AndroidRuntime( 4034): Shutting down VM
W/dalvikvm( 4034): threadid=1: thread exiting with uncaught exception (group=0x40a96210)
E/AndroidRuntime( 4034): FATAL EXCEPTION: main
E/AndroidRuntime( 4034): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.evodent.fannex.fgo/com.evodent.fannex.fgo.OverrideExample}: java.lang.ClassNotFoundException: com.evodent.fannex.fgo.OverrideExample
E/AndroidRuntime( 4034):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891)
E/AndroidRuntime( 4034):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
E/AndroidRuntime( 4034):    at android.app.ActivityThread.access$600(ActivityThread.java:127)
E/AndroidRuntime( 4034):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
E/AndroidRuntime( 4034):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4034):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4034):    at android.app.ActivityThread.main(ActivityThread.java:4448)
E/AndroidRuntime( 4034):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4034):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4034):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
E/AndroidRuntime( 4034):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
E/AndroidRuntime( 4034):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 4034): Caused by: java.lang.ClassNotFoundException: com.evodent.fannex.fgo.OverrideExample
E/AndroidRuntime( 4034):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
E/AndroidRuntime( 4034):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
E/AndroidRuntime( 4034):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
E/AndroidRuntime( 4034):    at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
E/AndroidRuntime( 4034):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
E/AndroidRuntime( 4034):    ... 11 more
D/SurfaceFlinger( 1522): screenshot: sw=180, sh=320, minZ=0, maxZ=21025
W/ActivityManager( 1904):   Force finishing activity com.evodent.fannex.fgo/.OverrideExample
I/libblt_hw( 1522): Library opened (handle = 5, fd = 25)
I/libblt_hw( 1522): Library closed (handle = 1, fd = 26)
W/ActivityManager( 1904): Activity pause timeout for ActivityRecord{41e81790 com.evodent.fannex.fgo/.OverrideExample}
I/libblt_hw( 1522): Library opened (handle = 1, fd = 26)

1 个答案:

答案 0 :(得分:0)

原来这是一个在旧的bundle_id下编译的插件。我解压缩jar,使用java类编辑器更改类中的名称和目录以匹配新的bundle id,然后更新jar文件夹以匹配这个例如(company / name / OverrideExample.Class)。然后我重新jar了新的目录和类文件,它工作。