Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9075293
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:49:57+00:00 2026-06-16T18:49:57+00:00

I trying to use AndroidAnnotaions, but getting ClassNotFoundException error in my project. For testing

  • 0

I trying to use AndroidAnnotaions, but getting ClassNotFoundException error in my project.

For testing purposes, I created a new project with one Activity and I still getting the error.
My files:

AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.rodrigora.testannotations"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.rodrigora.testannotations.MainActivity_"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

MainActivity.java

package com.rodrigora.testannotations;

import android.app.Activity;
import android.view.Menu;

import com.googlecode.androidannotations.annotations.EActivity;

@EActivity(R.layout.activity_main)
public class MainActivity extends Activity {

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }

}

These are the two files I changed from sample project created by Eclipse and followed these steps to add AndroidAnnotations to project:

  1. Added androidannotations-api-2.7.jar to libs folder and to build path
  2. Added androidannotations-2.7.jar to compiled-libs folder and to Factory Path
  3. Marked androidannotations-2.7.jar in Order and Export tab.

Here the stack trace when I launch the app:

12-28 20:29:21.296: E/AndroidRuntime(30600): FATAL EXCEPTION: main
12-28 20:29:21.296: E/AndroidRuntime(30600): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.rodrigora.testannotations/com.rodrigora.testannotations.MainActivity_}: java.lang.ClassNotFoundException: com.rodrigora.testannotations.MainActivity_ in loader dalvik.system.PathClassLoader[/data/app/com.rodrigora.testannotations-2.apk]
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.os.Handler.dispatchMessage(Handler.java:99)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.os.Looper.loop(Looper.java:130)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.ActivityThread.main(ActivityThread.java:3687)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at java.lang.reflect.Method.invokeNative(Native Method)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at java.lang.reflect.Method.invoke(Method.java:507)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at dalvik.system.NativeStart.main(Native Method)
12-28 20:29:21.296: E/AndroidRuntime(30600): Caused by: java.lang.ClassNotFoundException: com.rodrigora.testannotations.MainActivity_ in loader dalvik.system.PathClassLoader[/data/app/com.rodrigora.testannotations-2.apk]
12-28 20:29:21.296: E/AndroidRuntime(30600):    at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
12-28 20:29:21.296: E/AndroidRuntime(30600):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1565)
12-28 20:29:21.296: E/AndroidRuntime(30600):    ... 11 more

Anyone knows what I forgot?
Eclipse should show generated classes by AndroidAnnotations?

Thank you!

EDIT

Full code – bitbucket

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T18:49:58+00:00Added an answer on June 16, 2026 at 6:49 pm

    It looks like your AndroindAnnotation generated classes are not getting included in your build. Here are the lines your .classpath seems to be missing —

       <classpathentry kind="src" path=".apt_generated">
                   <attributes>
                           <attribute name="optional" value="true"/>
                   </attributes>
       </classpathentry>
    

    These should have been generated for you as part of following the AndroidAnnotations install. Things to check —

    • Your ADT tools are up to date.

    • You ran Project->Clean after enabling annotations

    I was able to clone your repo, import into eclipse, and get a clean build and run the app without a crash using the following steps —

    1. Refactor/rename project to TestAnnotations (eclipse imported as “MainActivity_”)
    2. Enable annotation processing (needed to turn on Enable project specific settings and Enable annonation processing in `Java Compiler->Annontation Processing)
    3. Project->Clean
    4. Run it

    Note: If I did an import and just refactored to get a clean build, but did not enable annotation processing, I got the exact same behavior you describe. Check to make sure you have project specific settings on, annotations on, and then do a clean build.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying use struts2-jasperreports plugin but getting an error with the type result: Grave:
I am trying use mysqli functions but I get this error: Fatal error: Call
I'm trying use self-signed certificate (c#): X509Certificate2 cert = new X509Certificate2( Server.MapPath(~/App_Data/myhost.pfx), pass); on
I'm trying use mod_rewrite to rewrite URLs from the following: http://www.site.com/one-two-file.php to http://www.site.com/one/two/file.php The
trying to use hibernate with my web app and getting following exception: Initial SessionFactory
I was trying use svn to find a checkin using svn log, but it
I'm trying use apache's pdfbox to print a pdf file, so I created a
I am trying use std::copy to copy from two different iterator. But during course
I'm trying use the Sum method in a lambda expression for a comparison, but
I am trying use the new server side plug-in feature for TFS 2010. (I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.