Unable to instantiate componentinfo with SlidingMenu Library and SlidingFragmentActivity - android

I am developing an appliation in Android with the SlidingMenu library. I've imported the project to eclipse and I've linked the library with my project PaperTask. The MainActivity extend from SlidingFragmentActivity that extend from FragmentActivity. I've added the class to the Android Manifest but when I launch the app, the debugger show this exception:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.paper.papertask/com.paper.papertask.activities.MainPaperActivity}:
java.lang.ClassNotFoundException: Didn't find class "com.paper.papertask.activities.MainPaperActivity"
on path: /data/app/com.paper.papertask-2.apk
The android manifest is:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.paper.papertask"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.paper.papertask.activities.MainPaperActivity"
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>
The routes of my class are the correct, but for some reason this not found the class.
Can some one know why this doesn't find the class?
Thanks!

Related

Unable to instantiate activity componentinfo classnotfoundexception

I've developed an app but when I run it, it crashes and shows the error: android unable to instantiate activity componentinfo classnotfoundexception.
I've read a lot about this error. I've tried Project -> Properties -> Java Build Path -> Order & Export and ensure Android Private Libraries and all other library projects are checked.
I've also noticed that when I press ctrl and pass the mouse over, for example, .MainActivity in my Android Manifest file, it doesn't display or link me to the Activity, don't know why.
Any ideas about this problem? Thank you so much.
EDIT: Manifest added
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.isa.mememe"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="13"
android:targetSdkVersion="16" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</manifest>

Cannot start another Activity of another Application

I have a problem: I want to start an Activity from another application and for that I did the following:
public void startMyActivity(View view){
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package", "com.package.MyActivity"));
startActivity(intent);
}
But I get the error: Unable to find explicit activity com.package/com.package.MyActivity. Also I declared the MyActivity as activity in the manifest file and I still get the same error. What am I doing wrong? Thanks!
Manifest file of the application A(from which I want to start the activity):
<?xml version="1.0" encoding="utf-8"?>
package="com.example.appA"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
and this is the Manifest file of the application B(which contains the activity that should be started):
<?xml version="1.0" encoding="utf-8"?>
package="com.mypackage.package.appB"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="16" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.package.MyPackage"
android:label="#string/title" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Ok so I found my solution. It is a bit frustrating. So.. I tried all the thinks that you guys suggested(I appreciate that) but nothing worked. So my thoughts guided me to use the adb shell to see how it is my application B named and I found out that it is not only com.package, but it's com.mypackage.package(the name mypackage/pakcage are not relevant, only for example purposes). After that I checked the manifest for the application B and saw that the "package" attribute has as value com.mypackage.package. Thank you again!

Unable to instantiate activity ComponentInfo. Didn't find class

i am trying to use ActionBarSherlock but i always got an error. I already search around the web, but i cant find a solution for my problem.
Here is the error i got :
07-24 09:04:03.049: E/AndroidRuntime(2082): FATAL EXCEPTION: main
07-24 09:04:03.049: E/AndroidRuntime(2082): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.moneynotes.view/com.moneynotes.view.SwipeViewActivity}: java.lang.ClassNotFoundException: Didn't find class "com.moneynotes.view.SwipeViewActivity" on path: /data/app/com.moneynotes.view-1.apk
I already added the actionbarsherlock as library in android category.
my manifest file is like this :
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.moneynotes.view"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="SwipeViewActivity"
android:label="#string/app_name"
android:theme="#style/Theme.Sherlock" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Any help would be appreciated.
have you selected the 'android depedencies' and 'android private libraries' on the 'java build path' catgeory under 'order and export' tab?
if you haven't, try to select it.
Are you using the latest version of ADT(22)? If so, see this post: ClassNotFoundException after ADT update.
android:name="SwipeViewActivity" should be android:name=".SwipeViewActivity" or android:name="com.moneynotes.view.SwipeViewActivity

Multiple <application> tags in manifest file

I want to add another project to my app. But it uses its own "application tag" in AndroidManifest file. And one of its class extends Application
So the problem is I use my own "application" preferences. How can I integrate this new project's "application" preferences to mine ? Will I change somethings on "class extends Application" ?
<activity android:name="com.my.other.project.package.name.MyClassName">
by this you could add your other project activity.
Only the <manifest> and <application> elements are required, they each must be present and can occur only once.
<?xml version="1.0" encoding="utf-8"?>
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.animal.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>
<activity android:name="myOtherPackageName.MyClassName"/> // here where you put your other package name.
</application>

Export Problems - to .apk

App works fine when tested from Eclipse on phone via USB/Sync, when I try and Export it to an .apk, the Manifest.xml looses track of 2 activities under the parent "MasterActvity". Then even the USB/Sync stops working because it can't locate the activities. No memory storage is used, just text displays.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.theoreferenceguide"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.example.theoreferenceguide.MasterActivity"
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="TipActivity"></activity> This keeps getting kicked out during .apk
<activity android:name="UccActivity"></activity> This keeps getting kicked out during .apk
</application>
</manifest>
I agree with nicopico. It looks like you are missing the . infront of the activity which tells the manifest that the activity is in the local namespace. Alternatively if TipActivity is in the same namespace as MasterActivity you can also do android:name="com.example.theoreferenceguide.TipActivity"

Categories

Resources