2

It's my first time using the Eclipse ADT and I'm having problems starting a new activity from a different package. I'm trying to start com.furgus.cam.CameraActivity from com.furgus.swipe.LobbyActivity but I keep getting a NoClassDefFoundError from failing to link my CameraActivity properly. I'm not exactly sure what I'm doing wrong and am in much need of guidance.

Any and all help would be greatly appreciated. Thanks.


AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.furgus"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="17" />

<supports-screens android:resizeable="true"
                  android:smallScreens="true"
                  android:normalScreens="true"
                  android:largeScreens="true"
                  android:anyDensity="true" />

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera" android:required="false"/>
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <service
        android:name=".swipe.SocketService"
        android:icon="@drawable/ic_launcher"
        android:label="socket_service" >
    </service> 
    <activity
        android:name=".swipe.LobbyActivity"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar" />
    <activity
        android:name=".cam.CameraActivity"
        android:label="@string/app_name"
        android:screenOrientation="landscape"
        android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />

</application>

LobbyActivity.java

if (str.equalsIgnoreCase(KEY_START_GAME)) {
        Intent newIntent = new Intent(CONTEXT, CameraActivity.class);
        Bundle extras = new Bundle();
        extras.putString(KEY_USERNAME, username);
        extras.putString(KEY_MATCH, match);
        extras.putString(KEY_TEAM, team);
        newIntent.putExtras(extras);
        startActivity(newIntent);
}

LogCat

02-18 13:51:00.909: I/dalvikvm(12358): Failed resolving Lcom/furgus/cam/CameraActivity; interface 695 'Lorg/opencv/android/CameraBridgeViewBase$CvCameraViewListener2;'
02-18 13:51:00.909: W/dalvikvm(12358): Link of class 'Lcom/furgus/cam/CameraActivity;' failed
02-18 13:51:00.909: E/dalvikvm(12358): Could not find class 'com.furgus.cam.CameraActivity', referenced from method com.furgus.swipe.LobbyActivity.updateUI
02-18 13:51:00.909: W/dalvikvm(12358): VFY: unable to resolve const-class 565 (Lcom/furgus/cam/CameraActivity;) in Lcom/furgus/swipe/LobbyActivity;
user2813611
  • 63
  • 1
  • 6

2 Answers2

7

Try this:

Go to Project/Properties/Java Build Path/Order and Export -- Make sure there's a check in front of Android Dependencies and the support library, if you use it.Mark all checkboxes and Click on Apply and clean the project.

Hope this helps.

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69
1

Try this:

First add jar to build path

project-> config build path-> order and export-> move dependent project on top

and

this error is also generated when you make an app that uses the Google API (such as Maps) but run it on a device that targets the Android API.

Community
  • 1
  • 1
Shailendra Madda
  • 20,649
  • 15
  • 100
  • 138