Chanakya Vadla
Chanakya Vadla

Reputation: 3059

Android Multiple Packages issue

I have project in my eclipse where I have used multiple packages with the same prefix for all the packages. Here is a screenshot of the structure!

Eclipse IDE screenshot

The problem is, that when I run the application I get this error message:

Unable to start activity ComponentInfo{com.td.bookshelf/com.td.bookshelf.SplashActivity}: java.lang.NullPointerException)

I have added all the packages manually and copied the class files from the other project. So I clean built the project and also restarted the eclipse but in vain.

Please help me to get rid of the error.

08-22 13:43:07.367: E/AndroidRuntime(4900): FATAL EXCEPTION: main
08-22 13:43:07.367: E/AndroidRuntime(4900): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.td.bookshelf/com.td.bookshelf.SplashActivity}: java.lang.NullPointerException
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.os.Looper.loop(Looper.java:123)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.ActivityThread.main(ActivityThread.java:3687)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at java.lang.reflect.Method.invokeNative(Native Method)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at java.lang.reflect.Method.invoke(Method.java:507)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at dalvik.system.NativeStart.main(Native Method)
08-22 13:43:07.367: E/AndroidRuntime(4900): Caused by: java.lang.NullPointerException
08-22 13:43:07.367: E/AndroidRuntime(4900):     at com.td.bookshelf.SplashActivity.onCreate(SplashActivity.java:56)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-22 13:43:07.367: E/AndroidRuntime(4900):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
08-22 13:43:07.367: E/AndroidRuntime(4900):     ... 11 more

Upvotes: 2

Views: 197

Answers (1)

Timothée Jeannin
Timothée Jeannin

Reputation: 9912

It looks like the error is not coming from your package structure.

In the stack trace you can read :

E/AndroidRuntime(4900): Caused by: java.lang.NullPointerException
E/AndroidRuntime(4900):     at com.td.bookshelf.SplashActivity.onCreate(SplashActivity.java:56)

You're getting a NullPointerException when the onCreate method of the SplashActivity is called.

There's probably something wrong in your onCreate method.

Upvotes: 1

Related Questions