2012-05-30 207 views
1

我有以下活動類未找到excetption

package com.appnetics; 

import android.app.Activity; 
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.FragmentTransaction; 
import android.view.View; 
import android.widget.Button; 

public class FragmenttestActivity extends FragmentActivity { 
    Button LogIn = null ; 
    final FragmentManager fragmentManager = getSupportFragmentManager() ; 

    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.main); 
     LogIn = (Button) findViewById(R.id.btn_showdetails); 
     LogInEvent() ; 
    } 
public void LogInEvent(){ 

     LogIn.setOnClickListener(new View.OnClickListener() { 

      public void onClick(View v) { 


         FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); 
         details fragment = new details(); 
         fragmentTransaction.add(R.id.my_parent_layout, fragment); 
         fragmentTransaction.commit(); 


      } 
     }); 

    } 


} 

我在manifisest

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

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

    <application 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" > 
     <activity 
      android:name=".FragmenttestActivity" 
      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> 

的問題是,應用程序崩潰給這個日誌貓

05-30 14:31:10.970: W/dalvikvm(4958): Unable to resolve superclass of Lcom/appnetics/FragmenttestActivity; (5) 
05-30 14:31:10.970: W/dalvikvm(4958): Link of class 'Lcom/appnetics/FragmenttestActivity;' failed 
05-30 14:31:10.970: D/AndroidRuntime(4958): Shutting down VM 
05-30 14:31:10.970: W/dalvikvm(4958): threadid=1: thread exiting with uncaught exception (group=0x402ce760) 
05-30 14:31:10.980: E/AndroidRuntime(4958): FATAL EXCEPTION: main 
05-30 14:31:10.980: E/AndroidRuntime(4958): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.appnetics/com.appnetics.FragmenttestActivity}: java.lang.ClassNotFoundException: com.appnetics.FragmenttestActivity in loader dalvik.system.PathClassLoader[/data/app/com.appnetics-1.apk] 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1739) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.ActivityThread.access$500(ActivityThread.java:122) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.os.Handler.dispatchMessage(Handler.java:99) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.os.Looper.loop(Looper.java:132) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.ActivityThread.main(ActivityThread.java:4123) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at java.lang.reflect.Method.invokeNative(Native Method) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at java.lang.reflect.Method.invoke(Method.java:491) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at dalvik.system.NativeStart.main(Native Method) 
05-30 14:31:10.980: E/AndroidRuntime(4958): Caused by: java.lang.ClassNotFoundException: com.appnetics.FragmenttestActivity in loader dalvik.system.PathClassLoader[/data/app/com.appnetics-1.apk] 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:251) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at java.lang.ClassLoader.loadClass(ClassLoader.java:540) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at java.lang.ClassLoader.loadClass(ClassLoader.java:500) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.Instrumentation.newActivity(Instrumentation.java:1025) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730) 
05-30 14:31:10.980: E/AndroidRuntime(4958):  ... 11 more 

調用我確信活動的名稱,我不知道爲什麼有任何想法

+1

http://stackoverflow.com/a/10046725/1289716 – MAC

+0

它是否在另一個包中? –

+1

http://stackoverflow.com/questions/9931040/fragmentactivity-causing-classnotfoundexception –

回答

2

你必須複製的支持pakages 'jar放入您項目中的libs文件夾中。