when I try to run my app i get this error on LogCat:
08-23 17:32:01.700: E/AndroidRuntime(4518): FATAL EXCEPTION: main
08-23 17:32:01.700: E/AndroidRuntime(4518): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.app.myapp/com.library.core.presentation.SessionActivity}: java.lang.NullPointerException
08-23 17:32:01.700: E/AndroidRuntime(4518): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1573)
08-23 17:32:01.700: E/AndroidRuntime(4518): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
the problem appears when i touch on a list item, corresponding to this Intent:
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id)
{
Intent sessionIntent = new Intent(view.getContext(), SessionActivity.class);
//sessionIntent.putExtras(bundle);
startActivity(sessionIntent);
}
SessionActivity is a class contained in a library project that i have to use for this app.
My Manifest file is this:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.app.myapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="10" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.rdp.rdp_prova.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="com.library.core.presentation.SessionActivity" />
</application>
</manifest>
what's wrong?
Related
please my app crashes whenever i click the navigation item to start activity. i Have tried all the solutions from similar questions in the last 6 hours to no avail. that includes registering the activity in manifest, changing intent (this,menu_profile.class); to (mainactivity.this, menu_profile.class); to `(getApplicationContext(), menu_profile.class);. googling permission (13) error to brought no solution.
snippet
else if (itemId == R.id.third) {
Intent intent = new Intent(getApplicationContext(), Menu_Profile.class);
startActivity(intent);
}
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.majesty.adesanmi.viewpager_nav">
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme">
<activity
android:name=".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=".Menu_Profile"
android:label="DestinationActivity"/>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</application>
</manifest>
Logcat error
06-16 09:46:56.913 2889-2889/? E/Trace: error opening trace file: Permission denied (13)
06-16 09:46:56.983 2889-2889/com.majesty.adesanmi.viewpager_nav E/dalvikvm: Could not find class 'android.graphics.drawable.RippleDrawable', referenced from method android.support.v7.widget.AppCompatImageHelper.hasOverlappingRendering
06-16 09:47:41.673 2889-2889/com.majesty.adesanmi.viewpager_nav E/AndroidRuntime: FATAL EXCEPTION: main
android.content.ActivityNotFoundException: Unable to find explicit activity class {com.majesty.adesanmi.viewpager_nav/com.majesty.adesanmi.viewpager_nav.Menu_About}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
at android.app.Activity.startActivityForResult(Activity.java:3351)
at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:50)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:79)
at android.app.Activity.startActivityForResult(Activity.java:3312)
at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859)
at android.app.Activity.startActivity(Activity.java:3522)
at android.app.Activity.startActivity(Activity.java:3490)
at com.majesty.adesanmi.viewpager_nav.MainActivity$2.onNavigationItemSelected(MainActivity.java:157)
at android.support.design.widget.NavigationView$1.onMenuItemSelected(NavigationView.java:156)
at android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:822)
at android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:156)
at android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:969)
at android.support.design.internal.NavigationMenuPresenter$1.onClick(NavigationMenuPresenter.java:342)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
just remove intent filter from your menu profilr activity this from your Manifist file or replace this
<?xml version="1.0" encoding="utf-8"?>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:theme="#style/AppTheme">
<activity
android:name=".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=".Menu_Profile"
android:label="DestinationActivity"/>
</application>
referring to thread Unfortunately, 'app_name' has stopped, I solved it, I get a new error:
FATAL EXCEPTION: main
Process: com.cursoandroid.miarrayadapter, PID: 1253
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.cursoandroid.miarrayadapter/com.cursoandroid.miarrayadapter.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread
Mi main Activity is already app.compat
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.cursoandroid.miarrayadapter" >
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.AppCompat" >
<activity
android:theme="#style/Theme.AppCompat"
android:name=".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>
</application>
</manifest>
But I´m geeting to execute the application:
I dont understand it?
Since you are using the appcompat library the xmlns attribute in menu_main.xml should be:
<menu xmlns:yourapp="http://schemas.android.com/apk/res-auto" .... >
as given in the android documentation:
http://developer.android.com/guide/topics/ui/actionbar.html
In my android application it crashes and display this message, and I added the activity in androidmanifest but same error !!
11-16 08:56:00.077: E/AndroidRuntime(622): FATAL EXCEPTION: main
11-16 08:56:00.077: E/AndroidRuntime(622): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.upnpexample/com.example.androidhive.CustomizedListView}; have you declared this activity in your AndroidManifest.xml?
EDITED
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.upnpexample"
android:versionCode="1"
android:versionName="1.0">
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"></uses- permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"></uses-permission>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-sdk android:minSdkVersion="7"></uses-sdk>
<application android:icon="#drawable/appicon" android:label="#string/app_name" android:name=".UpnpControlApplication">
<activity android:name=".MainActivity" android:theme="#android:style/Theme.NoTitleBar" android:configChanges="orientation|keyboardHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN"></action>
<category android:name="android.intent.category.LAUNCHER"></category>
</intent-filter>
</activity>
<activity android:name=".BrowseActivity"
android:label="#string/app_name">
</activity>
<activity android:name=".BrowseServerActivity" android:label="#string/app_name"></activity>
<service android:name=".BrowserUpnpService"></service>
<activity android:label="#string/list_player" android:name=".EPGview"/>
<activity android:label="#string/list_player" android:name=".Playsimplevideo"/>
<activity android:label="#string/list_player" android:name=".Streaming"/>
<activity android:label="#string/list_player" android:name=".LazyAdapter"/>
<activity android:label="#string/list_player" android:name=".CustomizedListView"/>
</application>
EDIT 2
I put them in the same package and now it displays this errors
11-16 09:21:18.076: D/AndroidRuntime(710): Shutting down VM
11-16 09:21:18.076: W/dalvikvm(710): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-16 09:21:18.086: E/AndroidRuntime(710): FATAL EXCEPTION: main
11-16 09:21:18.086: E/AndroidRuntime(710): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.upnpexample/com.upnpexample.CustomizedListView}: java.lang.NullPointerException
i put them in the same package and now it displays this errors
11-16 09:21:18.076: D/AndroidRuntime(710): Shutting down VM
11-16 09:21:18.076: W/dalvikvm(710): threadid=1: thread exiting with uncaught exception (group=0x40015560)
11-16 09:21:18.086: E/AndroidRuntime(710): FATAL EXCEPTION: main
11-16 09:21:18.086: E/AndroidRuntime(710): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.upnpexample/com.upnpexample.CustomizedListView}: java.lang.NullPointerException
Change the package in class CustomizedListView from:
package com.example.androidhive;
to:
package com.upnpexample;
I am getting the following error:
ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.optionpricing/.optionListNew } from null (pid=1160, uid=2000) requires null
I am new to programming in Android and I could not make sense of the other postings related to my problem. I wonder if there is an issue with the optionListNew class? Can someone lend a hand so I can move on to completing my app. Also, the app runs in my virtual device, and I only get this error when I try to test it on my actual phone.
Any ideas are appreciated. Below is the manifest file.
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0"
package="com.optionpricing" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
<application android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="true">
<activity android:name=".optionListNew">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".OptionPricing"/>
<activity android:name=".optionListNew"/>
<activity android:name=".futureOptionActivity"/>
<activity android:name=".currencyOptionActivity"/>
<activity android:name=".gapOptionActivity"/>
<activity android:name=".gapOptionList01"/>
<activity android:name=".barrierSingleUpInActivity"/>
<activity android:name=".testActivity"/>
<activity android:name=".barrierlistview"/>
<activity android:name=".barrierSingleDownInActivity"/>
</application>
</manifest>
You added "optionListNew" activity twice in the manifest file.. remove below activity by deleting this line
<activity android:name=".optionListNew"/>
Your Manifest.xml code will become
<?xml version="1.0" encoding="UTF-8"?>
<manifest android:versionCode="1" android:versionName="1.0"
package="com.optionpricing" xmlns:android="http://schemas.android.com/apk/res/android">
<uses-sdk android:minSdkVersion="8"/>
<application android:icon="#drawable/icon"
android:label="#string/app_name"
android:debuggable="true">
<activity android:name=".optionListNew">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".OptionPricing"/>
<activity android:name=".futureOptionActivity"/>
<activity android:name=".currencyOptionActivity"/>
<activity android:name=".gapOptionActivity"/>
<activity android:name=".gapOptionList01"/>
<activity android:name=".barrierSingleUpInActivity"/>
<activity android:name=".testActivity"/>
<activity android:name=".barrierlistview"/>
<activity android:name=".barrierSingleDownInActivity"/>
</application>
</manifest>
optionListNew is present twice in the manifest. Remove the second.
HY!
I always get the ActivityNotFound Error, but i already have my Activity declared in the Manifest.
Whats wrong?
Error:
10-17 20:28:24.881: ERROR/AndroidRuntime(2141): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.korn.supplierplan/com.korn.supplierplan.view.LVEntries}; have you declared this activity in your AndroidManifest.xml?
Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.korn.supplierplan"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<uses-permission android:name = "android.permission.INTERNET"> </uses-permission>
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".view.Login"
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=".view.LVEntries"></activity>
</application>
</manifest>
Calling:
Intent i = new Intent (Login.this,LVEntries.class);
i.putExtra("JSON", array.toString());
startActivity(i);
The problem is in how you are naming the Activities in you Manifest file.
I'm guessing your class files are named Login.java not view.Login.java, am I right? If so change this:
<activity android:name=".view.Login" android:label="#string/app_name">
To This
<activity android:name="Login" android:label="#string/app_name">
Do the same for LVEntries
If they are named like view.Login.java then remove the prepended view. in the name.