java - 使用 Eclipse 构建时 Android 构建失败

标签 java android eclipse manifest unity-game-engine

最近我的 eclipse 构建遇到了一个奇怪的问题。当通过 Unity 构建我的应用程序时,一切正常,构建运行正常,但我需要让它与 eclipse 一起工作,因为我有一些我想使用的插件。

我使用的是与 Unity 生成的相同的 Manifest.xml,只是更改了文档中所述的包名称和 Activity 名称。有人提示可能是什么问题吗?

Logcat 抛出:

03-27 15:08:39.632: W/dalvikvm(5289): Unable to resolve superclass of Lde/indiegames/hyperjump/HyperJumpActivity; (34)
03-27 15:08:39.632: W/dalvikvm(5289): Link of class 'Lde/indiegames/hyperjump/HyperJumpActivity;' failed
03-27 15:08:39.632: D/AndroidRuntime(5289): Shutting down VM
03-27 15:08:39.632: W/dalvikvm(5289): threadid=1: thread exiting with uncaught exception (group=0x40015560)
03-27 15:08:39.679: E/AndroidRuntime(5289): FATAL EXCEPTION: main
03-27 15:08:39.679: E/AndroidRuntime(5289): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{de.indiegames.hyperjump/de.indiegames.hyperjump.HyperJumpActivity}: java.lang.ClassNotFoundException: de.indiegames.hyperjump.HyperJumpActivity in loader dalvik.system.PathClassLoader[/mnt/asec/de.indiegames.hyperjump-2/pkg.apk]
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.os.Looper.loop(Looper.java:130)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.ActivityThread.main(ActivityThread.java:3683)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at java.lang.reflect.Method.invokeNative(Native Method)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at java.lang.reflect.Method.invoke(Method.java:507)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at dalvik.system.NativeStart.main(Native Method)
03-27 15:08:39.679: E/AndroidRuntime(5289): Caused by: java.lang.ClassNotFoundException: de.indiegames.hyperjump.HyperJumpActivity in loader dalvik.system.PathClassLoader[/mnt/asec/de.indiegames.hyperjump-2/pkg.apk]
03-27 15:08:39.679: E/AndroidRuntime(5289):     at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
03-27 15:08:39.679: E/AndroidRuntime(5289):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561)
03-27 15:08:39.679: E/AndroidRuntime(5289):     ... 11 more
03-27 15:08:39.687: W/ActivityManager(104):   Force finishing activity de.indiegames.hyperjump/.HyperJumpActivity
03-27 15:08:40.202: W/ActivityManager(104): Activity pause timeout for HistoryRecord{405479b8 de.indiegames.hyperjump/.HyperJumpActivity}

我的 HyperJump.java 类

package de.indiegames.hyperjump;

import android.os.Bundle;
import android.util.Log;

import com.unity3d.player.UnityPlayerActivity;

public class HyperJumpActivity extends UnityPlayerActivity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        Log.d(TAG, "onCreate instance");
    }

    @Override
    public void onResume(){
        Log.d(TAG, "onResume called..");

        super.onResume();
    }
}

我的 list .xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" package="de.indiegames.hyperjump" android:versionName="1.1" android:versionCode="1">
  <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
  <uses-sdk android:minSdkVersion="5" android:targetSdkVersion="15" />
  <!-- PERMISSIONS -->
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  <uses-permission android:name="android.permission.GET_TASKS" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  <uses-permission android:name="com.android.vending.BILLING" />
  <uses-permission android:name="com.android.vending.CHECK_LICENSE" />
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

  <uses-feature android:glEsVersion="0x00010001" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch" android:required="true" />

  <application android:icon="@drawable/app_icon" android:label="@string/app_name">
    <!-- ACTIVITIES -->
    <activity android:configChanges="keyboardHidden|orientation" android:label="@string/app_name" android:name=".HyperJumpActivity" android:screenOrientation="landscape">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.unity3d.player.VideoPlayer" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation" android:screenOrientation="landscape">
    </activity>
    <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:configChanges="keyboardHidden|orientation" android:screenOrientation="landscape">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>
    <activity android:name="com.openfeint.internal.ui.IntroFlow" android:label="IntroFlow" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="landscape" />
    <activity android:name="com.openfeint.api.ui.Dashboard" android:label="Dashboard" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="landscape" />
    <activity android:name="com.openfeint.internal.ui.Settings" android:label="Settings" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="landscape" />
    <activity android:name="com.openfeint.internal.ui.NativeBrowser" android:label="NativeBrowser" android:configChanges="orientation|keyboardHidden" android:theme="@android:style/Theme.NoTitleBar" android:screenOrientation="landscape" />
    <activity android:name="com.chartboost.sdk.CBDialogActivity" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" android:configChanges="orientation|keyboard|keyboardHidden" android:screenOrientation="landscape">
    </activity>
    <activity android:name="com.flurry.android.CatalogActivity" android:theme="@android:style/Theme.Translucent">
      <intent-filter>
        <action android:name="make.me.unique.please" />
        <category android:name="android.intent.category.DEFAULT" />
      </intent-filter>
    </activity>
    <!-- Tapjoy -->
    <activity android:name="com.tapjoy.TJCOffersWebView" android:configChanges="keyboardHidden|orientation" />
    <activity android:name="com.tapjoy.TapjoyFeaturedAppWebView" android:configChanges="keyboardHidden|orientation" />
    <activity android:name="com.tapjoy.TapjoyVideoView" android:configChanges="keyboardHidden|orientation" />
    <!-- SERVICES AND RECEIVERS -->
    <service android:name="com.prime31.billing.BillingService" />
    <receiver android:name="com.prime31.billing.BillingReceiver">
      <intent-filter>
        <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
        <action android:name="com.android.vending.billing.RESPONSE_CODE" />
        <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
      </intent-filter>
    </receiver>
  </application>
</manifest>

任何提示都会有帮助!

最佳答案

关于java - 使用 Eclipse 构建时 Android 构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9893684/

相关文章:

java - 图像从一侧移动到另一侧

java, tomcat8 : MYSQL query start to become very low after some hours that the deploy of a new . war已经搞定

android - 如何调整约束布局

android - Android 连接 WiFi 企业网络 EAP(PEAP)

java - Checker Framework Eclipse 插件加载时抛出异常

java - 使用String.format将不同大小的对象放置在特定位置

android - Android 项目中包含资源的 Java 库 (.jar)

java - RCPTT Maven 插件程序

java - 如何使用 Maven 设置构建脚本?

java - 创建线程后如何将信息传递给线程