Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Unable to instantiate activity ComponentInfo when using app as launcher

$
0
0

Hi. I'm trying to make my app work as a launcher, so I simply add proper intent settings to manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="pl.roger.rtat">
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" />
    <uses-permission android:name="android.permission.NFC" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-feature android:name="android.hardware.usb.host" />
    <application android:label="RTAT" android:icon="@drawable/icon" android:hardwareAccelerated="true" android:launchMode="singleTask">
        <activity android:name=".MainActivity">
            <meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
            <meta-data android:name="android.hardware.usb.action.USB_DEVICE_DETACHED" android:resource="@xml/device_filter" />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
</manifest>

When I start it from Xamarin Studio or from default launcher - it starts. But when i try to run it from HOME button it doesn't. Log says, that my main class couldn't be found. So why it's running why executing as normal app, not as launcher? I've tried to change <activity android:name=".MainActivity"> to <activity android:name="pl.roger.rtat.MainActivity">, but it didn't help. Any ideas?

12-18 08:43:30.945: E/AndroidRuntime(5110): FATAL EXCEPTION: main
12-18 08:43:30.945: E/AndroidRuntime(5110): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{pl.roger.rtat/pl.roger.rtat.MainActivity}: java.lang.ClassNotFoundException: pl.roger.rtat.MainActivity
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.ActivityThread.access$600(ActivityThread.java:130)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.os.Looper.loop(Looper.java:137)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.ActivityThread.main(ActivityThread.java:4745)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at java.lang.reflect.Method.invokeNative(Native Method)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at java.lang.reflect.Method.invoke(Method.java:511)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at dalvik.system.NativeStart.main(Native Method)
12-18 08:43:30.945: E/AndroidRuntime(5110): Caused by: java.lang.ClassNotFoundException: pl.roger.rtat.MainActivity
12-18 08:43:30.945: E/AndroidRuntime(5110):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
12-18 08:43:30.945: E/AndroidRuntime(5110):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>