rahul
rahul

Reputation: 2906

importing packages in android

Do I have to include the activities to my app's Manifest file from the package which are imported to my android app.? thanks

Logcat error:

01-13 02:28:08.392: ERROR/AndroidRuntime(2888): FATAL EXCEPTION: main 01-13 02:28:08.392: ERROR/AndroidRuntime(2888): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.s.android.test/com.s.android.test.MainActivity}: java.lang.ClassNotFoundException: com.s.android.test.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.s.android.test-2.apk] 01-13 02:28:08.392: ERROR/AndroidRuntime(2888): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1544)

Error >paste.org

Upvotes: 0

Views: 1104

Answers (2)

C0deAttack
C0deAttack

Reputation: 24667

Your Logcat says java.lang.ClassNotFoundException: com.s.android.test.MainActivity

To me this implies the package name in your Manifest isn't correctly defined for that Activity.

Edit:

You need to just check the base package and the path to your activity match the actual package your activity is in. Eg:

<manifest package="com.example.project" . . . >
<application . . . >
    <service android:name=".SecretService" . . . >

The SecretService class would thus be found in com.example.project.SecretService (Obviously the example shows this for a Service but the same is true for an Activity.) You should probably also read more about the fundatmentals here: http://developer.android.com/guide/topics/manifest/manifest-intro.html

Upvotes: 0

Jonas Schmid
Jonas Schmid

Reputation: 5491

This page states:

Currently, an application must declare in its manifest any components or resources that it is using from a library project.

So if I understood your question correctly, yes you have to redeclare the activities.

Upvotes: 1

Related Questions