Deepu Mandy
Deepu Mandy

Reputation: 117

I am getting ClassNotFoundException, in log cat? why?

For my project all my java classes are in one package - com.example.android.bitmapfun - and my manifest is:

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

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

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:description="@string/app_description"
    android:hardwareAccelerated="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

    <activity
        android:name="com.example.android.bitmapfun.ImageGridActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.android.bitmapfun.ImageDetailActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.FullScreen" >
    </activity>
</application>
</manifest>

and the Activities are:

   package com.example.android.bitmapfun;

 import android.os.Bundle;
 import android.support.v4.app.FragmentActivity;
 import android.support.v4.app.FragmentTransaction;


  public class ImageGridActivity extends FragmentActivity {
  private static final String TAG = "ImageGridFragment";

 @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (getSupportFragmentManager().findFragmentByTag(TAG) == null) {
        final FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
        ft.add(android.R.id.content, new ImageGridFragment(), TAG);
        ft.commit();
    }
  }
  }

ImageDeatilActivity.java:

  package com.example.android.bitmapfun;

 import android.annotation.SuppressLint;
 import android.app.ActionBar;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v4.app.FragmentActivity;
 import android.support.v4.app.FragmentManager;
 import android.support.v4.app.FragmentStatePagerAdapter;
 import android.support.v4.view.ViewPager;
 import android.util.DisplayMetrics;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
 import android.view.WindowManager.LayoutParams;
 import android.widget.Toast;

 import com.example.android.bitmapfun.R;
 import com.example.android.bitmapfun.Images;
 import com.example.android.bitmapfun.DiskLruCache;
 import com.example.android.bitmapfun.ImageCache;
 import com.example.android.bitmapfun.ImageFetcher;
 import com.example.android.bitmapfun.ImageResizer;
 import com.example.android.bitmapfun.ImageWorker;
 import com.example.android.bitmapfun.Utils;

 public class ImageDetailActivity extends FragmentActivity implements OnClickListener {
private static final String IMAGE_CACHE_DIR = "images";
public static final String EXTRA_IMAGE = "extra_image";

private ImagePagerAdapter mAdapter;
private ImageResizer mImageWorker;
private ViewPager mPager;

@SuppressLint("NewApi")
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_detail_pager);
 .....
}

LogCat: here

Why is the LogCat showing the ClassNotFoundException here? I tried but can't clear the error. Please any ideas to overcome this problem.

Upvotes: 0

Views: 1760

Answers (2)

Kaleb
Kaleb

Reputation: 1885

For what it is worth, I couldn't get any of the solutions to work when I imported the BitmapFun project into Eclipse. It was because of the ClassNotFoundException. I did notice that the project was missing the libs folder and the support library, but creating the libs folder and dropping the support library into it did not fix the problem. So, I created a new project in Eclipse, transferred the files over from the original imported project, and it worked on the first try. Victory.

Upvotes: 0

Nishant
Nishant

Reputation: 32232

To use this FragMentActivity class, your application must specify API Level "11" or higher in its manifest and be compiled against a version of the Android library that supports an equal or higher API Level.

Upvotes: 1

Related Questions