Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android: no class def found error from library project

i am getting a noclassdeffound exception, when running my app with the emulator:

@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    Intent myIntent = new Intent(ActivityPano.this, ActivityTable.class);
    startActivity(myIntent);
}

the ActivityTable is causing the exception.

it is defined in an android-library project, which i have included in the java build path as well as in the android references dialog. there are no errors in eclipse, but when started in the emulator it crashes.

here is my manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.mypackage"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name" android:theme="@android:style/Theme.NoTitleBar" android:debuggable="false" android:description="@string/description">
        <activity android:name=".ActivityHPanorama"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


        <activity android:name="com.mypackage.ActivityTable"></activity>

    </application>


<uses-sdk android:minSdkVersion="3"></uses-sdk>
</manifest> 

this is the error from the logcat:

04-18 11:32:07.767: ERROR/dalvikvm(483): Could not find class com.mypackage.ActivityTable', referenced from method com.mypackage.ActivityHPanorama.onCreate

what makes me a bit suspicious is this line from the console (not the logcat):

[2011-04-18 14:55:59 - panorama] Could not find panorama.apk!

panorama is the name of the library project.

like image 613
clamp Avatar asked Nov 27 '22 17:11

clamp


1 Answers

If you are depenedencies are correct when you are installing the app you should see following in console logs

[2011-04-19 16:41:10 - TicTacToe] Installing TicTacToe.apk...

[2011-04-19 16:41:12 - TicTacToe] Success!

But since you were mentioning that Could not find panorama.apk! I tried replicating such behaviour using tic-tac-toe sameple library..

This is what i did,

Added TicTacToe Library to eclipse, Added TicTacToe app also to eclipse.

Right clicked on Library project, went to android tab and removed the IsLibrary check

Right clicked on Main app project, went to android tab removed dependency

The went to java build path of Main app project and added Library project as required project

Compilation went fine, but when installing the app it is checking for library.apk I am guessing if you are doing anything similar tat might be the issue.

[2011-04-19 16:42:16 - TicTacToe] Installing TicTacToe.apk...

[2011-04-19 16:42:20 - TicTacToe] Success! [2011-04-19 16:42:20 - TicTacToe] Project dependency found, installing: TicTacToeLib

[2011-04-19 16:42:20 - TicTacToeLib] Uploading TicTacToeLib.apk onto device 'SH0A5PL08769' [2011-04-19 16:42:20 - TicTacToeLib] Installing TicTacToeLib.apk... [2011-04-19 16:42:24 - TicTacToeLib] Success!

like image 74
Naresh Avatar answered Dec 07 '22 17:12

Naresh