user3219446
user3219446

Reputation: 117

java.lang.RuntimeException: Unable to instantiate activity

I got this error from some devices with Android 4.4 like Galaxy Tab3 8.0 (lt01wifi) if you have this tab,please reply. The app works just fine on the rest of the devices. Please help me! i'm having a lot of bad ratings..

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{aladin888.dessin/aladin888.dessin.Splash}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2208)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2340)
at android.app.ActivityThread.access$800(ActivityThread.java:157)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.app.Activity.setRequestedOrientation(Activity.java:4453)

And i can't figure out where's the issue. everything seems to be correct (to me) in my manifest.The activity in question is registred as you can see:

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

    <supports-screens
        android:anyDensity="true"
        android:largeScreens="true"
        android:normalScreens="true"
        android:resizeable="true"
        android:smallScreens="true" />

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

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/>    


    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name" >
        <activity
            android:name="aladin888.dessin.Splash"
            android:label="@string/app_name"
            android:exported="true"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" 
            android:configChanges="keyboard|keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="aladin888.dessin.EasyPaint"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
            <intent-filter>

            </intent-filter>
        </activity>


    <activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
   </application>

</manifest>

Thank you for your help Dawnkeeper! but i'm still having the same issue, and i'm getting a lot bad ratings Any more ideas will be very appreciated!!

Upvotes: 0

Views: 295

Answers (1)

Dawnkeeper
Dawnkeeper

Reputation: 2873

You are referencing the package in the name

 android:name="aladin888.dessin.Splash"

should be

android:name=".Splash"

edit

As we found out this isn't really the problem. Another hint is this:

Caused by: java.lang.NullPointerException
at android.app.Activity.setRequestedOrientation(Activity.java:4453)

I searched for a while, but could not find a android version that has this method at the given line. What I found out is that method has not changed in a while:

 public void setRequestedOrientation(int requestedOrientation) {
       if (mParent == null) {
           try {
                ActivityManagerNative.getDefault().setRequestedOrientation(
                        mToken, requestedOrientation);
            } catch (RemoteException e) {
                // Empty
            }
        } else {
            mParent.setRequestedOrientation(requestedOrientation);
        }
    }

The only chance I see for this failing is when the ActivityManagerNative.getDefault() returns null. I couldn't find anything helpful for this issue.

Upvotes: 1

Related Questions